<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>ZingSoft Demo</title> <script src="https://cdn.zingchart.com/zingchart.min.js"></script> <style></style> </head> <body> <div id='myChart'></div> <input data-index='0' type='checkbox' id='pa' checked> <label for='pa'>Dataset 1</label> <input data-index='1' type='checkbox' id='pb' checked> <label for='pa'>Dataset 2</label> <input data-index='2' type='checkbox' id='pc' checked> <label for='pa'>Dataset 3</label> <input data-index='3' type='checkbox' id='pd' checked> <label for='pa'>Dataset 4</label> <script> ZC.LICENSE = ["569d52cefae586f634c54f86dc99e6a9", "b55b025e438fa8a98e32482b5f768ff5"]; var myConfig = { "graphset": [{ "type": "line", "plotarea": { "margin": "dynamic" }, "series": [{ "values": [35, 42, 67, 89, 25, 34, 67, 85], "scales": "scale-x,scale-y", "palette": 0 }, { "values": [135, 142, 167, 189, 125, 134, 167, 185], "scales": "scale-x,scale-y-2", "palette": 1 }, { "values": [535, 542, 767, 789, 625, 934, 267, 485], "scales": "scale-x,scale-y-3", "palette": 2 }, { "values": [2235, 1242, 3467, 8539, 2225, 3134, 6742, 7585], "scales": "scale-x,scale-y-4" } ], "no-data": { "text": "Please Click A Checkbox Below To Load Data" }, "scale-y-2": { }, "scale-y-3": { }, "scale-y-4": { } }], "tween": null }; zingchart.render({ id: 'myChart', data: myConfig, height: 400, width: '100%' }); // get all inputs var inputSelectors = document.querySelectorAll('input'); inputSelectors.forEach(function(input) { input.addEventListener('click', updateChartData); }); function updateChartData(e) { var seriesIndex = this.dataset['index']; zingchart.exec('myChart', 'toggleplot', { plotindex: seriesIndex }); }; </script> </body> </html>
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>ZingSoft Demo</title> <script src="https://cdn.zingchart.com/zingchart.min.js"></script> </head> <body> <div id='myChart'></div> <input data-index='0' type='checkbox' id='pa' checked> <label for='pa'>Dataset 1</label> <input data-index='1' type='checkbox' id='pb' checked> <label for='pa'>Dataset 2</label> <input data-index='2' type='checkbox' id='pc' checked> <label for='pa'>Dataset 3</label> <input data-index='3' type='checkbox' id='pd' checked> <label for='pa'>Dataset 4</label> </body> </html>
var myConfig = { "graphset": [{ "type": "line", "plotarea": { "margin": "dynamic" }, "series": [{ "values": [35, 42, 67, 89, 25, 34, 67, 85], "scales": "scale-x,scale-y", "palette": 0 }, { "values": [135, 142, 167, 189, 125, 134, 167, 185], "scales": "scale-x,scale-y-2", "palette": 1 }, { "values": [535, 542, 767, 789, 625, 934, 267, 485], "scales": "scale-x,scale-y-3", "palette": 2 }, { "values": [2235, 1242, 3467, 8539, 2225, 3134, 6742, 7585], "scales": "scale-x,scale-y-4" } ], "no-data": { "text": "Please Click A Checkbox Below To Load Data" }, "scale-y-2": { }, "scale-y-3": { }, "scale-y-4": { } }], "tween": null }; zingchart.render({ id: 'myChart', data: myConfig, height: 400, width: '100%' }); // get all inputs var inputSelectors = document.querySelectorAll('input'); inputSelectors.forEach(function(input) { input.addEventListener('click', updateChartData); }); function updateChartData(e) { var seriesIndex = this.dataset['index']; zingchart.exec('myChart', 'toggleplot', { plotindex: seriesIndex }); };