By changing few lines of code according to your json format, its possible to render multi-series chart based on the key (label) from JSON. Please check this jsfiddle.
—
Vishwas R
data.sort((a,b)=>a-b);
works on array but not on array of objects. You need to sort it manually to handle it. Please chek out the code-snippet to sort datapoints below.
for (var i = 0; i < dataPoints.length - 1; i++) {
if (dataPoints[i].x > dataPoints[i + 1].x) {
var temp = dataPoints[i];
dataPoints[i] = dataPoints[i + 1];
dataPoints[i + 1] = temp;
i = 0;
}
}
Please check this JSFiddle for complete code.
Also please refer to this documentation page for tutorial on dynamically updating chart from JSON data.
—
Vishwas R
The issue is in updateChart function. It fails to enter for-loop as value of x (var x = i;
) is same as the value of result.length. Read data from database, store it in another variable (lets say result1) and then push that to dataPoints as shown below.
var updateChart = function () {
for(var y=0; y < result1.length; y++){
dataPoints.push({label:result1[y].Date, y:result1[y].Value2});
}
x=y;
chart.render();
};
Please check this updated project
—
Vishwas R
Thanks for the info. It seems to be some CSS issue, we will look into it further. As of now, you can work-around using CSS-display property. Please check this jsfiddle.
—
Vishwas R
We apologies for the deletion of your post. It has happened due to some technical issue and will be restored soon.
We will look into the the project you have shared and get back to you at the earliest.
—
Vishwas R
Sorry for the inconvenience, due to some technical issue it has happened and your post will be restored soon.
We checked with the jsfiddle and observed that pan/reset buttons won’t appear on clicking ‘Scale-Change’ button. Please check this image.
If you are still facing any issue, please reproduce the same in jsfiddle so that we can look into it and help you out.
—
Vishwas R
Unless we look into your code, we can’t predict what went wrong in it. Can you kindly create a sample project and share your code, so that we can look into it and help you out.
—
Vishwas R
We are unable to see pan/reset button being shown on clicking ‘scale’ button.
Please check this.
—
Vishwas R
Sorting data before calling chart.render method in updateECG() will work fine in your case. Kindly refer this page for tutorial on array-sorting in JavaScript.
—
Vishwas R
Kindly download and check ASP.net samples from this link. Refer this section for tutorials on integrating CanvasJS charts to ASP.net MVC application.
—
Vishwas R
Kiran,
This feature is not available as of now. But by splitting it into multi-series, you can achieve the same. Please Please check this jsfiddle.
—
Vishwas R
We checked the click event. In browser it seems to be working fine but not in webview.
Please refer the following links for more info:
http://stackoverflow.com/questions/24085159/webview-not-catching-javascript-touch-events
http://stackoverflow.com/questions/14846071/touch-events-in-android-webview
http://stackoverflow.com/questions/5271898/javascript-alert-not-working-in-android-webview
http://android-er.blogspot.in/2014/05/android-webview-detect-touch-events.html
—
Vishwas R