You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

138 lines
4.3 KiB

1 year ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  5. <title>amCharts examples</title>
  6. <link rel="stylesheet" href="style.css" type="text/css">
  7. <script src="../amcharts/amcharts.js" type="text/javascript"></script>
  8. <script src="../amcharts/xy.js" type="text/javascript"></script>
  9. <script>
  10. var chart;
  11. var chartData = [
  12. {
  13. "y": 10,
  14. "x": 14,
  15. "value": 59,
  16. "y2": -5,
  17. "x2": -3,
  18. "value2": 44
  19. },
  20. {
  21. "y": 5,
  22. "x": 3,
  23. "value": 50,
  24. "y2": -15,
  25. "x2": -8,
  26. "value2": 12
  27. },
  28. {
  29. "y": -10,
  30. "x": -3,
  31. "value": 19,
  32. "y2": -4,
  33. "x2": 6,
  34. "value2": 35
  35. },
  36. {
  37. "y": -6,
  38. "x": 5,
  39. "value": 65,
  40. "y2": -5,
  41. "x2": -6,
  42. "value2": 168
  43. },
  44. {
  45. "y": 15,
  46. "x": -4,
  47. "value": 92,
  48. "y2": -10,
  49. "x2": -8,
  50. "value2": 102
  51. },
  52. {
  53. "y": 13,
  54. "x": 1,
  55. "value": 8,
  56. "y2": -2,
  57. "x2": -3,
  58. "value2": 41
  59. },
  60. {
  61. "y": 1,
  62. "x": 6,
  63. "value": 35,
  64. "y2": 0,
  65. "x2": -3,
  66. "value2": 16
  67. }
  68. ];
  69. AmCharts.ready(function () {
  70. // XY Chart
  71. chart = new AmCharts.AmXYChart();
  72. chart.dataProvider = chartData;
  73. chart.startDuration = 1.5;
  74. // AXES
  75. // X
  76. var xAxis = new AmCharts.ValueAxis();
  77. xAxis.position = "bottom";
  78. xAxis.axisAlpha = 0;
  79. xAxis.minMaxMultiplayer = 1.2;
  80. chart.addValueAxis(xAxis);
  81. // Y
  82. var yAxis = new AmCharts.ValueAxis();
  83. yAxis.position = "left";
  84. yAxis.minMaxMultiplier = 1.2;
  85. yAxis.axisAlpha = 0;
  86. chart.addValueAxis(yAxis);
  87. // GRAPHS
  88. // first graph
  89. var graph = new AmCharts.AmGraph();
  90. graph.valueField = "value";
  91. graph.lineColor = "#b0de09";
  92. graph.xField = "x";
  93. graph.yField = "y";
  94. graph.lineAlpha = 0;
  95. graph.bullet = "bubble";
  96. graph.balloonText = "x:<b>[[x]]</b> y:<b>[[y]]</b><br>value:<b>[[value]]</b>";
  97. chart.addGraph(graph);
  98. // second graph
  99. graph = new AmCharts.AmGraph();
  100. graph.valueField = "value2";
  101. graph.lineColor = "#fcd202";
  102. graph.xField = "x2";
  103. graph.yField = "y2";
  104. graph.lineAlpha = 0;
  105. graph.bullet = "bubble";
  106. graph.balloonText = "x:<b>[[x]]</b> y:<b>[[y]]</b><br>value:<b>[[value]]</b>";
  107. chart.addGraph(graph);
  108. // CURSOR
  109. var chartCursor = new AmCharts.ChartCursor();
  110. chartCursor.valueLineBalloonEnabled = true;
  111. chart.addChartCursor(chartCursor);
  112. // SCROLLBAR
  113. var chartScrollbar = new AmCharts.ChartScrollbar();
  114. chartScrollbar.scrollbarHeight = 5;
  115. chartScrollbar.offset = 15
  116. chart.addChartScrollbar(chartScrollbar);
  117. // WRITE
  118. chart.write("chartdiv");
  119. });
  120. </script>
  121. </head>
  122. <body>
  123. <div id="chartdiv" style="width: 600px; height: 400px;"></div>
  124. </body>
  125. </html>