WebTeechart.NET V2 Zoom

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
GLE client
Newbie
Newbie
Posts: 9
Joined: Mon Jul 04, 2005 4:00 am
Location: Belgium
Contact:

WebTeechart.NET V2 Zoom

Post by GLE client » Mon Jul 11, 2005 4:40 pm

Hi,
I must develop an asp.net application where it's possible to zoom on scientific line charts. It's a demand of my business client. I experienced problems of precision with zoom function. If I zoom once on a small part of the chart, I've got generally a zoom of the part that I selected. If I a re-rezoom on a part of the previous zoom, I don't generally have the good part of the graph.
Generally, if you make a zoom on a very small area of the graph, it fails and it doesn't show a good image of the zoomed part.

I want to make possible "precision zooms" on the charts of my application. I also choiced Steema component for the zoom function present in V2.

You can experience the same problem with your example:
http://www.steema.net/TeeChartForNET/In ... 202&y1=221

Can you tell how it's possible to make good zooms....
thanks

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Jul 12, 2005 10:43 am

Hi GLE client,

Thank you very much for reporting that. Yes, you are right. I've already added this to our deffect list to be fixed for future releases.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

GLE client
Newbie
Newbie
Posts: 9
Joined: Mon Jul 04, 2005 4:00 am
Location: Belgium
Contact:

Update date

Post by GLE client » Thu Jul 21, 2005 10:59 am

Hi,
thanks to reply me. I need the zoom function in the web project for my client. Could you tell me when a correction for this bug will be released? Is the beta version of 21st July. 2005 patchs this problem?
Thanks

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Jul 22, 2005 10:07 am

Hi GLE client,

The example you pointed to in your previous message seems to work fine for me now. Could you please test it and confirm that?

Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

GLE client
Newbie
Newbie
Posts: 9
Joined: Mon Jul 04, 2005 4:00 am
Location: Belgium
Contact:

zoom problem

Post by GLE client » Fri Jul 22, 2005 4:43 pm

Hi, well I tested the debug version 2.0.2027.21317 and the problem with zoom is always the same. At the first zoom, there is no stress. From the 2nd zoom, the zoomed part does not correspond any more to the selected rectangle. The problem is not with Y values but with X values I think.
In The code below, analyze de values of a,b,c,d and you will see that a and b are good but c and d are not good.

For the test, I taked a blank page, putted a webchart on it with a sample line serie and a zoom tool.
The code:

Code: Select all

private void Page_Load(object sender, System.EventArgs e)
		{
				//check whether zoom request is being sent
				string zoom=Request.QueryString["zoom"];
				if ((zoom!=null))
					if (zoom=="0")
					{
						WebChart1.Chart.Zoom.Undo();
						//clear any saved zoom information
						Session.Remove("ch1Zoomed");
					}
					else
					{
						//each new call to the server is an independent call for the Chart
						//so non-Chart information must be saved. An Arraylist is used
						//here to save current Axis information to a session variable.

						//add new list for saved zoom state
						ArrayList axes = new ArrayList();
						//check if existing zoom state exists
						ArrayList zoomedChart=(ArrayList)Session["ch1Zoomed"];
						if (zoomedChart!=null)
						{
							//apply existing zoom condition to Chart before applying new zoom condition
							((Steema.TeeChart.Tools.ZoomTool)WebChart1.Chart.Tools[0]).SetSavedZoom(zoomedChart);
						}

						int x0=Convert.ToInt32(Request.QueryString["x0"]);
						int y0=Convert.ToInt32(Request.QueryString["y0"]);
						int x1=Convert.ToInt32(Request.QueryString["x1"]);
						int y1=Convert.ToInt32(Request.QueryString["y1"]);

						//convert selected co-ordinates to new zoom
						axes=((Steema.TeeChart.Tools.ZoomTool)WebChart1.Chart.Tools[0]).Zoom(new Rectangle(x0,y0,x1-x0,y1-y0));
						double a= WebChart1.Chart.Axes.Left.CalcPosPoint(y0);
						double b= WebChart1.Chart.Axes.Left.CalcPosPoint(y1);
						double c= WebChart1.Chart.Axes.Bottom.CalcPosPoint(x0);
						double d= WebChart1.Chart.Axes.Bottom.CalcPosPoint(x1);
						//save new Axes' ranges to a session variable
						//for further zoom support
						Session.Add("ch1Zoomed",axes);
					}
		}

GLE client
Newbie
Newbie
Posts: 9
Joined: Mon Jul 04, 2005 4:00 am
Location: Belgium
Contact:

Post by GLE client » Tue Jul 26, 2005 6:09 am

No Answer?

Marc
Site Admin
Site Admin
Posts: 1272
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Post by Marc » Tue Jul 26, 2005 2:07 pm

Hello,

We're looking into this. We'll post comments to this thread when we have some new information.

Regards,
Marc Meumann
Steema Support

Marc
Site Admin
Site Admin
Posts: 1272
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Post by Marc » Tue Jul 26, 2005 2:40 pm

Hello,

The Width and Height dimensions of the Chart are not correctly initialised. The problem begins to become easily apparent when Charts are drag-sized to a non-standard aspect ratio.

We'll fix this internally to TeeChart for the next release so that no additional coding be required but as a workaround to allow you to continue now please add the following to your code:

Below:

Code: Select all

int x0=Convert.ToInt32(Request.QueryString["x0"]); 
int y0=Convert.ToInt32(Request.QueryString["y0"]); 
int x1=Convert.ToInt32(Request.QueryString["x1"]); 
int y1=Convert.ToInt32(Request.QueryString["y1"]);


add:

Code: Select all

WebChart1.Chart.Width=(int)WebChart1.Width.Value;
WebChart1.Chart.Height=(int)WebChart1.Height.Value;
That should resolve the issue.

FYI. - Not directly related.
We'll post a project shortly that shows multiple-zoomable Charts on the same page. There are some refinements to the page code.

Regards,
Marc Meumann
Steema Support

Marc
Site Admin
Site Admin
Posts: 1272
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Post by Marc » Tue Jul 26, 2005 6:55 pm

Another note on Zoom for WebCharts.

Double precision will be added for the next update. Current zoom is limited to integer steps.

GLE client
Newbie
Newbie
Posts: 9
Joined: Mon Jul 04, 2005 4:00 am
Location: Belgium
Contact:

Zoom bug

Post by GLE client » Wed Jul 27, 2005 5:51 pm

Well, if I take your web example WebAppZoomChart.aspx and i add the C# lines like you say. I've got the same result than before:

Code: Select all

private void Page_Load(object sender, System.EventArgs e)
		{
			//			// Put user code to initialize the page here
			//			WebChart1.Chart[0].FillSampleValues(10);
			//			WebChart2.Chart[0].FillSampleValues(10);
			//			WebChart3.Chart[0].FillSampleValues(10);
			// ****************************************************
			//The data load code for WebChart1 demostrates a technique to save 
			//data between page calls. The Chart is saved as a TeeChart template 
			//to a session variable.
			// ****************************************************
			Steema.TeeChart.Chart ch1=WebChart1.Chart;
			MemoryStream tmpChart=new MemoryStream();

			if (Session["ch1"]==null)
			{			
				//setup Chart
				if (ch1.Series.Count<2)
				{ 
					ch1.Series.Add(new Steema.TeeChart.Styles.Points());
					ch1.Series.Add(new Steema.TeeChart.Styles.Points());
				}
				//((Steema.TeeChart.Tools.ZoomTool)ch1.Tools[0]).ZoomPenColor=Color.Yellow;

				((Points)ch1.Series[0]).Pointer.Pen.Visible=false;
				((Points)ch1.Series[1]).Pointer.Pen.Color=Color.FromArgb(79,79,255);
		
				ch1.Series[0].Color=Color.FromArgb(255,199,26);
				ch1.Series[1].Color=Color.FromArgb(106,106,255);

				ch1.Series[0].FillSampleValues(36);
				ch1.Series[1].FillSampleValues(36);
				//export Chart to a MemoryStream template
				ch1.Export.Template.Save(tmpChart);
				//save template to a Session variable
				Session.Add("ch1",tmpChart);
			}
			else
			{
				//retrieve the session stored Chart
				tmpChart=(MemoryStream)Session["ch1"];
				//set the Stream position to 0 as the last read/write
				//will have moved the position to the end of the stream
				tmpChart.Position=0;
				//import saved Chart
				WebChart1.Chart.Import.Template.Load(tmpChart);

				//check whether zoom request is being sent
				string zoom=Request.QueryString["zoom"];
				if ((zoom!=null) && (Request.QueryString["chart"]==WebChart1.ID))
					if (zoom=="0")
					{
						ch1.Zoom.Undo();
						//clear any saved zoom information
						Session.Remove("ch1Zoomed");
					}
					else
					{
						//each new call to the server is an independent call for the Chart
						//so non-Chart information must be saved. An Arraylist is used
						//here to save current Axis information to a session variable.

						//add new list for saved zoom state
						ArrayList axes = new ArrayList();
						//check if existing zoom state exists
						ArrayList zoomedChart=(ArrayList)Session["ch1Zoomed"];
						if (zoomedChart!=null)
						{
							//apply existing zoom condition to Chart before applying new zoom condition
							((Steema.TeeChart.Tools.ZoomTool)WebChart1.Chart.Tools[0]).SetSavedZoom(zoomedChart);
						}

						int x0=Convert.ToInt32(Request.QueryString["x0"]);
						int y0=Convert.ToInt32(Request.QueryString["y0"]);
						int x1=Convert.ToInt32(Request.QueryString["x1"]);
						int y1=Convert.ToInt32(Request.QueryString["y1"]);
						WebChart1.Chart.Width=(int)WebChart1.Width.Value; 
						WebChart1.Chart.Height=(int)WebChart1.Height.Value;
						//convert selected co-ordinates to new zoom
						axes=((Steema.TeeChart.Tools.ZoomTool)WebChart1.Chart.Tools[0]).Zoom(new Rectangle(x0,y0,x1-x0,y1-y0));

						//save new Axes' ranges to a session variable
						//for further zoom support
						Session.Add("ch1Zoomed",axes);
					}
			}
		}
Can you tell me when a debug version with the correction of this bug will be released? Thanks
Don't you have another trick to have good zooms because I must release the project for my client in few days.....
Thanks

Marc
Site Admin
Site Admin
Posts: 1272
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Post by Marc » Wed Jul 27, 2005 11:05 pm

Hello,

The integer sensitivity might also be a factor in the problem as you see it on the demo Form as it will force a zoom to round to the nearest integer. The maintenance release due out next week includes support for non-integer min/max values.

You can cross-check that on the example by adding the data in larger steps instead of the single integer increment FillSampleValues.

eg.

Code: Select all

for (int i=0; i<500 ; i=i+10)
{
  ch1.Series[0].Add(i,r.Next());
  ch1.Series[1].Add(i,r.Next());
}
You should notice improved precision on the zooms.

Regards,
Marc Meumann
Steema Support

Post Reply