Jump to content
Software FX Community

Coordinate Values on Line Chart


User (Legacy)

Recommended Posts

I am having a problem getting the coordinate of a spot (not a point) on a 

line chart.

I am able to make the line chart from data in a datatable, but after the

chart is drawn, I want to programmatically find the corresponding Y-Value of

a spot on the line.

For example, my X-Axis goes from 0 to 30 and I have points at .25, .5, 2, 3,

10 and 30.

Once the line is drawn, I want to know the Y-Value of a spot on the line

where the X-Value is 7.75.

Can this be done?

I have tried this:

Dim tmpdbl as Double

tmp = Chart.Value(0, 7.75)

I know this won't work because it wants a point as an integer passed into

the method and I think it wants what number point it is, not the X-Value.

Thanks for any help you can give me.

Duncan

Link to comment
Share on other sites

Yes. This can be done. The key phrase here is "after the chart is drawn". In 

Web Forms the controls draw AFTER all the code in the page is executed.

You can call a method called UpdateSizeNow after you finish setting up the

chart to allow the chart to calculate everything as it would when it draws.

Using Axis.ValueToPixel you can then convert logical coordinates (axis

coordinates) into physical coordinates (Pixels).

Depending on what are you going to use this information, you can also

capture the PostPaint event and use these coordinates to draw on top of the

chart.

--

Francisco Padron

www.chartfx.com

Link to comment
Share on other sites

Thank you for the response.

I am still unsure as to how to get the Y coordinate only knowing what the X

coordinate is.

After I draw the chart, I need to find out what the Y coordinate is at any

certain spot on the X-Axis.

Can you help with the correct method and syntax?

Thanks.

Duncan

"SoftwareFX Support" <noreply@softwarefx.com> wrote in message

news:0F6kKmRVGHA.3144@webserver3.softwarefx.com...

> Yes. This can be done. The key phrase here is "after the chart is drawn".

> In Web Forms the controls draw AFTER all the code in the page is executed.

>

> You can call a method called UpdateSizeNow after you finish setting up the

> chart to allow the chart to calculate everything as it would when it

> draws. Using Axis.ValueToPixel you can then convert logical coordinates

> (axis coordinates) into physical coordinates (Pixels).

>

> Depending on what are you going to use this information, you can also

> capture the PostPaint event and use these coordinates to draw on top of

> the chart.

>

> --

> Francisco Padron

> www.chartfx.com

>

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...