symbol.html 4.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <html>
  2. <head>
  3. <meta charset="utf-8">
  4. <script src="esl.js"></script>
  5. <script src="config.js"></script>
  6. </head>
  7. <body>
  8. <style>
  9. html, body, #main {
  10. width: 100%;
  11. height: 100%;
  12. }
  13. </style>
  14. <div id="main"></div>
  15. <script>
  16. require([
  17. 'echarts',
  18. 'echarts/chart/scatter',
  19. 'echarts/component/legend',
  20. 'echarts/component/grid',
  21. 'echarts/component/tooltip'
  22. ], function (echarts) {
  23. var chart = echarts.init(document.getElementById('main'), null, {
  24. renderer: 'canvas'
  25. });
  26. var symbolList = [
  27. 'circle',
  28. 'triangle',
  29. 'diamond',
  30. 'pin',
  31. 'image://http://echarts.baidu.com/doc/asset/img/echarts-logo.png',
  32. 'path://M432.45,595.444c0,2.177-4.661,6.82-11.305,6.82c-6.475,0-11.306-4.567-11.306-6.82s4.852-6.812,11.306-6.812C427.841,588.632,432.452,593.191,432.45,595.444L432.45,595.444z M421.155,589.876c-3.009,0-5.448,2.495-5.448,5.572s2.439,5.572,5.448,5.572c3.01,0,5.449-2.495,5.449-5.572C426.604,592.371,424.165,589.876,421.155,589.876L421.155,589.876z M421.146,591.891c-1.916,0-3.47,1.589-3.47,3.549c0,1.959,1.554,3.548,3.47,3.548s3.469-1.589,3.469-3.548C424.614,593.479,423.062,591.891,421.146,591.891L421.146,591.891zM421.146,591.891',
  33. 'emptyPath://M432.45,595.444c0,2.177-4.661,6.82-11.305,6.82c-6.475,0-11.306-4.567-11.306-6.82s4.852-6.812,11.306-6.812C427.841,588.632,432.452,593.191,432.45,595.444L432.45,595.444z M421.155,589.876c-3.009,0-5.448,2.495-5.448,5.572s2.439,5.572,5.448,5.572c3.01,0,5.449-2.495,5.449-5.572C426.604,592.371,424.165,589.876,421.155,589.876L421.155,589.876z M421.146,591.891c-1.916,0-3.47,1.589-3.47,3.549c0,1.959,1.554,3.548,3.47,3.548s3.469-1.589,3.469-3.548C424.614,593.479,423.062,591.891,421.146,591.891L421.146,591.891zM421.146,591.891'
  34. ];
  35. function random(max) {
  36. return (Math.random() * max).toFixed(3);
  37. }
  38. var series = symbolList.map(function (symbol, idx) {
  39. var seriesData = [];
  40. for (var i = 0; i < 20; i++) {
  41. seriesData.push([random(10), random(10), (+random(0.5) + 0.2).toFixed(3)]);
  42. }
  43. return {
  44. name: symbol.split('://')[0],
  45. type: 'scatter',
  46. symbol: symbol,
  47. symbolSize: function (val) {
  48. if (symbol.indexOf('path') >= 0 || symbol.indexOf('Path') >= 0) {
  49. return [val[2] * 60, val[2] * 40];
  50. }
  51. else {
  52. return val[2] * 60;
  53. }
  54. },
  55. label: {
  56. emphasis: {
  57. show: false
  58. }
  59. },
  60. data: seriesData
  61. };
  62. });
  63. chart.setOption({
  64. legend: {
  65. data: series.map(function (series) {return series.name;})
  66. },
  67. tooltip: {
  68. trigger: 'axis',
  69. axisPointer: {
  70. type: 'cross'
  71. }
  72. },
  73. xAxis: {
  74. type: 'value',
  75. splitLine: {
  76. show: false
  77. }
  78. },
  79. yAxis: {
  80. type: 'value',
  81. splitLine: {
  82. show: false
  83. }
  84. },
  85. series: series
  86. });
  87. });
  88. </script>
  89. </body>
  90. </html>