line-with-missing-data.html 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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>Line Chart with missing data</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: 'Peter',
  37. data: [5, 5, 10, 8, 7, 5, 4, null, null, null, 10, 10, 7, 8, 6, 9]
  38. }, {
  39. name: 'Johnny',
  40. data: [10, 15, null, 12, null, 10, 12, 15, null, null, 12, null, 14, null, null, null]
  41. }, {
  42. name: 'David',
  43. data: [null, null, null, null, 3, 4, 1, 3, 4, 6, 7, 9, 5, null, null, null]
  44. }],
  45. chart: {
  46. height: 350,
  47. type: 'line',
  48. zoom: {
  49. enabled: false
  50. },
  51. animations: {
  52. enabled: false
  53. }
  54. },
  55. stroke: {
  56. width: [5,5,4],
  57. curve: 'straight'
  58. },
  59. labels: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16],
  60. title: {
  61. text: 'Missing data (null values)'
  62. },
  63. xaxis: {
  64. },
  65. };
  66. var chart = new ApexCharts(document.querySelector("#chart"), options);
  67. chart.render();
  68. </script>
  69. </body>
  70. </html>