Index of stacked Bar chart

Share RGraph:   Share or Like RGraph on Facebook!

« 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 Pallavi on 26th June 2013
Hi,

I am getting index of each stack in bar on click event.But
I want to get index of each individual clicked bar in stacked bar chart.How can I get that index?
Posted by RGraph support on 26th June 2013
Hi there,

I think you might need the .index_adjusted property of the shape (that you get back from .getShape() ):

www.rgraph.net/fiddle/view/3d54060b34ebddd225f3e7a2ce3fef10






Richard, RGraph Support
Posted by Pallavi on 26th June 2013
Hi again,

I want index of each bar as like 0,1,2 as like bar example.First whole bar index as 0.Second bar index as 1.I am getting it in bar chart but how to get it in stacked bar chart?
Posted by RGraph support on 26th June 2013
Hi there,

Sorry I can't tell what you're referring to - try illustrating it with an example.




Richard, RGraph Support
Posted by Enter your name... on 26th June 2013
var bar = new RGraph.Bar('cvs', [[2,2,2],[1,2,3],[2,3,4]])
   .Set('noyaxis', true)
   .Set('ylabels', false)
   .Set('gutter.left', 150)
   .Set('grouping', 'stacked')
   .Set('colors', ['red','pink','blue','yellow','#0f0','gray','red','green','black'])
   .Set('colors.sequential', true)
   .Set('labels', ['john','rita','mark']);
   .Draw();

bar.onclick = function (e)
{
     var shape = bar.getShape(e);

     p(shape.index_adjusted);
}


In above example I want index of bar having label 'john' as 0, index of bar having label 'rita' as 1,index of bar having label 'mark' as 2.


Thanks,
pallavi
Posted by RGraph support on 26th June 2013
Hi there,

In that case it's just a matter of dividing the index by 3 like this:

www.rgraph.net/fiddle/view/3d54060b34ebddd225f3e7a2ce3fef10


Richard, RGraph Support

Add a reply




« Back to message list