Home forums Using CanvasJS Cant update Dynamic Chart via AJax JSON for Candle Stick Reply To: Cant update Dynamic Chart via AJax JSON for Candle Stick

#16145

tandemco
Member

I have tried the following strings (returned from ajax call):

[{“x”:0,”y”:[3879.0850, 3875.1865,3875.1860,3875.1865]},{“x”: 1,”y”:[3875.1865, 3879.0850,3879.0800,3879.0850]},{“x”: 2,”y”:[3879.0850, 3882.9883,3882.9881,3882.9883]},{“x”: 3,”y”:[3882.9883, 3883.7885,3883.7883,3883.7885]},{“x”: 4,”y”:[3883.7885, 3884.6880,3878.8861,3884.6880]},{“x”: 5,”y”:[3884.6880, 3881.6886,3880.9860,3881.6886]},{“x”: 6,”y”:[3881.6886, 3880.9860,3880.9860,3880.9860]},{“x”: 7,”y”:[3880.9860, 3881.1866,3878.3853,3881.1866]},{“x”: 8,”y”:[3881.1866, 3879.0869,3879.0863,3879.0869]},{“x”: 9,”y”:[3879.0869, 3880.2850,3878.0851,3880.2850]},{“x”: 10,”y”:[3880.2850, 3878.0851,3877.9851,3878.0851]},{“x”: 11,”y”:[3878.0851, 3877.9851,3877.9853,3877.9851]},{“x”: 12,”y”:[3877.9851, 3882.7873,3882.4878,3882.7873]},{“x”: 13,”y”:[3882.7873, 3883.1879,3883.0877,3883.1879]},{“x”: 14,”y”:[3883.1879, 3883.6876,3882.1863,3883.6876]},{“x”: 15,”y”:[3883.6876, 3882.2879,3882.2860,3882.2879]},{“x”: 16,”y”:[3882.2879, 3885.4881,3884.9871,3885.4881]},{“x”: 17,”y”:[3885.4881, 3886.5889,3886.1881,3886.5889]},{“x”: 18,”y”:[3886.5889, 3886.2882,3886.1886,3886.2882]}]

dps is global
chart is global
—–pasted—-

var dps;
var chart;

function getValuesChart() {

var scriptUrl = “controller.php?route=graph”;
$.ajax({
url: scriptUrl,
type: ‘get’,
dataType: ‘text’,
async: false,
success: function(data) {
dps = data;
}
});

chart.render();
}

nothing is plotted.

  • This reply was modified 2 months, 3 weeks ago by  tandemco.
  • This reply was modified 2 months, 3 weeks ago by  tandemco.