<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>ZingSoft Demo</title>
<script nonce="undefined" src="https://cdn.zingchart.com/zingchart.min.js"></script>
<style>
.chart--container {
width: 100%;
height: 100%;
min-height: 530px;
}
.zc-ref {
display: none;
}
</style>
</head>
<body>
<button onclick="window.parent.location.reload()">Reload Data</button>
<div id="myChart" class="chart--container">
<a class="zc-ref" href="https://www.zingchart.com/">Powered by ZingChart</a>
</div>
<script>
ZC.LICENSE = ["569d52cefae586f634c54f86dc99e6a9", "b55b025e438fa8a98e32482b5f768ff5"]; // make the AJAX request
let oReq = new XMLHttpRequest();
oReq.addEventListener('load', reqListener);
oReq.open('GET', 'https://cdn.zingchart.com/datasets/remote-config.json');
oReq.send();
let chartConfig = {
type: 'bar',
globals: {
fontColor: '#3F3F3F',
},
title: {
text: 'Chart Hitting Node/express Server',
},
plot: {
tooltip: {
borderRadius: '3px',
fontColor: '#ffffff',
size: '12px',
},
},
scaleX: {
lineWidth: '2px',
},
scaleY: {
lineWidth: '2px',
step: 25,
},
series: [{
values: [],
backgroundColor: '#3E50B4',
}, ],
};
/*
* callback for GET request is when we will render the chart
*/
function reqListener() {
// responseText is an array of Number types
if (this.responseText) {
chartConfig.series[0].values = JSON.parse(this.responseText).series[0].values;
}
zingchart.render({
id: 'myChart',
data: chartConfig,
height: '100%',
width: '100%',
});
}
</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>
<button onclick="window.parent.location.reload()">Reload Data</button>
<div id="myChart" class="chart--container">
<a class="zc-ref" href="https://www.zingchart.com/">Powered by ZingChart</a>
</div>
</body>
</html>
// make the AJAX request
let oReq = new XMLHttpRequest();
oReq.addEventListener('load', reqListener);
oReq.open('GET', 'https://cdn.zingchart.com/datasets/remote-config.json');
oReq.send();
let chartConfig = {
type: 'bar',
globals: {
fontColor: '#3F3F3F',
},
title: {
text: 'Chart Hitting Node/express Server',
},
plot: {
tooltip: {
borderRadius: '3px',
fontColor: '#ffffff',
size: '12px',
},
},
scaleX: {
lineWidth: '2px',
},
scaleY: {
lineWidth: '2px',
step: 25,
},
series: [
{
values: [],
backgroundColor: '#3E50B4',
},
],
};
/*
* callback for GET request is when we will render the chart
*/
function reqListener() {
// responseText is an array of Number types
if (this.responseText) {
chartConfig.series[0].values = JSON.parse(this.responseText).series[0].values;
}
zingchart.render({
id: 'myChart',
data: chartConfig,
height: '100%',
width: '100%',
});
}