-
31 Jul 2012 6:52 PM #1
BarSeries.drawLabels() doesn't account for multiple yFields, throws NPEs
BarSeries.drawLabels() doesn't account for multiple yFields, throws NPEs
I have a BarSeries with 2 yFields and a labelConfig. My store has 9 items, so with two yFields that means there are 18 rects drawn. BarSeries.calculatePaths() has logic that alternates between the two fields for each of the 9 items. BarSeries.drawLabels(), however, does not -- it uses the number of rects to try to get the labels, so it's inaccurate and throws an exception once you exceed the store's bounds.
You should be able to reproduce this by adding a labelConfig to your grouped barchart example.
-
31 Jul 2012 8:44 PM #2
found a workaround
found a workaround
BarSeries should override setLabelText. In the meantime, here's my workaround (the difference is the call to getStoreIndex):
public class MyOtherBarSeries<M> extends BarSeries<M>
{
@Override
protected void setLabelText(Sprite sprite, int index) {
if (sprite instanceof TextSprite) {
TextSprite text = (TextSprite) sprite;
if (labelConfig.getLabelProvider() != null) {
text.setText(labelConfig.getLabelProvider().getLabel(chart.getCurrentStore().get(getStoreIndex(index)),
getValueProvider(index)));
}
}
}
}
-
1 Aug 2012 2:47 PM #3
Thanks for bringing this to my attention. This has now been fixed and will be in the next release.
-
15 Aug 2012 1:24 PM #4
GXT 3.0.1 has been released and contains this fix.
Success! Looks like we've fixed this one. According to our records the fix was applied for
a bug in our system
in
a recent build.


Reply With Quote