Page 1 of 1

problem with tutorial10 zooming

Posted: Fri Aug 03, 2007 7:14 pm
by 9640386
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);
}
}

Posted: Mon Aug 06, 2007 8:10 am
by narcis
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);