Page 1 of 1

Problems drawing labels near CursorTool after Removing axes

Posted: Wed Jan 09, 2008 1:15 pm
by 9642017
Hello,

I added some Labels to my chart's CursorTool. This Labels are located directly left (or right) of the CursorTool. To determine the right X-Position for my Labels I use the following code:

Code: Select all

int xPixel = this.Chart.Axes.Custom[0].CalcXPosValue(XValue);
this.getTopLabel().Location = new System.Drawing.Point(xPixel, 30);
This works fine.

BUT:

I use some vertical custom axes at the left side of the chart. There is one axis for every ChartLine. If one ChartLine will be removed, the corresponding vertical axis will be removed too. Left margin of the Chart will be set new to use the space, the removed axis left behind. Afterwards, the value in xPixel (using above shown code) is not correct anymore. Labels are not shown nearby the CursorTool but about 10 Pixels away from the cursor. What can I do to avoid this problem?

Thank you in advance,

rf

Posted: Wed Jan 09, 2008 2:09 pm
by narcis
Hi rf,

You'd better use this code in TChart's AfterDraw event so that those variables/properties are reevaluated every time the chart is being drawn.