Page 1 of 1

What does mean DeterminePostBackMode

Posted: Mon Apr 16, 2007 1:40 am
by 9644471
There is a onhelp SetCurrentZoom method.
This is the sample code.

private void Page_Load(object sender, System.EventArgs e)
{
MemoryStream tmpChart;

if (Session["ch1"]==null)
{
WebChart1.Chart[0].FillSampleValues();
tmpChart=new MemoryStream();
WebChart1.Chart.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);
CheckZoom(WebChart1);
}
}

private void CheckZoom(WebChart wChart)
{
ArrayList zoomedState=(ArrayList)Session[wChart.ID+"Zoomed"];
zoomedState=((Steema.TeeChart.Tools.ZoomTool)wChart.Chart.Tools[0]).SetCurrentZoom(Request,zoomedState,DeterminePostBackMode());
if (zoomedState==null)
Session.Remove(wChart.ID+"Zoomed");
else
Session.Add(wChart.ID+"Zoomed",zoomedState);
}

But when I use this code, nothing happen.
It could not zoom in postback and !postback.
How can I use this code in my program?
Thank you.

Posted: Mon Apr 16, 2007 11:12 am
by narcis
Hi scott,

You should do exactly as shown in the example at the ASP.NET demo included with TeeChart's installation. You can find the demo at C:\Program Files\Steema Software\TeeChart for .NET v2\TeeChartForNET (Default English installation path). Does this demo work fine at your end?

Posted: Tue Apr 17, 2007 4:51 am
by 9644471
Thank you Narcís,
I knew there is a Zoom sample in file WebAppZoomChart.aspx.
But I can't find any thing about DeterminePostBackModebout int WebAppZoomChart.aspx.

Posted: Tue Apr 17, 2007 10:25 am
by narcis
Hi scott,

Does that example work fine at your end? Does it behave as you expect?

Posted: Wed Apr 18, 2007 1:03 am
by 9644471
Please see the step
1.Web page load
2.Zoom the WebChart
3.Click Button1 the WebChrt.Series[0] will change value, but WebChart still in the step 2 zoom scale.

My problem is when I already zoomed a webchart, then I update webchart data.
But the webchart still in last zoom scale.
When I update webchart data, I try to use Chart.Zoom.Undo but it still can't back normal zoom.

protected void Page_Load(object sender, EventArgs e)
{
MemoryStream tmpChart;

WebChart1.Chart.Series[0].FillSampleValues(200);
if (Session["ch1"] == null)
{
WebChart1.Chart[0].FillSampleValues();
tmpChart = new MemoryStream();
WebChart1.Chart.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);
CheckZoom(WebChart1);
}

}

private void CheckZoom(WebChart wChart)
{
ArrayList zoomedState = (ArrayList)Session[wChart.ID + "Zoomed"];
zoomedState = ((Steema.TeeChart.Tools.ZoomTool)wChart.Chart.Tools[0]).SetCurrentZoom(Request, zoomedState);

if (zoomedState == null)
Session.Remove(wChart.ID + "Zoomed");
else
Session.Add(wChart.ID + "Zoomed", zoomedState);
}

protected void Button1_Click(object sender, EventArgs e)
{
//WebChart1.Chart.Zoom.Undo(); --> I try to use Zoom.Undo()
WebChart1.Chart[0].FillSampleValues();
}

Posted: Wed Apr 18, 2007 8:03 am
by narcis
Hi scott,

In that case you could implement button's code like below. Setting axes to automatic you unzoom the chart.

Code: Select all

	protected void Button1_Click(object sender, EventArgs e)
	{
		WebChart1.Chart.Axes.Left.Automatic = true;
		WebChart1.Chart.Axes.Bottom.Automatic = true;

		WebChart1.Chart[0].FillSampleValues(); 
	}

Posted: Wed Apr 18, 2007 8:50 am
by 9644471
Narcís, thank you very much. It really helps me.

I stuck this function a little time.

The resolve is so easy. :roll:

I need to study in TeeChart. And it is a good 'Object'.