I have a TChart
as shown below. I'm trying to center the header text, but no success.
chart.getHeader().setAlignment(StringAlignment.CENTER);
That doesn't look centered to me. How do I center it on the surface instead of the left and right axes?
You can always align your title manually. Here you have an example:
tChart1.getAspect().setView3D(false);
Bar bar1 = new Bar(tChart1.getChart());
bar1.fillSampleValues();
tChart1.getPanel().setMarginUnits(PanelMarginUnits.PIXELS);
tChart1.getPanel().setMarginTop(30);
tChart1.getHeader().setCustomPosition(true);
tChart1.getHeader().setTop(7);
int width = tChart1.getGraphics3D().textWidth(tChart1.getHeader().getText());
tChart1.getHeader().setLeft(getWindowManager().getDefaultDisplay().getWidth()/2 - width/2);