User (Legacy) Posted March 31, 2006 Report Share Posted March 31, 2006 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 More sharing options...
Software FX Posted March 31, 2006 Report Share Posted March 31, 2006 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 More sharing options...
User (Legacy) Posted April 3, 2006 Author Report Share Posted April 3, 2006 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 More sharing options...
Software FX Posted April 3, 2006 Report Share Posted April 3, 2006 That comes from your data. You will need to interpolate between two values and find the logical Y-Value for a given X. Then, with that information you can use ValueToPixel to obtain the Pixel value. -- Francisco Padron www.chartfx.com Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.