calendar-graph.html 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <html>
  2. <head>
  3. <meta charset="utf-8">
  4. <title>calendar</title>
  5. <meta name="viewport" content="width=device-width, initial-scale=1" />
  6. <link rel="stylesheet" href="lib/reset.css">
  7. <script src="lib/esl.js"></script>
  8. <script src="lib/config.js"></script>
  9. <script src="lib/jquery.min.js"></script>
  10. </head>
  11. <body>
  12. <style>
  13. html, body, #main {
  14. width: 100%;
  15. height: 100%;
  16. }
  17. </style>
  18. <div id="main"></div>
  19. <script>
  20. var graphData = [
  21. [
  22. 1485878400000,
  23. 260
  24. ],
  25. [
  26. 1486137600000,
  27. 200
  28. ],
  29. [
  30. 1486569600000,
  31. 279
  32. ],
  33. [
  34. 1486915200000,
  35. 847
  36. ],
  37. [
  38. 1487347200000,
  39. 241
  40. ],
  41. [
  42. 1487779200000,
  43. 411
  44. ],
  45. [
  46. 1488124800000,
  47. 985
  48. ]
  49. ];
  50. var links = graphData.map(function (item, idx) {
  51. return {
  52. source: idx,
  53. target: idx + 1
  54. };
  55. });
  56. links.pop();
  57. require([
  58. 'echarts'
  59. // 'echarts/chart/heatmap',
  60. // 'echarts/chart/scatter',
  61. // 'echarts/chart/effectScatter',
  62. // 'echarts/chart/graph',
  63. // 'echarts/component/title',
  64. // 'echarts/component/legend',
  65. // 'echarts/component/calendar',
  66. // 'echarts/component/tooltip',
  67. // 'echarts/component/visualMap'
  68. ], function (echarts) {
  69. var chart = echarts.init(document.getElementById('main'));
  70. chart.setOption({
  71. tooltip : {},
  72. calendar: {
  73. top: 100,
  74. orient: 'vertical',
  75. cellSize: 30,
  76. yearLabel: {
  77. margin: 40
  78. },
  79. dayLabel: {
  80. firstDay: 1
  81. },
  82. range: '2017-02'
  83. },
  84. series: {
  85. type: 'graph',
  86. edgeSymbol: ['none', 'arrow'],
  87. coordinateSystem: 'calendar',
  88. links: links,
  89. symbolSize: 10,
  90. calendarIndex: 0,
  91. data: graphData
  92. }
  93. });
  94. $(window).resize(function() {
  95. chart.resize();
  96. });
  97. });
  98. </script>
  99. </body>
  100. </html>