Ok, I can work with that. thanks
Tried a different approach, works great :)
if(charts[key]==undefined){ //create chart.... charts[key]=chart; }else{ chart = charts[key]; chart.options.data[0].dataPoints=points; } chart.render();
Ok, I will try that.
What is consuming memory, the chart objects or something about the canvas?
Br, Daniel
Great, thanks.
Sometimes the forum doesn’t send emails after the replies :/
Hi,
Are you planning to implement this using canvas.toDataURL or using a script in the server?
Br, Daniel Silva
It’s working great, excellent support as always. Thanks
Any news?
Thanks, Daniel
http://jsfiddle.net/dreamfalcon/2jfMe/
It’s working great, many thanks. Unfortunately I had to stop the development of the reports because of another project, but I expect to buy and migrate all charts to CanvasJS in a few weeks.
An alternative for what I need is saving the original object used to create the chart, modify this object, destroy the old chart and creating a new chart with the new object. But that will increase memory in case of dashboards with many charts.
Thanks
Is possible to change the options object by another or I have to change the attributes one by one? Thanks
Hi, In the example I give is working great. Then I tried to send all options by json to PHP, alter the theme, return also by json, change the chart options,render the chart, and the theme is not altered.
JS:
var chart = new CanvasJS.Chart("content", { theme: "theme1", title:{ text: "Changing Theme" }, data: [ { type: "column", dataPoints: [ { x: 10, y: 71 }, { x: 20, y: 55}, { x: 30, y: 50 }, { x: 40, y: 65 }, { x: 50, y: 95 }, { x: 60, y: 68 }, { x: 70, y: 28 }, { x: 80, y: 34 }, { x: 90, y: 14} ] } ] }); chart.render(); var json=JSON.stringify(chart); success = function(jsonObject) { chart.options=JSON.parse(jsonObject.chartOptions); chart.render(); }; jsonRequest(json,success);
PHP:
$s=json_decode ( $_REQUEST['json'] ,true); $s['options']['theme']="theme2"; $response->chartOptions=json_encode ($s);
If we could change any of the options and them call render would be great :)
Its chart.options.theme=”theme2″; Still doesn’t work :/
After a restart is all working great :/ Thanks