Page 1 of 1
Custom Axes
Posted: Mon Jun 20, 2011 7:48 pm
by 15355183
I have 3 Custom Axes.
Custom Axes 1 Relative Position: 0
Custom Axes 2 Relative Position: 5
Custom Axes 3 Relative Position: 10
When I enable the Custom Axes 3 Grid Line, the Grid Line starts from Position 0, but I want it to start at Position 10 so that it starts where the Custom Axes 3 is located. Same goes for Custom Axes 2 - starts at Position 0, instead of 5.
How do I change the Grid Line starting position?
Re: Custom Axes
Posted: Tue Jun 21, 2011 11:47 am
by yeray
Hello Turc,
I'm afraid the Start and End positions of the axes grids aren't configurable. I've added it to the wish list to be implemented in future releases (TJ71015623).
In the meanwhile, you should draw the grids manually as in the following example:
Code: Select all
private void initChart() throws InstantiationException, IllegalAccessException {
commander1.setChart(tChart1.getChart());
tChart1.getAspect().setView3D(false);
tChart1.getLegend().setVisible(false);
tChart1.getPanel().setMarginLeft(5);
com.steema.teechart.styles.Line l = new com.steema.teechart.styles.Line(tChart1.getChart());
l.fillSampleValues();
com.steema.teechart.axis.Axis a = new com.steema.teechart.axis.Axis();
tChart1.getAxes().getCustom().add(a);
l.setCustomVertAxis(a);
a.setRelativePosition(20);
a.getGrid().setVisible(false);
tChart1.addChartPaintListener(new ChartPaintListener() {
@Override
public void axesPainting(ChartDrawEvent e) {}
@Override
public void chartPainted(ChartDrawEvent e) {
com.steema.teechart.axis.Axis axis = tChart1.getAxes().getCustom().getAxis(0);
tChart1.getGraphics3D().getPen().setColor(axis.getGrid().getColor());
double tmpIncr = axis.getCalcIncrement();
double tmpValue = axis.getMaximum() / tmpIncr;
tmpValue = tmpIncr * (int) (tmpValue);
double tmp = (axis.getMinimum() - axis.getMinAxisIncrement()) / (1.0 + axis.getMinAxisIncrement());
while (tmpValue >= tmp) {
int ypos = axis.calcPosValue(tmpValue);
tChart1.getGraphics3D().line(axis.getPosition(), ypos, tChart1.getAxes().getBottom().iEndPos, ypos);
tmpValue -= tmpIncr;
}
}
@Override
public void chartPainting(ChartDrawEvent e) {}
@Override
public void seriesPainting(ChartDrawEvent e) {}
@Override
public void seriesPainted(ChartDrawEvent e) {}
});
}