My right-aligned legend is always 0 pixels from the right side of my chart. I would like to add a couple of pixels spacing, but can't figure out how. Looking through the source code, it seems no such feature is available.
Any ideas?
Right-aligned legend has no margin
Re: Right-aligned legend has no margin
Hi,
You can add some Horizontal Margin between the legend and the Chart with:
Note if your Legend is TOP/BOTTOM aligned, you'll have to use setVertMargin instead:
You can add some Horizontal Margin between the legend and the Chart with:
Code: Select all
tChart1.getLegend().setHorizMargin(10);
Code: Select all
tChart1.getLegend().setAlignment(LegendAlignment.BOTTOM);
tChart1.getLegend().setVertMargin(10);
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Right-aligned legend has no margin
Thanks. I tried that, but it doesn't work. However, I found a workaround:
_chart.setLegendResolver(new LegendAdapter() {
@Override
public Rectangle getBounds(Legend legend, Rectangle rectangle) {
return new Rectangle(rectangle.x, rectangle.y, rectangle.width - 6, rectangle.height);
};
});
Though, I would still consider this a bug. setHorizMargin has no effect (Android 4.2.2).
_chart.setLegendResolver(new LegendAdapter() {
@Override
public Rectangle getBounds(Legend legend, Rectangle rectangle) {
return new Rectangle(rectangle.x, rectangle.y, rectangle.width - 6, rectangle.height);
};
});
Though, I would still consider this a bug. setHorizMargin has no effect (Android 4.2.2).
Re: Right-aligned legend has no margin
Hello,
It does work for me with the latest TeeChart Java for Android, v3.2012.1120:
Android emulator, v4.2.2
It does work for me with the latest TeeChart Java for Android, v3.2012.1120:
Code: Select all
tChart1.getAspect().setView3D(false);
tChart1.getHeader().setVisible(false);
Line line1 = new Line(tChart1.getChart());
line1.fillSampleValues();
tChart1.getLegend().setHorizMargin(100);
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Right-aligned legend has no margin
That looks like 100 pixels on the left. What about the right side? In my app it touches the border of the entire TChart view.
Re: Right-aligned legend has no margin
Hi,
You can also set some Right Margin like follows:
If you still find any problem with it, please arrange a simple example project we can run as-is to reproduce the problem here.
You can also set some Right Margin like follows:
Code: Select all
tChart1.getPanel().setMarginUnits(PanelMarginUnits.PIXELS);
tChart1.getPanel().setMarginRight(20);
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Right-aligned legend has no margin
setMarginRight did the trick! Thanks!