You must be logged in to post your query.
Home › Forums › Chart Support › Multiseries (multi-lines) chart from multiples JSON files
Tagged: chart, JSON, multilines, multiple, Multiseries, sources
Hello canvasjs :)
I would like to create chart of two distinct vars (not existing for the moment because i don’t know web scripting) containing thoses informations timestamp,percentchangesincelastday
(for example : 1619827200000,-1.26 or 1635120000000,3.86)
Thoses two vars must be calculated into the code (html page) from multiple (2) JSON source files containing thoses informations for example :
JSON_1 file : {“prices”:[[1619827200000,57828.511814425874],[1619913600000,57812.96915967891],[1620000000000,56600.74528738432]]} JSON_1 file : {“prices”:[[1619827200000,34.53909239],[1619913600000,38.12109239],[1620000000000,45.12109239]]}
I have for the moment, only tried to display the price of each currency (2 currencies so 2 JSON files).
Could you help me ? Iam sure that this topic will help some people ;)
(bellow JSFiddle of myself trying PHP-Javascript code that is not working) https://jsfiddle.net/37yqd45a/
@eioz2,
Creating a multi-series chart with data from 2 JSON files seems to be working fine. You can take a look at this code-snippet for an example where the JSON data is fetched,
$.getJSON("https://canvasjs.com/data/docs/btcusd2018.json", function(data1) { for( var i = 0; i < data1.length; i++) { dataPoints1.push({ x: new Date(data1[i].date), y: data1[i].open }); } chart.render(); }); $.getJSON("https://canvasjs.com/data/docs/btcusd2018.json", function(data2) { for( var i = 0; i < data2.length; i++) { dataPoints2.push({ x: new Date(data2[i].date), y: data2[i].close }); } chart.render(); })
Kindly refer to this updated JSFiddle for an example on the same.
If you are still facing any issues, kindly create a sample project (PHP project) along with a sample JSON reproducing the issue and share it with us over Google-Drive or Onedrive so that we can run it locally to understand the scenario better and help you out.
— Adithya Menon Team CanvasJS
You must be logged in to reply to this topic. Login/Register