Axis titles not updating


« Back to message list

Enter your email address to get email updates on this topic. You can stop receiving updates by clicking the link in the update email messages.

Posted by Alex on 21st July 2015
I'm trying to get my chart to update without having to create a new object.

When my page loads, this script is run (more properties are being set, but I removed them for troubleshoot purposes. Still does it with these few):

chart1 = new RGraph.Bar('cvs1', [200]);
chart1.Set('title.xaxis', 'X Axis');
chart1.Set('title.yaxis', 'Y Axis');
chart1.Draw();


When I update the labels, I am setting the new values:
chart1.data = [100];
chart1.Set('title.xaxis', 'X Axis2');
chart1.Set('title.yaxis', 'Y Axis2');
chart1.Draw();

The data (200 to 100) changes properly, but the axis labels do nothing.

I've also tried the canvas/registry during reload by prefixing with

if(chart1!= null){
RGraph.Clear(chart1.canvas);
RGraph.ObjectRegistry.Clear(chart1.canvas);
}

and still no change.

Is it possible to update the axis labels dynamically?
Posted by Richard on 21st July 2015
Hi,

IIRC the background (which also draws the titles) is cached in order to make animations more smoooth - so before the update draw do this:

RG.cache = [];

Richard
Posted by Richard on 21st July 2015
Hi,

Oops, make that this:

RGraph.cache = [];

Richard
Posted by Alex on 21st July 2015
That worked!

Thanks!

Add a reply

 




« Back to message list
RGraph on social media