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.

73 lines
1.9 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/gauge.js" type="text/javascript"></script>
  9. <script>
  10. var chart;
  11. var arrow;
  12. var axisKM;
  13. var axisMiles;
  14. AmCharts.ready(function () {
  15. // create angular gauge
  16. chart = new AmCharts.AmAngularGauge();
  17. chart.radius = "45%";
  18. // kilometers axis
  19. axisKM = new AmCharts.GaugeAxis();
  20. axisKM.startValue = 0;
  21. axisKM.endValue = 240;
  22. axisKM.radius = "100%";
  23. axisKM.inside = false;
  24. axisKM.gridInside = false;
  25. axisKM.axisColor = "#94dca0";
  26. axisKM.tickColor = "#94dca0";
  27. axisKM.axisThickness = 3;
  28. axisKM.valueInterval = 20;
  29. chart.addAxis(axisKM);
  30. // miles axis
  31. axisMiles = new AmCharts.GaugeAxis();
  32. axisMiles.startValue = 0;
  33. axisMiles.endValue = 160;
  34. axisMiles.radius = "80%";
  35. axisMiles.axisColor = "#bebd61";
  36. axisMiles.tickColor = "#bebd61";
  37. axisMiles.axisThickness = 3;
  38. axisMiles.valueInterval = 20;
  39. chart.addAxis(axisMiles);
  40. // arrow
  41. arrow = new AmCharts.GaugeArrow();
  42. arrow.radius = "85%";
  43. arrow.color = "#8ec487";
  44. arrow.innerRadius = 50;
  45. arrow.nailRadius = 0;
  46. chart.addArrow(arrow);
  47. chart.write("chartdiv");
  48. // update value every 2 seconds
  49. setInterval(randomValue, 2000);
  50. });
  51. // set random value
  52. function randomValue() {
  53. var value = Math.round(Math.random() * 240);
  54. arrow.setValue(value);
  55. }
  56. </script>
  57. </head>
  58. <body>
  59. <div id="chartdiv" style="width:400px; height:400px;"></div>
  60. </body>
  61. </html>