I have a web page with 3 rgraph dynamically updated Line charts. I use ajax call for retrieving data from web service. When ajax call completed with error I want to change the chart background color to 'gray'. And when call is successful to change this color to 'black'.
How to change chart background color dynamically?
I use this code
if(error_occured)
obj_Memory.Set('background.color', '#B6B6B4');
else
obj_Memory.Set('background.color', 'black');
But it does not change the color.
I modified rgraph sample:
http://www.rgraph.net/demos/line-dynamic-updates.html
Added button and simple function:
var error_occured = false;
document.getElementById("toggleButton1").onclick = function (e) {
if (error_occured)
obj.Set('background.color', '#B6B6B4');
else
obj.Set('background.color', 'black');
RG.redraw();
error_occured = !error_occured;
}
It does not change the chart background
There is modified file from RGraph examples. It must be copied to \demo folder.
What interesting: the call of
obj.Set('background.color', 'gray');
inside of drawGraph - works fine(!) But outside does not work.