How can I visualize information in a stacked Bar chart?


« 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 Antonio Vianello on 5th September 2013
Hi there!

Is it possible, clicking on a single token of a bar in a stacked bar chart to visualize (i.e. in a popup window) the single values that compose that bar?

Thanks in advance
Posted by RGraph support on 5th September 2013
Hi there,

It's feasible yes. You'd need to use the coords to position a drawing API rect object on the canvas (so that it covers the whole bar) Then you can use the rect objects onclick event to trigger the popup.

The coords are held in myBar.coords (though myBar.coords2 may be easier to work with) and when you've created and positioned the rect object you can add an onclick listener like this:

rect.onclick = function (e, obj)
{
     // Open popup here
}


Richard, RGraph Support
Posted by RGraph support on 6th September 2013
Hi there,

From the next release there'll be a new example that demonstrates how you can go about doing this (albeit using tooltips instead of a popup - though if you wanted a popup you could change it to that by using the rect objects onclick event):

www.rgraph.net/demos/bar-stacked-click.html

(it's not there at the moment)


Richard, RGraph Support

Add a reply




« Back to message list