Page 1 of 1

Storing Co-ordinates of line chart

Posted: Mon Dec 15, 2008 11:42 am
by 13048037
I have the following requirement in ASP.net with C#

I need to store the X and Y co- ordinates as plotted in the line chart along with the X and Y data values .

I am aware that there are methods of HotspotTool in the WebChart Tools section of Teechart component,but they all are dependent on the movement of the mouse cursor.

Are there other options to achieve the same?

Posted: Mon Dec 15, 2008 2:52 pm
by narcis
Hi Ace,

Yes, you can do something like this:

Code: Select all

		System.Drawing.Bitmap bmp = WebChart2.Chart.Bitmap();
		Steema.TeeChart.Styles.Series s = WebChart2.Chart.Series[0];

		for (int i = 0; i < s.Count; i++)
		{
			double xVal = s.XValues[i];
			double yVal = s.YValues[i];	
			int xPos = s.CalcXPos(i);
			int yPos = s.CalcYPos(i);
			//Save those variables as you wish
		}
Notice the Bitmap method call. It's necessary for chart being internally painted so that series screen positions have correct values.

Storing Co-ordinates of line chart

Posted: Tue Dec 16, 2008 5:49 am
by 13048037
Hi Narcis,

Thank you for the prompt reply.

Well, I did try to use
System.Drawing.Bitmap bmp = WebChart2.Chart.Bitmap(); but I am getting the following 'An exception of type 'System.ArgumentException' occurred in System.Drawing.dll but was not handled in user code'.

Then I found there is an overload method which takes the width and height as the parameters.This solved the errror.

Though I will be able to pass these parameters since the graph width and height are constant, I am just curious to know why I get the Error when I do not pass any parameters to the Bitmap method

Posted: Tue Dec 16, 2008 8:57 am
by narcis
Hi Ace,

You may be using an old version of TeeChart. Could you please check you are using latest version available at the client download area?

Thanks in advance.