range-column.html 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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>Range Column Chart</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/react@16.12/umd/react.production.min.js"></script>
  30. <script src="https://cdn.jsdelivr.net/npm/react-dom@16.12/umd/react-dom.production.min.js"></script>
  31. <script src="https://cdn.jsdelivr.net/npm/prop-types@15.7.2/prop-types.min.js"></script>
  32. <script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.34/browser.min.js"></script>
  33. <script src="https://cdn.jsdelivr.net/npm/apexcharts"></script>
  34. <script src="https://cdn.jsdelivr.net/npm/react-apexcharts@1.3.6/dist/react-apexcharts.iife.min.js"></script>
  35. </head>
  36. <body>
  37. <div id="app"></div>
  38. <div id="html">
  39. &lt;div id=&quot;chart&quot;&gt;
  40. &lt;ReactApexChart options={this.state.options} series={this.state.series} type=&quot;rangeBar&quot; height={350} /&gt;
  41. &lt;/div&gt;
  42. </div>
  43. <script type="text/babel">
  44. class ApexChart extends React.Component {
  45. constructor(props) {
  46. super(props);
  47. this.state = {
  48. series: [{
  49. data: [{
  50. x: 'Team A',
  51. y: [1, 5]
  52. }, {
  53. x: 'Team B',
  54. y: [4, 6]
  55. }, {
  56. x: 'Team C',
  57. y: [5, 8]
  58. }, {
  59. x: 'Team D',
  60. y: [3, 11]
  61. }]
  62. }, {
  63. data: [{
  64. x: 'Team A',
  65. y: [2, 6]
  66. }, {
  67. x: 'Team B',
  68. y: [1, 3]
  69. }, {
  70. x: 'Team C',
  71. y: [7, 8]
  72. }, {
  73. x: 'Team D',
  74. y: [5, 9]
  75. }]
  76. }],
  77. options: {
  78. chart: {
  79. type: 'rangeBar',
  80. height: 350
  81. },
  82. plotOptions: {
  83. bar: {
  84. horizontal: false
  85. }
  86. },
  87. dataLabels: {
  88. enabled: true
  89. }
  90. },
  91. };
  92. }
  93. render() {
  94. return (
  95. <div>
  96. <div id="chart">
  97. <ReactApexChart options={this.state.options} series={this.state.series} type="rangeBar" height={350} />
  98. </div>
  99. <div id="html-dist"></div>
  100. </div>
  101. );
  102. }
  103. }
  104. const domContainer = document.querySelector('#app');
  105. ReactDOM.render(React.createElement(ApexChart), domContainer);
  106. </script>
  107. </body>
  108. </html>