range-annotations-inverted-axis-example.html 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  6. <meta http-equiv="X-UA-Compatible" content="ie=edge" />
  7. <title>Inverted axis chart with Range Annotations</title>
  8. <link href="../../assets/styles.css" rel="stylesheet" />
  9. <style>
  10. #chart {
  11. max-width: 650px;
  12. margin: 35px auto;
  13. }
  14. </style>
  15. <script>
  16. window.Promise ||
  17. document.write(
  18. '<script src="https://cdn.jsdelivr.net/npm/promise-polyfill@8/dist/polyfill.min.js"><\/script>'
  19. )
  20. window.Promise ||
  21. document.write(
  22. '<script src="https://cdn.jsdelivr.net/npm/eligrey-classlist-js-polyfill@1.2.20171210/classList.min.js"><\/script>'
  23. )
  24. window.Promise ||
  25. document.write(
  26. '<script src="https://cdn.jsdelivr.net/npm/findindex_polyfill_mdn"><\/script>'
  27. )
  28. </script>
  29. <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.min.js"></script>
  30. <script src="https://cdn.jsdelivr.net/npm/apexcharts"></script>
  31. <script src="https://cdn.jsdelivr.net/npm/vue-apexcharts"></script>
  32. <script src="../../assets/stock-prices.js"></script>
  33. </head>
  34. <body>
  35. <div id="app">
  36. <div id="chart">
  37. <apexchart type="bar" height="350" :options="chartOptions" :series="series"></apexchart>
  38. </div>
  39. </div>
  40. <!-- Below element is just for displaying source code. it is not required. DO NOT USE -->
  41. <div id="html">
  42. &lt;div id=&quot;chart&quot;&gt;
  43. &lt;apexchart type=&quot;bar&quot; height=&quot;350&quot; :options=&quot;chartOptions&quot; :series=&quot;series&quot;&gt;&lt;/apexchart&gt;
  44. &lt;/div&gt;
  45. </div>
  46. <script>
  47. new Vue({
  48. el: '#app',
  49. components: {
  50. apexchart: VueApexCharts,
  51. },
  52. data: {
  53. series: [{
  54. data: [400, 430, 448, 470, 540, 580, 690, 1100, 1200, 1380]
  55. }],
  56. chartOptions: {
  57. annotations: {
  58. yaxis: [{
  59. y: 'United Kingdom',
  60. y2: 'South Korea',
  61. borderColor: '#FEB019',
  62. label: {
  63. borderColor: '#333',
  64. style: {
  65. fontSize: '10px',
  66. color: '#333',
  67. background: '#FEB019',
  68. },
  69. text: 'Y-axis range',
  70. }
  71. }],
  72. xaxis: [{
  73. x: 400,
  74. x2: 800,
  75. borderColor: '#00E396',
  76. label: {
  77. borderColor: '#00E396',
  78. style: {
  79. fontSize: '10px',
  80. color: '#fff',
  81. background: '#00E396',
  82. },
  83. offsetY: -10,
  84. text: 'X-axis range',
  85. }
  86. }]
  87. },
  88. chart: {
  89. height: 350,
  90. type: 'bar',
  91. },
  92. plotOptions: {
  93. bar: {
  94. horizontal: true,
  95. }
  96. },
  97. dataLabels: {
  98. enabled: false
  99. },
  100. xaxis: {
  101. categories: ['South Korea', 'Canada', 'United Kingdom', 'Netherlands', 'Italy', 'France', 'Japan', 'United States', 'China', 'Germany'],
  102. }
  103. },
  104. },
  105. })
  106. </script>
  107. </body>
  108. </html>