How to insert gap between legend value and text
-
- Newbie
- Posts: 1
- Joined: Mon Aug 29, 2016 12:00 am
How to insert gap between legend value and text
In the legend (on android), is there a way to add a gap between the value and the text? Manually addind a space as the first character in the text leads to a legend that shows some of its text outside of its boundind box.
Re: How to insert gap between legend value and text
Hello,
You can play with the custom items in a similar way to this (the x and y positions aren't 100% correct):
You can play with the custom items in a similar way to this (the x and y positions aren't 100% correct):
Code: Select all
int tmpX = metrics.widthPixels - 200;
int tmpY = 200;
tChart1.getLegend().getLegendItems().setCustom(true);
tChart1.getLegend().getLegendItems().clear();
for (int i = 0; i<tChart1.getSeries(0).getCount(); i++) {
LegendItem tmpItem = new LegendItem(tChart1.getLegend());
tChart1.getLegend().getLegendItems().setLegendItem(tmpItem);
tmpItem.setFText(String.valueOf(tChart1.getSeries(0).getYValues().getValue(i)));
tmpItem.setFText2(tChart1.getSeries(0).getLabels().getString(i));
tmpItem.setAlign(StringAlignment.CENTER);
tmpItem.setTop(tChart1.getLegend().getTop() + i*20);
tmpItem.setLeft(tmpX);
tmpItem.setSymbolRect(new Rectangle(tmpItem.getLeft() + 2, tmpY + i*20, 20, 20));
}
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |