Jump to content
Software FX Community


User (Legacy)

Recommended Posts

I have having a problem where when ever I run the following commands:

myChart.AxisX.Min = 0;

myChart.AxisX.Max = (int) maxquery.Parameters["@Max"].Value;


Width=myChart.AxisX.ValueToPixel(myChart.AxisX.Min)- Left

Left always comes out to be -500 when it should be arround 55.

and Width comes out to be 0

This problem also happens on the Y Axis.

I am trying to use this to calculate where to place my annotations. The

problem seems to get worse when the calculation is done and the chart is


Link to comment
Share on other sites

For performance reasons, all scaling calculations are delayed 'till drawing

time so that they are one only once.

The UpdateSize method forces this calculation to take place, this will

ensure that the scaling values returned are in accordance to what he chart

is going to draw, of course these scaling will change if the chart changes

size or any property affecting scaling is changed.

Annotation object provide and Attach method that allows you to link them to

a "logical" position making it unnecessary to make Value-to-pixel


As for your code:


Width=myChart.AxisX.ValueToPixel(myChart.AxisX.Min)- Left

With is always going to be zero, I guess you wanted to do:


Width=myChart.AxisX.ValueToPixel(myChart.AxisX.Max)- Left

I would strongly recommend for using the Attach method instead, this will

simplify your code a lot and will provide you with automatic repositioning

of objects when he scaling changes (for example when the chart is printed).



Software FX, Inc.

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...