I am using 'Steema TeeChart for .NET 2015 4.1.2015.03110\net40\x86\TeeChart.dll'
I'm trying to unzoom programmatically using Chart.Zoom.Undo(); but it won't work.
I also tried using the ZoomTool which is added to the chart but none of my approaches led
to the desired result,
any advice?
Unzoom
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: Unzoom
Using the same TeeChart.dll and the following code:Will wrote: I'm trying to unzoom programmatically using Chart.Zoom.Undo(); but it won't work.
I also tried using the ZoomTool which is added to the chart but none of my approaches led
to the desired result,
Code: Select all
Line series1;
private void InitializeChart()
{
tChart1.Aspect.View3D = false;
tChart1.Legend.Visible = false;
series1 = new Line(tChart1.Chart);
series1.FillSampleValues();
}
private void button4_Click(object sender, EventArgs e)
{
tChart1.Zoom.Undo();
}
Best Regards,
Christopher Ireland / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: Unzoom
All right
aspx:
codebehind:
EDIT: The project I'm working on is an Asp.Net WebForm using .NET Framework 4
aspx:
Code: Select all
<tchart:WebChart ID="WebChart" runat="server" Height="228px" Width="542px" GetChartFile="GetChart.aspx" TempChart="Session" />
Code: Select all
private string SSN_KEY_CHART_DATA = "chartData";
protected void Page_Load(object sender, EventArgs e)
{
InitializeChart();
CheckZoom();
}
private void InitializeChart()
{
if (WebChart.Chart.Tools.Count == 0)
{
WebChart.Chart.Tools.Add(new ZoomTool());
}
RestoreState();
if (WebChart.Chart.Series.Count == 0)
{
Line series1;
WebChart.Chart.Aspect.View3D = false;
WebChart.Chart.Legend.Visible = false;
series1 = new Line(WebChart.Chart);
series1.FillSampleValues();
SaveState();
}
}
private System.IO.MemoryStream ChartData
{
get
{
if (Page.Session[SSN_KEY_CHART_DATA] == null)
{
Page.Session[SSN_KEY_CHART_DATA] = new System.IO.MemoryStream();
}
System.IO.MemoryStream tmp = Page.Session[SSN_KEY_CHART_DATA] as System.IO.MemoryStream;
tmp.Seek(0, System.IO.SeekOrigin.Begin);
return tmp;
}
set
{
Page.Session[SSN_KEY_CHART_DATA] = value;
}
}
public void SaveState()
{
ChartData = new System.IO.MemoryStream();
WebChart.Chart.Export.Template.Save(ChartData);
}
private void RestoreState()
{
if (ChartData.Length != 0)
{
WebChart.Chart.Import.Template.Load(ChartData);
}
}
private void CheckZoom()
{
ArrayList zoomedState = (ArrayList)Session[UniqueID + "Zoomed"];
ZoomTool zoomTool = (ZoomTool)WebChart.Chart.Tools[0];
zoomedState = zoomTool.SetCurrentZoom(Page.Request, zoomedState);
if (zoomedState == null)
{
Session.Remove(UniqueID + "Zoomed");
}
else
{
Page.Session.Add(UniqueID + "Zoomed", zoomedState);
}
}
protected void Button3_Click(object sender, EventArgs e)
{
WebChart.Chart.Zoom.Undo();
}
EDIT: The project I'm working on is an Asp.Net WebForm using .NET Framework 4
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: Unzoom
Hello Will,
Apologies for the fact that over twenty-four hours have passed without a response to your issue. Just to let you know that we are presently looking into it and that we hope to have a response for you very shortly.
Apologies for the fact that over twenty-four hours have passed without a response to your issue. Just to let you know that we are presently looking into it and that we hope to have a response for you very shortly.
Best Regards,
Christopher Ireland / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: Unzoom
Will,
Two possible solutions, the first in the page-behind file, e.g.
and the second a javascript function in the page itself, e.g.
Two possible solutions, the first in the page-behind file, e.g.
Code: Select all
private void CheckZoom()
{
CheckZoom((ArrayList)Session[UniqueID + "Zoomed"]);
}
private void CheckZoom(ArrayList zoomedState)
{
ZoomTool zoomTool = (ZoomTool)WebChart1.Chart.Tools[0];
zoomedState = zoomTool.SetCurrentZoom(Page.Request, zoomedState);
if (zoomedState == null)
{
Session.Remove(UniqueID + "Zoomed");
}
else
{
Page.Session.Add(UniqueID + "Zoomed", zoomedState);
}
}
protected void Button1_Click(object sender, EventArgs e)
{
CheckZoom(null);
Page_Load(sender, e);
}
Code: Select all
</head>
<script type="text/javascript">
function resetZoom() {
__doPostBack(WebChart1, 'chart$WebChart1;zoom$0');
}
</script>
<body>
<form id="form1" runat="server">
<div>
</div>
<tchart:WebChart ID="WebChart1" runat="server" Height="500px" Width="800px" GetChartFile="GetChart.aspx" TempChart="Session" />
<!--<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />-->
<button type="button" onclick="resetZoom();">ResetZoom</button>
</form>
</body>
Best Regards,
Christopher Ireland / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: Unzoom
I used the first solution and it's working,
thank you
thank you