123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8" />
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
- <meta http-equiv="X-UA-Compatible" content="ie=edge" />
- <title>Area with Negative - Stacked</title>
- <link href="../../assets/styles.css" rel="stylesheet" />
- <style>
-
- #chart {
- max-width: 650px;
- margin: 35px auto;
- }
-
- </style>
- <script>
- window.Promise ||
- document.write(
- '<script src="https://cdn.jsdelivr.net/npm/promise-polyfill@8/dist/polyfill.min.js"><\/script>'
- )
- window.Promise ||
- document.write(
- '<script src="https://cdn.jsdelivr.net/npm/eligrey-classlist-js-polyfill@1.2.20171210/classList.min.js"><\/script>'
- )
- window.Promise ||
- document.write(
- '<script src="https://cdn.jsdelivr.net/npm/findindex_polyfill_mdn"><\/script>'
- )
- </script>
-
- <script src="https://cdn.jsdelivr.net/npm/react@16.12/umd/react.production.min.js"></script>
- <script src="https://cdn.jsdelivr.net/npm/react-dom@16.12/umd/react-dom.production.min.js"></script>
- <script src="https://cdn.jsdelivr.net/npm/prop-types@15.7.2/prop-types.min.js"></script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.34/browser.min.js"></script>
- <script src="https://cdn.jsdelivr.net/npm/apexcharts"></script>
- <script src="https://cdn.jsdelivr.net/npm/react-apexcharts@1.3.6/dist/react-apexcharts.iife.min.js"></script>
-
-
- </head>
- <body>
-
- <div id="app"></div>
- <div id="html">
- <div id="chart">
- <ReactApexChart options={this.state.options} series={this.state.series} type="area" height={350} />
- </div>
- </div>
- <script type="text/babel">
- class ApexChart extends React.Component {
- constructor(props) {
- super(props);
- this.state = {
-
- series: [{
- name: 'north',
- data: [{
- x: 1996,
- y: 322
- },
- {
- x: 1997,
- y: 324
- },
- {
- x: 1998,
- y: 329
- },
- {
- x: 1999,
- y: 342
- },
- {
- x: 2000,
- y: 348
- },
- {
- x: 2001,
- y: 334
- },
- {
- x: 2002,
- y: 325
- },
- {
- x: 2003,
- y: 316
- },
- {
- x: 2004,
- y: 318
- },
- {
- x: 2005,
- y: 330
- },
- {
- x: 2006,
- y: 355
- },
- {
- x: 2007,
- y: 366
- },
- {
- x: 2008,
- y: 337
- },
- {
- x: 2009,
- y: 352
- },
- {
- x: 2010,
- y: 377
- },
- {
- x: 2011,
- y: 383
- },
- {
- x: 2012,
- y: 344
- },
- {
- x: 2013,
- y: 366
- },
- {
- x: 2014,
- y: 389
- },
- {
- x: 2015,
- y: 334
- }
- ]
- }, {
- name: 'south',
- data: [
- {
- x: 1996,
- y: 162
- },
- {
- x: 1997,
- y: 90
- },
- {
- x: 1998,
- y: 50
- },
- {
- x: 1999,
- y: 77
- },
- {
- x: 2000,
- y: 35
- },
- {
- x: 2001,
- y: -45
- },
- {
- x: 2002,
- y: -88
- },
- {
- x: 2003,
- y: -120
- },
- {
- x: 2004,
- y: -156
- },
- {
- x: 2005,
- y: -123
- },
- {
- x: 2006,
- y: -88
- },
- {
- x: 2007,
- y: -66
- },
- {
- x: 2008,
- y: -45
- },
- {
- x: 2009,
- y: -29
- },
- {
- x: 2010,
- y: -45
- },
- {
- x: 2011,
- y: -88
- },
- {
- x: 2012,
- y: -132
- },
- {
- x: 2013,
- y: -146
- },
- {
- x: 2014,
- y: -169
- },
- {
- x: 2015,
- y: -184
- }
- ]
- }],
- options: {
- chart: {
- type: 'area',
- height: 350
- },
- dataLabels: {
- enabled: false
- },
- stroke: {
- curve: 'straight'
- },
-
- title: {
- text: 'Area with Negative Values',
- align: 'left',
- style: {
- fontSize: '14px'
- }
- },
- xaxis: {
- type: 'datetime',
- axisBorder: {
- show: false
- },
- axisTicks: {
- show: false
- }
- },
- yaxis: {
- tickAmount: 4,
- floating: false,
-
- labels: {
- style: {
- colors: '#8e8da4',
- },
- offsetY: -7,
- offsetX: 0,
- },
- axisBorder: {
- show: false,
- },
- axisTicks: {
- show: false
- }
- },
- fill: {
- opacity: 0.5
- },
- tooltip: {
- x: {
- format: "yyyy",
- },
- fixed: {
- enabled: false,
- position: 'topRight'
- }
- },
- grid: {
- yaxis: {
- lines: {
- offsetX: -30
- }
- },
- padding: {
- left: 20
- }
- }
- },
-
-
- };
- }
-
- render() {
- return (
- <div>
- <div id="chart">
- <ReactApexChart options={this.state.options} series={this.state.series} type="area" height={350} />
- </div>
- <div id="html-dist"></div>
- </div>
- );
- }
- }
- const domContainer = document.querySelector('#app');
- ReactDOM.render(React.createElement(ApexChart), domContainer);
- </script>
-
- </body>
- </html>
|