Pulling JSON file data for Smoothie Charts

144 views
Skip to first unread message

Manaal Siddiqui

unread,
Jul 27, 2018, 7:16:38 PM7/27/18
to Smoothie Charts
I would like to pull JSON data to be displayed in the output of my chart. 

Here's the code I have so far: 

HTML 


<div>
    <canvas id="chart" width="500" height="250"></canvas>
</div>

javascript
var chart = new SmoothieChart({grid:{fillStyle:'#ffffff'},labels:{fillStyle:'#000000'},tooltip:true,timestampFormatter:SmoothieChart.timeFormatter}),


timeSeries = new TimeSeries();
chart.addTimeSeries(timeSeries, { strokeStyle: 'blue', lineWidth: 1 , fillStyle:'rgba(0,128,255,0.30)'});

chart.streamTo(document.getElementById('chart'), 100);

setInterval(function()
{
    timeSeries.append(new Date().getTime(), Math.random()*100);
}, 1000); 

//Math.random()*1000 to be replaced with JSON data

----
I do not know how to output JSON data through Smoothie Charts. I would greatly appreciate it if someone could help guide me. 

Thanks


Reply all
Reply to author
Forward
0 new messages