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.

92 lines
2.7 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. "x": 10,
  14. "y": 14,
  15. "value": 59
  16. },
  17. {
  18. "x": 5,
  19. "y": 3,
  20. "value": 50
  21. },
  22. {
  23. "x": -10,
  24. "y": -3,
  25. "value": 19
  26. },
  27. {
  28. "x": -6,
  29. "y": 5,
  30. "value": 65
  31. },
  32. {
  33. "x": 15,
  34. "y": -4,
  35. "value": 92
  36. },
  37. {
  38. "x": 13,
  39. "y": 1,
  40. "value": 8
  41. },
  42. {
  43. "x": 1,
  44. "y": 6,
  45. "value": 35
  46. }
  47. ];
  48. AmCharts.ready(function () {
  49. // XY Chart
  50. chart = new AmCharts.AmXYChart();
  51. chart.dataProvider = chartData;
  52. chart.startDuration = 1.5;
  53. // AXES
  54. // X
  55. var xAxis = new AmCharts.ValueAxis();
  56. xAxis.title = "X Axis";
  57. xAxis.position = "bottom";
  58. xAxis.autoGridCount = true;
  59. chart.addValueAxis(xAxis);
  60. // Y
  61. var yAxis = new AmCharts.ValueAxis();
  62. yAxis.title = "Y Axis";
  63. yAxis.position = "left";
  64. yAxis.autoGridCount = true;
  65. chart.addValueAxis(yAxis);
  66. // GRAPH
  67. var graph = new AmCharts.AmGraph();
  68. graph.valueField = "value"; // valueField responsible for the size of a bullet
  69. graph.xField = "x";
  70. graph.yField = "y";
  71. graph.lineAlpha = 0;
  72. graph.bullet = "bubble";
  73. graph.balloonText = "x:<b>[[x]]</b> y:<b>[[y]]</b><br>value:<b>[[value]]</b>"
  74. chart.addGraph(graph);
  75. // WRITE
  76. chart.write("chartdiv");
  77. });
  78. </script>
  79. </head>
  80. <body>
  81. <div id="chartdiv" style="width: 600px; height: 400px;"></div>
  82. </body>
  83. </html>