How do I find out which bar is being adjusted on a 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 Sta on 8th September 2017
Hi,
Is it possible to know which bar is being adjusting when using adjusting true in a Rgraph Bar

Thanks

Regards
Posted by Richard on 9th September 2017
Hi there,

You could use the onadjust event:

www.rgraph.net/canvas/docs/adjusting-bar.html

So your code might look like this:

new RGraph.Bar({
     id: 'cvs',
     data: [4,8,6,3,5,8,9],
     options: {
         adjustable: true
     }
}).draw().on('onadjust', function (obj)
{
     var shape = RGraph.Registry.get('chart.adjusting.shape');

     alert(shape.index);
});

And the shape.index is the bars number that is being adjusted. The number is zero-indexed.

Richard
Posted by Sta on 9th September 2017
thanks a lot

Add a reply




« Back to message list