You must be logged in to post your query.
Home › Forums › Chart Support › Need help with JSON
http://www.fyrobe-club-sisseln.ch/labor2/parse_text_files_retentions.php
The JSON above shall be convertet into a CanvasJS graph, i already tried the following:
$.getJSON( 'parse_text_files_retentions.php', function( data ){ var chart = new CanvasJS.Chart("chartContainer", { title :{ text: "Retention" }, axisX: { title: "Retention time" }, axisY: { title: "Peak signal" }, zoomEnabled: true, panEnabled: true, data: data }); chart.render(); });
and
$.getJSON( 'parse_text_files_retentions.php', function( data ){ var chart = new CanvasJS.Chart("chartContainer", { title :{ text: "Retention" }, axisX: { title: "Retention time" }, axisY: { title: "Peak signal" }, zoomEnabled: true, panEnabled: true }); for( x=0, y=data.length; x<y; x++ ){ //Iterate Files chart.options.data[y].type = 'column'; for( i=0, j=data[y].dataPoints.length; i<j; i++ ){ chart.options.data[y].dataPoints.push( { x : data[y].dataPoints[i].x, y : data[y].dataPoints[i].y }); } } chart.render(); });
Both doesn’t work (obviously). I get a blank graph with only the correct axes and title. Where am I wrong with including the data points?
Thank you very much in advance
problem solved, the values in the JSON were quotet with “”. Parsing the values with (float) helped :)
How can I add a click-function to a graph after the graph is created?
You must be logged in to reply to this topic. Login/Register