Wow, thanks Vishwas it’s working perfectly.
Thanks for your instant support!
@Vishwas R,
Thanks for an instant reply.
var dataSeries = [];
var chart = new CanvasJS.Chart("chartContainer", {
title: {
text: "MultiSeries Chart from JSON"
},
zoomEnabled: true,
toolTip: {
animationEnabled: true,
shared: true
},
data: dataSeries
});
$.when(
$.getJSON("https://api.myjson.com/bins/k2rm5", function(result) {
for(var i = 0; i < result.length; i++) {
var dps = [];
var label = result[i].label;
var len = Object.keys(result[i]).length - 2;
for(j = 1; j <= len; j++) {
dps.push({x: result[i].id, y: parseInt(result[i].allThreads) });
}
dataSeries.push({name: label, type: "line", dataPoints: dps});
}
})
).then(function() {
chart.render();
});
I changed the code a little bit and it’s close to my idea but when the column “Label” is repeated for example :”Login Page” instead of creating new dataSeries, Can I update new dataPoint for that Label.
Thanks
http://www.upsieutoc.com/image/RmKpdy
Here is the expected result
This is my Json
{“id”:1,”timeStamp”:”2017/02/06 15:15:31.874″,”elapsed”:14033,”label”:”Login page”,”responseCode”:”200″,”responseMessage”:”\”Number of samples in transaction : 99″,”threadName”:” number of failing samples : 0\””,”dataType”:”Thread Group 1-1″,”success”:””,”failureMessage”:”true”,”bytes”:””,”grpThreads”:563060,”allThreads”:16,”latency”:16,”sampleCount”:0,”errorCount”:1,”idleTime”:0,”testId”:9},{“id”:2,”timeStamp”:”2017/02/06 15:15:32.756″,”elapsed”:12968,”label”:”Login page”,”responseCode”:”200″,”responseMessage”:”\”Number of samples in transaction : 99″,”threadName”:” number of failing samples : 0\””,”dataType”:”Thread Group 1-7″,”success”:””,”failureMessage”:”true”,”bytes”:””,”grpThreads”:563060,”allThreads”:18,”latency”:18,”sampleCount”:0,”errorCount”:1,”idleTime”:0,”testId”:9},{“id”:3,”timeStamp”:”2017/02/06 15:15:32.879″,”elapsed”:11066,”label”:”Login page”,”responseCode”:”200″,”responseMessage”:”\”Number of samples in transaction : 99″,”threadName”:” number of failing samples : 0\””,”dataType”:”Thread Group 1-5″,”success”:””,”failureMessage”:”true”,”bytes”:””,”grpThreads”:563060,”allThreads”:18,”latency”:18,”sampleCount”:0,”errorCount”:1,”idleTime”:0,”testId”:9},{“id”:4,”timeStamp”:”2017/02/06 15:15:33.105″,”elapsed”:14727,”label”:”Login page”,”responseCode”:”200″,”responseMessage”:”\”Number of samples in transaction : 99″,”threadName”:” number of failing samples : 0\””,”dataType”:”Thread Group 1-6″,”success”:””,”failureMessage”:”true”,”bytes”:””,”grpThreads”:563060,”allThreads”:18,”latency”:18,”sampleCount”:0,”errorCount”:1,”idleTime”:0,”testId”:9},{“id”:5,”timeStamp”:”2017/02/06 15:15:33.251″,”elapsed”:16803,”label”:”Login page”,”responseCode”:”200″,”responseMessage”:”\”Number of samples in transaction : 99″,”threadName”:” number of failing samples : 0\””,”dataType”:”Thread Group 1-3″,”success”:””,”failureMessage”:”true”,”bytes”:””,”grpThreads”:563060,”allThreads”:18,”latency”:18,”sampleCount”:0,”errorCount”:1,”idleTime”:0,”testId”:9},{“id”:6,”timeStamp”:”2017/02/06 15:15:33.581″,”elapsed”:16842,”label”:”Login page”,”responseCode”:”200″,”responseMessage”:”\”Number of samples in transaction : 99″,”threadName”:” number of failing samples : 0\””,”dataType”:”Thread Group 1-4″,”success”:””,”failureMessage”:”true”,”bytes”:””,”grpThreads”:563060,”allThreads”:18,”latency”:18,”sampleCount”:0,”errorCount”:1,”idleTime”:0,”testId”:9},{“id”:7,”timeStamp”:”2017/02/06 15:15:35.900″,”elapsed”:16127,”label”:”Login page”,”responseCode”:”200″,”responseMessage”:”\”Number of samples in transaction : 99″,”threadName”:” number of failing samples : 0\””,”dataType”:”Thread Group 1-2″,”success”:””,”failureMessage”:”true”,”bytes”:””,”grpThreads”:563060,”allThreads”:19,”latency”:19,”sampleCount”:0,”errorCount”:1,”idleTime”:0,”testId”:9},{“id”:8,”timeStamp”:”2017/02/06 15:15:36.988″,”elapsed”:14377,”label”:”Login page”,”responseCode”:”200″,”responseMessage”:”\”Number of samples in transaction : 99″,”threadName”:” number of failing samples : 0\””,”dataType”:”Thread Group 1-8″,”success”:””,”failureMessage”:”true”,”bytes”:””,”grpThreads”:563060,”allThreads”:20,”latency”:20,”sampleCount”:0,”errorCount”:1,”idleTime”:0,”testId”:9},{“id”:9,”timeStamp”:”2017/02/06 15:15:37.263″,”elapsed”:5379,”label”:”Login to main”,”responseCode”:”200″,”responseMessage”:”\”Number of samples in transaction : 22″,”threadName”:” number of failing samples : 0\””,”dataType”:”Thread Group 1-1″,”success”:””,”failureMessage”:”true”,”bytes”:””,”grpThreads”:66051,”allThreads”:20,”latency”:20,”sampleCount”:0,”errorCount”:1,”idleTime”:0,”testId”:9},{“id”:10,”timeStamp”:”2017/02/06 15:15:37.346″,”elapsed”:82,”label”:”Enter my build”,”responseCode”:”200″,”responseMessage”:”\”Number of samples in transaction : 1″,”threadName”:” number of failing samples : 0\””,”dataType”:”Thread Group 1-1″,”success”:””,”failureMessage”:”true”,”bytes”:””,”grpThreads”:1016,”allThreads”:20,”latency”:20,”sampleCount”:0,”errorCount”:1,”idleTime”:0,”testId”:9},{“id”:11,”timeStamp”:”2017/02/06 15:15:37.423″,”elapsed”:76,”label”:”Filter Not Started Builds”,”responseCode”:”200″,”responseMessage”:”\”Number of samples in transaction : 1″,”threadName”:” number of failing samples : 0\””,”dataType”:”Thread Group 1-1″,”success”:””,”failureMessage”:”true”,”bytes”:””,”grpThreads”:1016,”allThreads”:20,”latency”:20,”sampleCount”:0,”errorCount”:1,”idleTime”:0,”testId”:9},{“id”:12,”timeStamp”:”2017/02/06 15:15:37.836″,”elapsed”:410,”label”:”Click on one favorite”,”responseCode”:”200″,”responseMessage”:”\”Number of samples in transaction : 3″,”threadName”:” number of failing samples : 0\””,”dataType”:”Thread Group 1-1″,”success”:””,”failureMessage”:”true”,”bytes”:””,”grpThreads”:6132,”allThreads”:20,”latency”:20,”sampleCount”:0,”errorCount”:1,”idleTime”:0,”testId”:9},{“id”:13,”timeStamp”:”2017/02/06 15:15:38.009″,”elapsed”:9770,”label”:”Login page”,”responseCode”:”200″,”responseMessage”:”\”Number of samples in transaction : 99″,”threadName”:” number of failing samples : 0\””,”dataType”:”Thread Group 1-13″,”success”:””,”failureMessage”:”true”,”bytes”:””,”grpThreads”:563060,”allThreads”:20,”latency”:20,”sampleCount”:0,”errorCount”:1,”idleTime”:0,”testId”:9},{“id”:14,”timeStamp”:”2017/02/06 15:15:38.549″,”elapsed”:12220,”label”:”Login page”,”responseCode”:”200″,”responseMessage”:”\”Number of samples in transaction : 99″,”threadName”:” number of failing samples : 0\””,”dataType”:”Thread Group 1-12″,”success”:””,”failureMessage”:”true”,”bytes”:””,”grpThreads”:563060,”allThreads”:20,”latency”:20,”sampleCount”:0,”errorCount”:1,”idleTime”:0,”testId”:9},{“id”:15,”timeStamp”:”2017/02/06 15:15:38.639″,”elapsed”:5874,”label”:”Login to main”,”responseCode”:”200″,”responseMessage”:”\”Number of samples in transaction : 22″,”threadName”:” number of failing samples : 0\””,”dataType”:”Thread Group 1-7″,”success”:””,”failureMessage”:”true”,”bytes”:””,”grpThreads”:66088,”allThreads”:21,”latency”:21,”sampleCount”:0,”errorCount”:1,”idleTime”:0,”testId”:9},{“id”:16,”timeStamp”:”2017/02/06 15:15:38.674″,”elapsed”:5414,”label”:”Login to Main”,”responseCode”:”200″,”responseMessage”:”\”Number of samples in transaction : 22″,”threadName”:” number of failing samples : 0\””,”dataType”:”Thread Group 1-3″,”success”:””,”failureMessage”:”true”,”bytes”:””,”grpThreads”:66079,”allThreads”:21,”latency”:21,”sampleCount”:0,”errorCount”:1,”idleTime”:0,”testId”:9},{“id”:17,”timeStamp”:”2017/02/06 15:15:38.709″,”elapsed”:5121,”label”:”Login to main”,”responseCode”:”200″,”responseMessage”:”\”Number of samples in transaction : 22″,”threadName”:” number of failing samples : 0\””,”dataType”:”Thread Group 1-4″,”success”:””,”failureMessage”:”true”,”bytes”:””,”grpThreads”:66082,”allThreads”:21,”latency”:21,”sampleCount”:0,”errorCount”:1,”idleTime”:0,”testId”:9},{“id”:18,”timeStamp”:”2017/02/06 15:15:38.716″,”elapsed”:76,”label”:”Enter my build”,”responseCode”:”200″,”responseMessage”:”\”Number of samples in transaction : 1″,”threadName”:” number of failing samples : 0\””,”dataType”:”Thread Group 1-7″,”success”:””,”failureMessage”:”true”,”bytes”:””,”grpThreads”:1016,”allThreads”:21,”latency”:21,”sampleCount”:0,”errorCount”:1,”idleTime”:0,”testId”:9},{“id”:19,”timeStamp”:”2017/02/06 15:15:38.724″,”elapsed”:5839,”label”:”Login to main”,”responseCode”:”200″,”responseMessage”:”\”Number of samples in transaction : 22″,”threadName”:” number of failing samples : 0\””,”dataType”:”Thread Group 1-5″,”success”:””,”failureMessage”:”true”,”bytes”:””,”grpThreads”:66067,”allThreads”:21,”latency”:21,”sampleCount”:0,”errorCount”:1,”idleTime”:0,”testId”:9},{“id”:20,”timeStamp”:”2017/02/06 15:15:38.750″,”elapsed”:76,”label”:”Enter my build”,”responseCode”:”200″,”responseMessage”:”\”Number of samples in transaction : 1″,”threadName”:” number of failing samples : 0\””,”dataType”:”Thread Group 1-3″,”success”:””,”failureMessage”:”true”,”bytes”:””,”grpThreads”:1016,”allThreads”:21,”latency”:21,”sampleCount”:0,”errorCount”:1,”idleTime”:0,”testId”:9},{“id”:21,”timeStamp”:”2017/02/06 15:15:38.757″,”elapsed”:11249,”label”:”Login page”,”responseCode”:”200″,”responseMessage”:”\”Number of samples in transaction : 99″,”threadName”:” number of failing samples : 0\””,”dataType”:”Thread Group 1-9″,”success”:””,”failureMessage”:”true”,”bytes”:””,”grpThreads”:563060,”allThreads”:21,”latency”:21,”sampleCount”:0,”errorCount”:1,”idleTime”:0,”testId”:9},{“id”:22,”timeStamp”:”2017/02/06 15:15:38.786″,”elapsed”:76,”label”:”Enter my build”,”responseCode”:”200″,”responseMessage”:”\”Number of samples in transaction : 1″,”threadName”:” number of failing samples : 0\””,”dataType”:”Thread Group 1-4″,”success”:””,”failureMessage”:”true”,”bytes”:””,”grpThreads”:1016,”allThreads”:22,”latency”:22,”sampleCount”:0,”errorCount”:1,”idleTime”:0,”testId”:9},{“id”:23,”timeStamp”:”2017/02/06 15:15:38.792″,”elapsed”:76,”label”:”Filter Not Started Builds”,”responseCode”:”200″,”responseMessage”:”\”Number of samples in transaction : 1″,”threadName”:” number of failing samples : 0\””,”dataType”:”Thread Group 1-7″,”success”:””,”failureMessage”:”true”,”bytes”:””,”grpThreads”:1016,”allThreads”:22,”latency”:22,”sampleCount”:0,”errorCount”:1,”idleTime”:0,”testId”:9},{“id”:24,”timeStamp”:”2017/02/06 15:15:38.800″,”elapsed”:76,”label”:”Enter my build”,”responseCode”:”200″,”responseMessage”:”\”Number of samples in transaction : 1″,”threadName”:” number of failing samples : 0\””,”dataType”:”Thread Group 1-5″,”success”:””,”failureMessage”:”true”,”bytes”:””,”grpThreads”:1016,”allThreads”:22,”latency”:22,”sampleCount”:0,”errorCount”:1,”idleTime”:0,”testId”:9},{“id”:25,”timeStamp”:”2017/02/06 15:15:38.827″,”elapsed”:76,”label”:”Filter Not Started Builds”,”responseCode”:”200″,”responseMessage”:”\”Number of samples in transaction : 1″,”threadName”:” number of failing samples : 0\””,”dataType”:”Thread Group 1-3″,”success”:””,”failureMessage”:”true”,”bytes”:””,”grpThreads”:1016,”allThreads”:22,”latency”:22,”sampleCount”:0,”errorCount”:1,”idleTime”:0,”testId”:9},{“id”:26,”timeStamp”:”2017/02/06 15:15:38.863″,”elapsed”:76,”label”:”Filter Not Started Builds”,”responseCode”:”200″,”responseMessage”:”\”Number of samples in transaction : 1″,”threadName”:” number of failing samples : 0\””,”dataType”:”Thread Group 1-4″,”success”:””,”failureMessage”:”true”,”bytes”:””,”grpThreads”:1016,”allThreads”:22,”latency”:22,”sampleCount”:0,”errorCount”:1,”idleTime”:0,”testId”:9},{“id”:27,”timeStamp”:”2017/02/06 15:15:38.878″,”elapsed”:77,”label”:”Filter Not Started Builds”,”responseCode”:”200″,”responseMessage”:”\”Number of samples in transaction : 1″,”threadName”:” number of failing samples : 0\””,”dataType”:”Thread Group 1-5″,”success”:””,”failureMessage”:”true”,”bytes”:””,”grpThreads”:1016,”allThreads”:22,”latency”:22,”sampleCount”:0,”errorCount”:1,”idleTime”:0,”testId”:9},{“id”:28,”timeStamp”:”2017/02/06 15:15:38.989″,”elapsed”:1151,”label”:”Enter details build”,”responseCode”:”200″,”responseMessage”:”\”Number of samples in transaction : 15″,”threadName”:” number of failing samples : 0\””,”dataType”:”Thread Group 1-1″,”success”:””,”failureMessage”:”true”,”bytes”:””,”grpThreads”:11432,”allThreads”:22,”latency”:22,”sampleCount”:0,”errorCount”:1,”idleTime”:0,”testId”:9},{“id”:29,”timeStamp”:”2017/02/06 15:15:39.064″,”elapsed”:270,”label”:”Click on one favorite”,”responseCode”:”200″,”responseMessage”:”\”Number of samples in transaction : 3″,”threadName”:” number of failing samples : 0\””,”dataType”:”Thread Group 1-7″,”success”:””,”failureMessage”:”true”,”bytes”:””,”grpThreads”:6128,”allThreads”:22,”latency”:22,”sampleCount”:0,”errorCount”:1,”idleTime”:0,”testId”:9},{“id”:30,”timeStamp”:”2017/02/06 15:15:39.070″,”elapsed”:241,”label”:”Click on one favorite”,”responseCode”:”200″,”responseMessage”:”\”Number of samples in transaction : 3″,”threadName”:” number of failing samples : 0\””,”dataType”:”Thread Group 1-3″,”success”:””,”failureMessage”:”true”,”bytes”:””,”grpThreads”:6128,”allThreads”:22,”latency”:22,”sampleCount”:0,”errorCount”:1,”idleTime”:0,”testId”:9},{“id”:31,”timeStamp”:”2017/02/06 15:15:39.100″,”elapsed”:236,”label”:”Click on one favorite”,”responseCode”:”200″,”responseMessage”:”\”Number of samples in transaction : 3″,”threadName”:” number of failing samples : 0\””,”dataType”:”Thread Group 1-4″,”success”:””,”failureMessage”:”true”,”bytes”:””,”grpThreads”:6131,”allThreads”:22,”latency”:22,”sampleCount”:0,”errorCount”:1,”idleTime”:0,”testId”:9},{“id”:32,”timeStamp”:”2017/02/06 15:15:39.113″,”elapsed”:234,”label”:”Click on one favorite”,”responseCode”:”200″,”responseMessage”:”\”Number of samples in transaction : 3″,”threadName”:” number of failing samples : 0\””,”dataType”:”Thread Group 1-5″,”success”:””,”failureMessage”:”true”,”bytes”:””,”grpThreads”:6132,”allThreads”:22,”latency”:22,”sampleCount”:0,”errorCount”:1,”idleTime”:0,”testId”:9},{“id”:33,”timeStamp”:”2017/02/06 15:15:39.128″,”elapsed”:6006,”label”:”Login to main”,”responseCode”:”200″,”responseMessage”:”\”Number of samples in transaction : 22″,”threadName”:” number of failing samples : 0\””,”dataType”:”Thread Group 1-6″,”success”:””,”failureMessage”:”true”,”bytes”:””,”grpThreads”:66074,”allThreads”:22,”latency”:22,”sampleCount”:0,”errorCount”:1,”idleTime”:0,”testId”:9},{“id”:34,”timeStamp”:”2017/02/06 15:15:39.211″,”elapsed”:83,”label”:”Enter my build”,”responseCode”:”200″,”responseMessage”:”\”Number of samples in transaction : 1″,”threadName”:” number of failing samples : 0\””,”dataType”:”Thread Group 1-6″,”success”:””,”failureMessage”:”true”,”bytes”:””,”grpThreads”:1016,”allThreads”:22,”latency”:22,”sampleCount”:0,”errorCount”:1,”idleTime”:0,”testId”:9},{“id”:35,”timeStamp”:”2017/02/06 15:15:39.290″,”elapsed”:79,”label”:”Filter Not Started Builds”,”responseCode”:”200″,”responseMessage”:”\”Number of samples in transaction : 1″,”threadName”:” number of failing samples : 0\””,”dataType”:”Thread Group 1-6″,”success”:””,”failureMessage”:”true”,”bytes”:””,”grpThreads”:1016,”allThreads”:22,”latency”:22,”sampleCount”:0,”errorCount”:1,”idleTime”:0,”testId”:9},{“id”:36,”timeStamp”:”2017/02/06 15:15:39.529″,”elapsed”:238,”label”:”Click on one favorite”,”responseCode”:”200″,”responseMessage”:”\”Number of samples in transaction : 3″,”threadName”:” number of failing samples : 0\””,”dataType”:”Thread Group 1-6″,”success”:””,”failureMessage”:”true”,”bytes”:””,”grpThreads”:6120,”allThreads”:22,”latency”:22,”sampleCount”:0,”errorCount”:1,”idleTime”:0,”testId”:9}