123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707 |
- <!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>Sparklines</title>
- <link href="../../assets/styles.css" rel="stylesheet" />
- <style>
-
- .row {
- overflow: hidden;
- max-width: 890px;
- margin: 30px auto;
- display: flex;
- }
-
- .col-md-4 {
- width: 33.33%;
- padding: 0 25px;
- }
-
- table {
- width: 100%;
- }
-
- tbody tr {
- border-top: 1px solid #e7e7e7;
- }
-
- th {
- font-weight: bold;
- font-family: Helvetica;
- padding-bottom: 20px;
- }
- td, th {
- width: 25%;
- text-align: center;
- height: 65px;
- }
-
- td div {
- margin: 0 auto;
- }
-
- .left {
- float: left;
- }
-
- .right {
- float: right;
- }
-
- @media only screen and (max-width: 480px) {
- th:first-child, td:first-child {
- display: none;
- }
- .row {
- display: block;
- }
- .col-md-4 {
- padding: 0;
- width: 100%;
- }
- }
-
- </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>
-
- <script>
- window.Apex = {
- stroke: {
- width: 3
- },
- markers: {
- size: 0
- },
- tooltip: {
- fixed: {
- enabled: true,
- }
- }
- };
-
- var randomizeArray = function (arg) {
- var array = arg.slice();
- var currentIndex = array.length,
- temporaryValue, randomIndex;
-
- while (0 !== currentIndex) {
-
- randomIndex = Math.floor(Math.random() * currentIndex);
- currentIndex -= 1;
-
- temporaryValue = array[currentIndex];
- array[currentIndex] = array[randomIndex];
- array[randomIndex] = temporaryValue;
- }
-
- return array;
- }
-
- // data for the sparklines that appear below header area
- var sparklineData = [47, 45, 54, 38, 56, 24, 65, 31, 37, 39, 62, 51, 35, 41, 35, 27, 93, 53, 61, 27, 54, 43, 19, 46];
- </script>
- </head>
- <body>
-
- <div id="app"></div>
- <div id="html">
- <div>
- <div class="row">
- <div class="col-md-4">
- <div id="chart-spark1">
- <ReactApexChart options={this.state.options} series={this.state.series} type="area" height={160} />
- </div>
- </div>
- <div class="col-md-4">
- <div id="chart-spark2">
- <ReactApexChart options={this.state.optionsSpark2} series={this.state.seriesSpark2} type="area" height={160} />
- </div>
- </div>
- <div class="col-md-4">
- <div id="chart-spark3">
- <ReactApexChart options={this.state.optionsSpark3} series={this.state.seriesSpark3} type="area" height={160} />
- </div>
- </div>
- </div>
- <div class="row">
- <table>
- <thead>
- <th>Total Value</th>
- <th>Percentage of Portfolio</th>
- <th>Last 10 days</th>
- <th>Volume</th>
- </thead>
- <tbody>
- <tr>
- <td>$32,554</td>
- <td>15%</td>
- <td>
- <div id="chart-1">
- <ReactApexChart options={this.state.options1} series={this.state.series1} type="line" height={35} width={100} />
- </div>
- </td>
- <td>
- <div id="chart-5">
- <ReactApexChart options={this.state.options5} series={this.state.series5} type="bar" height={35} width={100} />
- </div>
- </td>
- </tr>
- <tr>
- <td>$23,533</td>
- <td>7%</td>
- <td>
- <div id="chart-2">
- <ReactApexChart options={this.state.options2} series={this.state.series2} type="line" height={35} width={100} />
- </div>
- </td>
- <td>
- <div id="chart-6">
- <ReactApexChart options={this.state.options6} series={this.state.series6} type="bar" height={35} width={100} />
- </div>
- </td>
- </tr>
- <tr>
- <td>$54,276</td>
- <td>9%</td>
- <td>
- <div id="chart-3">
- <ReactApexChart options={this.state.options3} series={this.state.series3} type="pie" height={40} width={40} />
- </div>
- </td>
- <td>
- <div id="chart-7">
- <ReactApexChart options={this.state.options7} series={this.state.series7} type="radialBar" height={50} width={50} />
- </div>
- </td>
- </tr>
- <tr>
- <td>$11,533</td>
- <td>2%</td>
- <td>
- <div id="chart-4">
- <ReactApexChart options={this.state.options4} series={this.state.series4} type="donut" height={40} width={40} />
- </div>
- </td>
- <td>
- <div id="chart-8">
- <ReactApexChart options={this.state.options8} series={this.state.series8} type="radialBar" height={40} width={40} />
- </div>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- </div>
- <script type="text/babel">
- class ApexChart extends React.Component {
- constructor(props) {
- super(props);
- this.state = {
-
- series: [{
- data: randomizeArray(sparklineData)
- }],
- options: {
- chart: {
- type: 'area',
- height: 160,
- sparkline: {
- enabled: true
- },
- },
- stroke: {
- curve: 'straight'
- },
- fill: {
- opacity: 0.3,
- },
- yaxis: {
- min: 0
- },
- colors: ['#DCE6EC'],
- title: {
- text: '$424,652',
- offsetX: 0,
- style: {
- fontSize: '24px',
- }
- },
- subtitle: {
- text: 'Sales',
- offsetX: 0,
- style: {
- fontSize: '14px',
- }
- }
- },
-
- seriesSpark2: [{
- data: randomizeArray(sparklineData)
- }],
- optionsSpark2: {
- chart: {
- type: 'area',
- height: 160,
- sparkline: {
- enabled: true
- },
- },
- stroke: {
- curve: 'straight'
- },
- fill: {
- opacity: 0.3,
- },
- yaxis: {
- min: 0
- },
- colors: ['#DCE6EC'],
- title: {
- text: '$235,312',
- offsetX: 0,
- style: {
- fontSize: '24px',
- }
- },
- subtitle: {
- text: 'Expenses',
- offsetX: 0,
- style: {
- fontSize: '14px',
- }
- }
- },
-
- seriesSpark3: [{
- data: randomizeArray(sparklineData)
- }],
- optionsSpark3: {
- chart: {
- type: 'area',
- height: 160,
- sparkline: {
- enabled: true
- },
- },
- stroke: {
- curve: 'straight'
- },
- fill: {
- opacity: 0.3
- },
- xaxis: {
- crosshairs: {
- width: 1
- },
- },
- yaxis: {
- min: 0
- },
- title: {
- text: '$135,965',
- offsetX: 0,
- style: {
- fontSize: '24px',
- }
- },
- subtitle: {
- text: 'Profits',
- offsetX: 0,
- style: {
- fontSize: '14px',
- }
- }
- },
-
- series1: [{
- data: [25, 66, 41, 89, 63, 25, 44, 12, 36, 9, 54]
- }],
- options1: {
- chart: {
- type: 'line',
- width: 100,
- height: 35,
- sparkline: {
- enabled: true
- }
- },
- tooltip: {
- fixed: {
- enabled: false
- },
- x: {
- show: false
- },
- y: {
- title: {
- formatter: function (seriesName) {
- return ''
- }
- }
- },
- marker: {
- show: false
- }
- }
- },
-
- series2: [{
- data: [12, 14, 2, 47, 42, 15, 47, 75, 65, 19, 14]
- }],
- options2: {
- chart: {
- type: 'line',
- width: 100,
- height: 35,
- sparkline: {
- enabled: true
- }
- },
- tooltip: {
- fixed: {
- enabled: false
- },
- x: {
- show: false
- },
- y: {
- title: {
- formatter: function (seriesName) {
- return ''
- }
- }
- },
- marker: {
- show: false
- }
- }
- },
-
- series3: [43, 32, 12, 9],
- options3: {
- chart: {
- type: 'pie',
- width: 40,
- height: 40,
- sparkline: {
- enabled: true
- }
- },
- stroke: {
- width: 1
- },
- tooltip: {
- fixed: {
- enabled: false
- },
- }
- },
-
- series4: [43, 32, 12, 9],
- options4: {
- chart: {
- type: 'donut',
- width: 40,
- height: 40,
- sparkline: {
- enabled: true
- }
- },
- stroke: {
- width: 1
- },
- tooltip: {
- fixed: {
- enabled: false
- },
- }
- },
-
- series5: [{
- data: [25, 66, 41, 89, 63, 25, 44, 12, 36, 9, 54]
- }],
- options5: {
- chart: {
- type: 'bar',
- width: 100,
- height: 35,
- sparkline: {
- enabled: true
- }
- },
- plotOptions: {
- bar: {
- columnWidth: '80%'
- }
- },
- labels: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11],
- xaxis: {
- crosshairs: {
- width: 1
- },
- },
- tooltip: {
- fixed: {
- enabled: false
- },
- x: {
- show: false
- },
- y: {
- title: {
- formatter: function (seriesName) {
- return ''
- }
- }
- },
- marker: {
- show: false
- }
- }
- },
-
- series6: [{
- data: [12, 14, 2, 47, 42, 15, 47, 75, 65, 19, 14]
- }],
- options6: {
- chart: {
- type: 'bar',
- width: 100,
- height: 35,
- sparkline: {
- enabled: true
- }
- },
- plotOptions: {
- bar: {
- columnWidth: '80%'
- }
- },
- labels: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11],
- xaxis: {
- crosshairs: {
- width: 1
- },
- },
- tooltip: {
- fixed: {
- enabled: false
- },
- x: {
- show: false
- },
- y: {
- title: {
- formatter: function (seriesName) {
- return ''
- }
- }
- },
- marker: {
- show: false
- }
- }
- },
-
- series7: [45],
- options7: {
- chart: {
- type: 'radialBar',
- width: 50,
- height: 50,
- sparkline: {
- enabled: true
- }
- },
- dataLabels: {
- enabled: false
- },
- plotOptions: {
- radialBar: {
- hollow: {
- margin: 0,
- size: '50%'
- },
- track: {
- margin: 0
- },
- dataLabels: {
- show: false
- }
- }
- }
- },
-
- series8: [53, 67],
- options8: {
- chart: {
- type: 'radialBar',
- width: 40,
- height: 40,
- sparkline: {
- enabled: true
- }
- },
- dataLabels: {
- enabled: false
- },
- plotOptions: {
- radialBar: {
- hollow: {
- margin: 0,
- size: '50%'
- },
- track: {
- margin: 1
- },
- dataLabels: {
- show: false
- }
- }
- }
- },
-
-
- };
- }
-
- render() {
- return (
- <div>
- <div>
- <div class="row">
- <div class="col-md-4">
- <div id="chart-spark1">
- <ReactApexChart options={this.state.options} series={this.state.series} type="area" height={160} />
- </div>
- </div>
- <div class="col-md-4">
- <div id="chart-spark2">
- <ReactApexChart options={this.state.optionsSpark2} series={this.state.seriesSpark2} type="area" height={160} />
- </div>
- </div>
- <div class="col-md-4">
- <div id="chart-spark3">
- <ReactApexChart options={this.state.optionsSpark3} series={this.state.seriesSpark3} type="area" height={160} />
- </div>
- </div>
- </div>
-
- <div class="row">
- <table>
- <thead>
- <th>Total Value</th>
- <th>Percentage of Portfolio</th>
- <th>Last 10 days</th>
- <th>Volume</th>
- </thead>
- <tbody>
- <tr>
- <td>$32,554</td>
- <td>15%</td>
- <td>
- <div id="chart-1">
- <ReactApexChart options={this.state.options1} series={this.state.series1} type="line" height={35} width={100} />
- </div>
- </td>
- <td>
- <div id="chart-5">
- <ReactApexChart options={this.state.options5} series={this.state.series5} type="bar" height={35} width={100} />
- </div>
- </td>
- </tr>
- <tr>
- <td>$23,533</td>
- <td>7%</td>
- <td>
- <div id="chart-2">
- <ReactApexChart options={this.state.options2} series={this.state.series2} type="line" height={35} width={100} />
- </div>
- </td>
- <td>
- <div id="chart-6">
- <ReactApexChart options={this.state.options6} series={this.state.series6} type="bar" height={35} width={100} />
- </div>
- </td>
- </tr>
- <tr>
- <td>$54,276</td>
- <td>9%</td>
- <td>
- <div id="chart-3">
- <ReactApexChart options={this.state.options3} series={this.state.series3} type="pie" height={40} width={40} />
- </div>
- </td>
- <td>
- <div id="chart-7">
- <ReactApexChart options={this.state.options7} series={this.state.series7} type="radialBar" height={50} width={50} />
- </div>
- </td>
- </tr>
- <tr>
- <td>$11,533</td>
- <td>2%</td>
- <td>
- <div id="chart-4">
- <ReactApexChart options={this.state.options4} series={this.state.series4} type="donut" height={40} width={40} />
- </div>
- </td>
- <td>
- <div id="chart-8">
- <ReactApexChart options={this.state.options8} series={this.state.series8} type="radialBar" height={40} width={40} />
- </div>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- <div id="html-dist"></div>
- </div>
- );
- }
- }
- const domContainer = document.querySelector('#app');
- ReactDOM.render(React.createElement(ApexChart), domContainer);
- </script>
-
- </body>
- </html>
|