How do I 'select' a bar 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 Sudarshan on 26th April 2017
Hi Richard,

I am drawing bar chart if i click on bar it's showing tool tip ,i set stroke fill with black colour it's turned in to black colour.clicked on another bar or clicked on any place in canvas the filled thing is gone away.i need fill the stroke with black colour it should not gone away,It will show diff b/w selected bars and unselected bars how can i solve this issue.

Thank you
Sudarshan
Posted by Richard on 26th April 2017
Hi there,

There's an example here that allows you 'select' bars:

www.rgraph.net/tests/bar-multiple-select.html

It was originally written when there weren't any tooltips configured.






Richard
Posted by Sudarshan on 26th April 2017
it's not showing any bar it's showing empty table plz give me proper link
Posted by Richard on 26th April 2017
Hi there,

Try now. If it still isn't working try viewing it in Chrome.






Richard
Posted by Sudarshan on 26th April 2017
Thank you Richard,


I need like this with small modification for example i am selected three bar i have some content in tooltip how can i get this selected three bar's tooltip data.
Posted by Richard on 26th April 2017
Hi there,

Well in that example you can get the selected bars by looking at the state.selected array:

var selected = state.selected;

And then use that with the bar chart properties:

var tooltips = obj.properties['chart.tooltips'];

for (var i=0; i<selected.length; i++) {
     alert(tooltips[selected[i]]);
}






Richard

Add a reply

 




« Back to message list
RGraph on social media