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);
}
Custom line drawing
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: Custom line drawing
Hi pvasilev,
Bottom axis StartPosition and EndPosition will also provide horizontal coordinates for the start and end of the bottom axis.
You can use bottom axis EndPosition instead:Unfortunately when Right axis is not shown, its getPosition() method returns 0, so it is unusable.
Code: Select all
tChart1.getAxes().getBottom().getEndPosition();
Yes, this is possible. You should set clipping regions in the OnBeforeDrawChart event and clear them in the OnAfterDraw event. Something similar to what's done in OpaqueZonesDemo.java in the Swing demo at the Examples\Swing\Features\src\features\axes folder.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.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: Custom line drawing
Hi Narcis,
thanks for your prompt reply. I will check and report back should any problems arise.
thanks for your prompt reply. I will check and report back should any problems arise.