gradient-line.html 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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/apexcharts"></script>
  30. </head>
  31. <body>
  32. <div id="chart"></div>
  33. <script>
  34. var options = {
  35. series: [{
  36. name: 'Likes',
  37. data: [4, 3, 10, 9, 29, 19, 22, 9, 12, 7, 19, 5, 13, 9, 17, 2, 7, 5]
  38. }],
  39. chart: {
  40. height: 350,
  41. type: 'line',
  42. },
  43. stroke: {
  44. width: 7,
  45. curve: 'smooth'
  46. },
  47. xaxis: {
  48. type: 'datetime',
  49. 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'],
  50. },
  51. title: {
  52. text: 'Social Media',
  53. align: 'left',
  54. style: {
  55. fontSize: "16px",
  56. color: '#666'
  57. }
  58. },
  59. fill: {
  60. type: 'gradient',
  61. gradient: {
  62. shade: 'dark',
  63. gradientToColors: [ '#FDD835'],
  64. shadeIntensity: 1,
  65. type: 'horizontal',
  66. opacityFrom: 1,
  67. opacityTo: 1,
  68. stops: [0, 100, 100, 100]
  69. },
  70. },
  71. markers: {
  72. size: 4,
  73. colors: ["#FFA41B"],
  74. strokeColors: "#fff",
  75. strokeWidth: 2,
  76. hover: {
  77. size: 7,
  78. }
  79. },
  80. yaxis: {
  81. min: -10,
  82. max: 40,
  83. title: {
  84. text: 'Engagement',
  85. },
  86. }
  87. };
  88. var chart = new ApexCharts(document.querySelector("#chart"), options);
  89. chart.render();
  90. </script>
  91. </body>
  92. </html>