Custom line drawing
Posted: Fri Mar 23, 2012 7:59 pm
Hello,
I would like to draw several horizontal lines (parallel to the bottom/up axis), that denote some boundary values. These lines should start at the left axis' X and end at right axis X, at given height Y (but without right axis being shown). Unfortunately when Right axis is not shown, its getPosition() method returns 0, so it is unusable. Another thing that I tried is to use leftAxis' getPosition()+charts.Width(), but I couldn't find the correct Width method, that will return only the width within the chart (i.e. between right and left axes). Another thing I would like to do is to apply some clipping, so that when user pans on the chart, these horizontal lines are not drawn when they lie outside the chart area locked between the left/right/top/bottom axes.
this is what I do, with series set to use VerticalAxis.BOTH. This works, but I actually do not want to have Right axis shown.
IGraphics3D g3d = getChart().getGraphics3D();
for (int i=0;i<horiz_lines.length;i++) {
Point s = new Point(getChart().getAxes().getLeft().getPosition(), getChart().getAxes().getLeft().calcPosValue(horiz_lines));
Point e = new Point(getChart().getAxes().getRight().getPosition(), getChart().getAxes().getLeft().calcPosValue(horiz_lines));
g3d.moveTo(s);
g3d.lineTo(e,0);
}
I would like to draw several horizontal lines (parallel to the bottom/up axis), that denote some boundary values. These lines should start at the left axis' X and end at right axis X, at given height Y (but without right axis being shown). Unfortunately when Right axis is not shown, its getPosition() method returns 0, so it is unusable. Another thing that I tried is to use leftAxis' getPosition()+charts.Width(), but I couldn't find the correct Width method, that will return only the width within the chart (i.e. between right and left axes). Another thing I would like to do is to apply some clipping, so that when user pans on the chart, these horizontal lines are not drawn when they lie outside the chart area locked between the left/right/top/bottom axes.
this is what I do, with series set to use VerticalAxis.BOTH. This works, but I actually do not want to have Right axis shown.
IGraphics3D g3d = getChart().getGraphics3D();
for (int i=0;i<horiz_lines.length;i++) {
Point s = new Point(getChart().getAxes().getLeft().getPosition(), getChart().getAxes().getLeft().calcPosValue(horiz_lines));
Point e = new Point(getChart().getAxes().getRight().getPosition(), getChart().getAxes().getLeft().calcPosValue(horiz_lines));
g3d.moveTo(s);
g3d.lineTo(e,0);
}