problem with tutorial10 zooming

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
LordWhorfin
Newbie
Newbie
Posts: 24
Joined: Wed Feb 22, 2006 12:00 am
Location: Flagstaff, Arizona, USA

problem with tutorial10 zooming

Post by LordWhorfin » Fri Aug 03, 2007 7:14 pm

Hello,

I working my way through Tutorial10 and am having trouble with the zooming section. When I use the code behind listed below I get the following error..

CS0246: The type or namespace name 'WebChart' could not be found (are you missing a using directive or an assembly reference?)

It looks like the private void CheckZoom(WebChart wChart) statement needs yo have a fully conformed name for WebChart, but if I change it to:

private void CheckZoom(Steema.TeeChart.Web.WebChart wChart)

I get this error..

System.InvalidCastException: Unable to cast object of type 'Steema.TeeChart.Tools.SeriesHotspot' to type 'Steema.TeeChart.Tools.ZoomTool'.

Code Behind:


using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;



public partial class Default2 : System.Web.UI.Page
{

private void Page_Load(object sender, System.EventArgs e) {
//Let's work with the Chart object for convenience
Steema.TeeChart.Chart Chart1 = WebChart1.Chart;
//Add in a series and fill it
Chart1.Aspect.View3D = false;
Steema.TeeChart.Styles.Bubble bubble1 = new Steema.TeeChart.Styles.Bubble(Chart1);
bubble1.FillSampleValues();
//Add a SeriesToolTip to the Chart
Steema.TeeChart.Tools.SeriesHotspot seriesHotSpot1 = new Steema.TeeChart.Tools.SeriesHotspot(Chart1);
//Steema.TeeChart.Styles.MapAction.Mark is the default value
seriesHotSpot1.MapAction = Steema.TeeChart.Styles.MapAction.Mark;
//Add a ZoomTool to the Chart
Steema.TeeChart.Tools.ZoomTool zoomTool1 = new Steema.TeeChart.Tools.ZoomTool(Chart1);
// *************** Code for zoom support ***************
//check whether zoom request is being sent
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);
}
}

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

Post by Narcís » Mon Aug 06, 2007 8:10 am

Hi LordWhorfin,

It seems to me that's because you have 2 tools in your application: a hotspots tool and a zoom tool. Considering this, the first tool in the chart (hotspots tool) is index number zero and the second tool (zoom tool) has index number one. Having said that, this line:

Code: Select all

zoomedState=((Steema.TeeChart.Tools.ZoomTool)wChart.Chart.Tools[0]).SetCurrentZoom(Request,zoomedState); 
Should be changed to this:

Code: Select all

zoomedState=((Steema.TeeChart.Tools.ZoomTool)wChart.Chart.Tools[1]).SetCurrentZoom(Request,zoomedState); 
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

Post Reply