|
| 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>Custom Legend</title> |
| 8 | + |
| 9 | + <link href="../../assets/styles.css" rel="stylesheet" /> |
| 10 | + |
| 11 | + <style> |
| 12 | + |
| 13 | + #chart { |
| 14 | + max-width: 650px; |
| 15 | + margin: 35px auto; |
| 16 | + } |
| 17 | + |
| 18 | + </style> |
| 19 | + |
| 20 | + <script> |
| 21 | + window.Promise || |
| 22 | + document.write( |
| 23 | + '<script src="https://cdn.jsdelivr.net/npm/promise-polyfill@8/dist/polyfill.min.js"><\/script>' |
| 24 | + ) |
| 25 | + window.Promise || |
| 26 | + document.write( |
| 27 | + '<script src="https://cdn.jsdelivr.net/npm/[email protected]/classList.min.js"><\/script>' |
| 28 | + ) |
| 29 | + window.Promise || |
| 30 | + document.write( |
| 31 | + '<script src="https://cdn.jsdelivr.net/npm/findindex_polyfill_mdn"><\/script>' |
| 32 | + ) |
| 33 | + </script> |
| 34 | + |
| 35 | + |
| 36 | + <script src=" https://cdn.jsdelivr.net/npm/[email protected]/umd/react.production.min.js" ></script> |
| 37 | + <script src=" https://cdn.jsdelivr.net/npm/[email protected]/umd/react-dom.production.min.js" ></script> |
| 38 | + <script src=" https://cdn.jsdelivr.net/npm/[email protected]/prop-types.min.js" ></script> |
| 39 | + <script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.34/browser.min.js"></script> |
| 40 | + <script src="../../../dist/apexcharts.js"></script> |
| 41 | + <script src=" https://cdn.jsdelivr.net/npm/[email protected]/dist/react-apexcharts.iife.min.js" ></script> |
| 42 | + |
| 43 | + |
| 44 | + <script> |
| 45 | + // Replace Math.random() with a pseudo-random number generator to get reproducible results in e2e tests |
| 46 | + // Based on https://gist.github.com/blixt/f17b47c62508be59987b |
| 47 | + var _seed = 42; |
| 48 | + Math.random = function() { |
| 49 | + _seed = _seed * 16807 % 2147483647; |
| 50 | + return (_seed - 1) / 2147483646; |
| 51 | + }; |
| 52 | + </script> |
| 53 | + |
| 54 | + <link rel=" stylesheet" href=" https://cdn.jsdelivr.net/npm/[email protected]/dist/pretty-checkbox.min.css" > |
| 55 | + </head> |
| 56 | + |
| 57 | + <body> |
| 58 | + |
| 59 | + <div id="app"></div> |
| 60 | + |
| 61 | + <div id="html"> |
| 62 | + <div id="chart"> |
| 63 | + <ReactApexChart options={this.state.options} series={this.state.series} type="area" height={350} /> |
| 64 | +</div> |
| 65 | + </div> |
| 66 | + |
| 67 | + <script type="text/babel"> |
| 68 | + class ApexChart extends React.Component { |
| 69 | + constructor(props) { |
| 70 | + super(props); |
| 71 | + |
| 72 | + this.state = { |
| 73 | + |
| 74 | + series: [{ |
| 75 | + name: 'Network In', |
| 76 | + data: [], |
| 77 | + }], |
| 78 | + options: { |
| 79 | + chart: { |
| 80 | + type: 'area', |
| 81 | + height: 350, |
| 82 | + animations: { |
| 83 | + enabled: false |
| 84 | + }, |
| 85 | + zoom: { |
| 86 | + enabled: false |
| 87 | + }, |
| 88 | + }, |
| 89 | + dataLabels: { |
| 90 | + enabled: false |
| 91 | + }, |
| 92 | + stroke: { |
| 93 | + curve: 'smooth' |
| 94 | + }, |
| 95 | + markers: { |
| 96 | + size: 5, |
| 97 | + hover: { |
| 98 | + size: 9 |
| 99 | + } |
| 100 | + }, |
| 101 | + title: { |
| 102 | + text: 'Network Monitoring', |
| 103 | + }, |
| 104 | + tooltip: { |
| 105 | + intersect: true, |
| 106 | + shared: false |
| 107 | + }, |
| 108 | + theme: { |
| 109 | + palette: 'palette1' |
| 110 | + }, |
| 111 | + xaxis: { |
| 112 | + type: 'datetime', |
| 113 | + }, |
| 114 | + yaxis: { |
| 115 | + showForNullSeries: false, |
| 116 | + tickAmount: 3, |
| 117 | + min: 0, |
| 118 | + title: { |
| 119 | + text: 'Received MB' |
| 120 | + } |
| 121 | + }, |
| 122 | + noData: { |
| 123 | + text: 'No Data', |
| 124 | + style: { |
| 125 | + color: '#FCC', |
| 126 | + fontSize: '24px' |
| 127 | + } |
| 128 | + } |
| 129 | + }, |
| 130 | + |
| 131 | + |
| 132 | + }; |
| 133 | + } |
| 134 | + |
| 135 | + |
| 136 | + |
| 137 | + render() { |
| 138 | + return ( |
| 139 | + <div> |
| 140 | + <div id="chart"> |
| 141 | + <ReactApexChart options={this.state.options} series={this.state.series} type="area" height={350} /> |
| 142 | + </div> |
| 143 | + <div id="html-dist"></div> |
| 144 | + </div> |
| 145 | + ); |
| 146 | + } |
| 147 | + } |
| 148 | + |
| 149 | + const domContainer = document.querySelector('#app'); |
| 150 | + ReactDOM.render(React.createElement(ApexChart), domContainer); |
| 151 | + </script> |
| 152 | + |
| 153 | + |
| 154 | + </body> |
| 155 | +</html> |
0 commit comments