gradient-line.html 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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>Gradient Line</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;line&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. name: 'Likes',
  50. data: [4, 3, 10, 9, 29, 19, 22, 9, 12, 7, 19, 5, 13, 9, 17, 2, 7, 5]
  51. }],
  52. options: {
  53. chart: {
  54. height: 350,
  55. type: 'line',
  56. },
  57. stroke: {
  58. width: 7,
  59. curve: 'smooth'
  60. },
  61. xaxis: {
  62. type: 'datetime',
  63. categories: ['1/11/2000', '2/11/2000', '3/11/2000', '4/11/2000', '5/11/2000', '6/11/2000', '7/11/2000', '8/11/2000', '9/11/2000', '10/11/2000', '11/11/2000', '12/11/2000', '1/11/2001', '2/11/2001', '3/11/2001','4/11/2001' ,'5/11/2001' ,'6/11/2001'],
  64. },
  65. title: {
  66. text: 'Social Media',
  67. align: 'left',
  68. style: {
  69. fontSize: "16px",
  70. color: '#666'
  71. }
  72. },
  73. fill: {
  74. type: 'gradient',
  75. gradient: {
  76. shade: 'dark',
  77. gradientToColors: [ '#FDD835'],
  78. shadeIntensity: 1,
  79. type: 'horizontal',
  80. opacityFrom: 1,
  81. opacityTo: 1,
  82. stops: [0, 100, 100, 100]
  83. },
  84. },
  85. markers: {
  86. size: 4,
  87. colors: ["#FFA41B"],
  88. strokeColors: "#fff",
  89. strokeWidth: 2,
  90. hover: {
  91. size: 7,
  92. }
  93. },
  94. yaxis: {
  95. min: -10,
  96. max: 40,
  97. title: {
  98. text: 'Engagement',
  99. },
  100. }
  101. },
  102. };
  103. }
  104. render() {
  105. return (
  106. <div>
  107. <div id="chart">
  108. <ReactApexChart options={this.state.options} series={this.state.series} type="line" height={350} />
  109. </div>
  110. <div id="html-dist"></div>
  111. </div>
  112. );
  113. }
  114. }
  115. const domContainer = document.querySelector('#app');
  116. ReactDOM.render(React.createElement(ApexChart), domContainer);
  117. </script>
  118. </body>
  119. </html>