Get x/y value at y/x point?

If I create a simple line chart, like this.

ChartSeries series = new ChartSeries("Series 1");
series.Points.Add(0, 500);
series.Points.Add(1,340);
series.Points.Add(3,440);
series.Type = ChartSeriesType.Line;


Are there any way for me to get the y-value at x = 2?

Maybe something like: chartControl1.Series(0).GetYValue(2); ?

8 Replies

VV Venkata Vijayaraj B Syncfusion Team September 11, 2009 09:37 AM UTC

Hi Markus,

Thanks for your interest in Syncfusion products.

Use the below code to get Y - Value at X = 2.

Dim y() As Double= chartControl1.Series(0).Summary.ModelImpl.GetY(2)
y(0) - 1st Y Value.
y(1) - 2nd Y Value.

Please let me know if this helps.

Regards,
Venkat.


MP Markus Persson September 14, 2009 07:26 AM UTC

This doesn't seems to help me.

I have this serie in my example:
Me.ChartControl1.Series(0).Points.Add(-20, 20)
Me.ChartControl1.Series(0).Points.Add(0, 15)
Me.ChartControl1.Series(0).Points.Add(20, 15)


And when I try:
Me.ChartControl1.Series(0).Summary.ModelImpl.GetY(18)


I get an error "Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index"

Expected output that I want is "15". (At x = 18, y is 15)


VV Venkata Vijayaraj B Syncfusion Team September 14, 2009 11:18 AM UTC

Hi Markus,

Sorry for the inconvenience caused. We don't have direct support to identify the particular Y value for particular X value which are not included to Series. It is possible to achieve through one workaround, I have attached a simple sample for your reference. You can modify the 'FindIntersectingPoint' method depend on your requirement to find the specific value.

Sample Link:
http://files.syncfusion.com/support/Chart.Windows/v7.3.0.20/F89938/F89938Sample/main.htm

Please let me know if this helps.

Regards,
Venkat.


PJ Palak Jain February 25, 2010 08:29 PM UTC

I need to do the same thing. Get the value of Y at X.
But I cannot access the sample code provided in the previous post.


VV Venkata Vijayaraj B Syncfusion Team February 26, 2010 10:15 AM UTC

Hi Palak,

Sorry for the inconvenience caused.

Here is the updated link.
http://files.syncfusion.com/support/Chart.Windows/v7.3.0.20/F89938_New/F89938Sample/main.htm

Please let us know if this helps.

Regards,
Venkat.


PJ Palak Jain March 16, 2010 03:12 PM UTC

I still can't open the link. I get the Page Not Found error.

Palak


VV Venkata Vijayaraj B Syncfusion Team March 17, 2010 04:08 AM UTC

Hi Palak,

Sorry for the inconvenience caused.

Kindly download the sample from the following link below.
http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=F89938_Sample-1139976731.zip

Regards,
Venkat.



VV Venkata Vijayaraj B Syncfusion Team March 17, 2010 04:08 AM UTC

Hi Palak,

Sorry for the inconvenience caused.

Kindly download the sample from the following link.
http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=F89938_Sample-1139976731.zip

Regards,
Venkat.


Loader.
Up arrow icon