index.htm 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1">
  6. <title>Highstock Example</title>
  7. <style type="text/css">
  8. </style>
  9. </head>
  10. <body>
  11. <script src="../../code/highstock.js"></script>
  12. <script src="../../code/modules/data.js"></script>
  13. <script src="../../code/modules/exporting.js"></script>
  14. <div id="container" style="height: 400px"></div>
  15. <script type="text/javascript">
  16. Highcharts.getJSON('https://cdn.jsdelivr.net/gh/highcharts/highcharts@v7.0.0/samples/data/usdeur.json', function (data) {
  17. var year = new Date(data[data.length - 1][0]).getFullYear(); // Get year of last data point
  18. // Create the chart
  19. Highcharts.stockChart('container', {
  20. rangeSelector: {
  21. selected: 4
  22. },
  23. title: {
  24. text: 'USD to EUR exchange rate'
  25. },
  26. yAxis: {
  27. title: {
  28. text: 'Exchange rate'
  29. }
  30. },
  31. series: [{
  32. name: 'USD to EUR',
  33. data: data,
  34. id: 'dataseries',
  35. tooltip: {
  36. valueDecimals: 4
  37. }
  38. }, {
  39. type: 'flags',
  40. data: [{
  41. x: Date.UTC(year, 1, 22),
  42. title: 'A',
  43. text: 'Shape: "squarepin"'
  44. }, {
  45. x: Date.UTC(year, 3, 28),
  46. title: 'A',
  47. text: 'Shape: "squarepin"'
  48. }],
  49. onSeries: 'dataseries',
  50. shape: 'squarepin',
  51. width: 16
  52. }, {
  53. type: 'flags',
  54. data: [{
  55. x: Date.UTC(year, 2, 1),
  56. title: 'B',
  57. text: 'Shape: "circlepin"'
  58. }, {
  59. x: Date.UTC(year, 3, 1),
  60. title: 'B',
  61. text: 'Shape: "circlepin"'
  62. }],
  63. shape: 'circlepin',
  64. width: 16
  65. }, {
  66. type: 'flags',
  67. data: [{
  68. x: Date.UTC(year, 2, 10),
  69. title: 'C',
  70. text: 'Shape: "flag"'
  71. }, {
  72. x: Date.UTC(year, 3, 11),
  73. title: 'C',
  74. text: 'Shape: "flag"'
  75. }],
  76. color: Highcharts.getOptions().colors[0], // same as onSeries
  77. fillColor: Highcharts.getOptions().colors[0],
  78. onSeries: 'dataseries',
  79. width: 16,
  80. style: { // text style
  81. color: 'white'
  82. },
  83. states: {
  84. hover: {
  85. fillColor: '#395C84' // darker
  86. }
  87. }
  88. }]
  89. });
  90. });
  91. </script>
  92. </body>
  93. </html>