- <!DOCTYPE html>
- <html>
-
- <head>
- <meta charset="utf-8">
- <title>ZingGrid: Blank Grid</title>
- <script nonce="undefined" src="https://cdn.zingchart.com/zingchart.min.js"></script>
- <!-- can also render the modules ahead of time here -->
- <!-- <script nonce="undefined" src="https://cdn.zingchart.com/modules/zingchart-zoom-buttons.min.js"></script> -->
- <style>
- html,
- body {
- height: 100%;
- width: 100%;
- margin: 0;
- padding: 0;
- }
-
- #myChart {
- height: 100%;
- width: 100%;
- min-height: 150px;
- }
-
- .zc-ref {
- display: none;
- }
- </style>
- </head>
-
- <body>
- <!-- CHART CONTAINER -->
- <div id="myChart">
- <a class="zc-ref" href="https://www.zingchart.com">Powered by ZingChart</a>
- </div>
-
- <script>
- ZC.LICENSE = ["569d52cefae586f634c54f86dc99e6a9", "b55b025e438fa8a98e32482b5f768ff5"]; // window:load event for Javascript to run after HTML
- // because this Javascript is injected into the document head
- window.addEventListener('load', () => {
- // Javascript code to execute after DOM content
-
- // full ZingChart schema can be found here:
- // https://www.zingchart.com/docs/api/json-configuration/
- let myConfig = {
- globals: {
- fontFamily: 'Lucida Sans Unicode'
- },
- type: 'area',
- plot: {
- mode: 'fast',
- exact: true,
- smartSampling: true,
- hintTs: true,
- maxNodes: 150,
- maxTrackers: 150,
- },
- plotarea: {
- margin: '50 40 40 80'
- },
- preview: {
- borderWidth: 1,
- handle: {
- lineWidth: 0,
- height: 20
- },
- adjustLayout: true
- },
- crosshairX: {},
- scrollX: {},
- scaleX: {
- transform: {
- type: 'date'
- },
- item: {
- fontSize: 10
- },
- zooming: true
- },
- scaleY: {
- autoFit: true,
- minValue: 'auto',
- short: true,
- label: {
- text: 'VOLUMES'
- },
- item: {
- fontSize: 10
- },
- guide: {
- lineStyle: 'solid'
- }
- },
- noData: {
- text: 'No data found',
- backgroundColor: '#efefef'
- },
- // if fetching data remotely define an empty series
- series: [{
- values: []
- }]
- };
-
- // defined ABOVE the render and sets flags
- // globally for ALL charts on a page
- zingchart.DEV.CACHECANVASTEXT = true;
- zingchart.DEV.CHECKDECIMALS = false;
- zingchart.DEV.CACHESELECTION = true;
- zingchart.DEV.MEDIARULES = false;
- // zingchart.DEV.SKIPTRACKERS = true;
-
-
- // ONLY ONCE we have loaded the zoom-button module
- zingchart.loadModules('zoom-buttons', () => {
-
- // render the chart right away
- zingchart.render({
- id: 'myChart',
- data: myConfig,
- height: '100%',
- width: '100%',
- output: 'canvas',
- modules: 'zoom-buttons',
- });
-
- // fetch the data remotely
- fetch('https://cdn.zingchart.com/datasets/timeseries-sample-data.json')
- .then(res => res.json())
- .then(timeseriesData => {
- // assign data to chart
- zingchart.exec('myChart', 'setseriesvalues', {
- plotindex: 0,
- values: timeseriesData.values
- });
- })
- .catch(e => {
- // if error, render blank chart
- console.error('--- error fetching data from: https://cdn.zingchart.com/datasets/timeseries-sample-data.json ---');
- myConfig.title = {};
- myConfig.title.text = 'Error Fetching https://cdn.zingchart.com/datasets/timeseries-sample-data.json';
- // just exec setdata api method since we don't need to render the zoom modules
- // https://www.zingchart.com/docs/api/methods/
- zingchart.exec('myChart', 'setdata', {
- data: myConfig
- });
- });
- });
- });
- </script>
- </body>
-
- </html>
- <!DOCTYPE html>
- <html>
-
- <head>
- <meta charset="utf-8">
- <title>ZingGrid: Blank Grid</title>
- <script src="https://cdn.zingchart.com/zingchart.min.js"></script>
- <!-- can also render the modules ahead of time here -->
- <!-- <script src="https://cdn.zingchart.com/modules/zingchart-zoom-buttons.min.js"></script> -->
- </head>
-
- <body>
- <!-- CHART CONTAINER -->
- <div id="myChart">
- <a class="zc-ref" href="https://www.zingchart.com">Powered by ZingChart</a>
- </div>
-
- </body>
-
- </html>
- html,
- body {
- height: 100%;
- width: 100%;
- margin: 0;
- padding: 0;
- }
-
- #myChart {
- height: 100%;
- width: 100%;
- min-height: 150px;
- }
-
- .zc-ref {
- display: none;
- }
- // window:load event for Javascript to run after HTML
- // because this Javascript is injected into the document head
- window.addEventListener('load', () => {
- // Javascript code to execute after DOM content
-
- // full ZingChart schema can be found here:
- // https://www.zingchart.com/docs/api/json-configuration/
- let myConfig = {
- globals: {
- fontFamily: 'Lucida Sans Unicode'
- },
- type: 'area',
- plot: {
- mode: 'fast',
- exact: true,
- smartSampling: true,
- hintTs: true,
- maxNodes: 150,
- maxTrackers: 150,
- },
- plotarea: {
- margin: '50 40 40 80'
- },
- preview: {
- borderWidth: 1,
- handle: {
- lineWidth: 0,
- height: 20
- },
- adjustLayout: true
- },
- crosshairX: {},
- scrollX: {},
- scaleX: {
- transform: {
- type: 'date'
- },
- item: {
- fontSize: 10
- },
- zooming: true
- },
- scaleY: {
- autoFit: true,
- minValue: 'auto',
- short: true,
- label: {
- text: 'VOLUMES'
- },
- item: {
- fontSize: 10
- },
- guide: {
- lineStyle: 'solid'
- }
- },
- noData: {
- text: 'No data found',
- backgroundColor: '#efefef'
- },
- // if fetching data remotely define an empty series
- series: [{
- values: []
- }]
- };
-
- // defined ABOVE the render and sets flags
- // globally for ALL charts on a page
- zingchart.DEV.CACHECANVASTEXT = true;
- zingchart.DEV.CHECKDECIMALS = false;
- zingchart.DEV.CACHESELECTION = true;
- zingchart.DEV.MEDIARULES = false;
- // zingchart.DEV.SKIPTRACKERS = true;
-
-
- // ONLY ONCE we have loaded the zoom-button module
- zingchart.loadModules('zoom-buttons', () => {
-
- // render the chart right away
- zingchart.render({
- id: 'myChart',
- data: myConfig,
- height: '100%',
- width: '100%',
- output: 'canvas',
- modules: 'zoom-buttons',
- });
-
- // fetch the data remotely
- fetch('https://cdn.zingchart.com/datasets/timeseries-sample-data.json')
- .then(res => res.json())
- .then(timeseriesData => {
- // assign data to chart
- zingchart.exec('myChart', 'setseriesvalues', {
- plotindex: 0,
- values: timeseriesData.values
- });
- })
- .catch(e => {
- // if error, render blank chart
- console.error('--- error fetching data from: https://cdn.zingchart.com/datasets/timeseries-sample-data.json ---');
- myConfig.title = {};
- myConfig.title.text = 'Error Fetching https://cdn.zingchart.com/datasets/timeseries-sample-data.json';
- // just exec setdata api method since we don't need to render the zoom modules
- // https://www.zingchart.com/docs/api/methods/
- zingchart.exec('myChart', 'setdata', {
- data: myConfig
- });
- });
- });
- });