Wrong valueindex in WebChart_ClickSeries event !
Posted: Tue Aug 08, 2006 3:40 am
I get 24 records from DB and set webchart.maxpointsperpage=10.
AfterI change webchart.current=2 (it draws correct) and click the last point (valueindex should be 3) of chart , it can't return the correct valueindex or even can't trigger in click event. But it does not happen when I click other points in all pages.
To improve the performance, I use template chart at Page_Load as below code.
------------------------------------------------------------------------
Steema.TeeChart.Chart ch2 = rptWebChart.Chart;
MemoryStream tmpChart = new MemoryStream();
//
if (!IsPostBack)
{
hfChartId.Value = Guid.NewGuid().ToString();
//Value Initial
qryiostatistics wf = (qryiostatistics)Context.Handler;
Set_Initial_Value(wf);
//set back to query url at page_load
ctlOthers.BackToQueryStr = hfBackToQuery.Value;
//get data from SQL and web chart setting
Draw_Chart();
//Localize Grid Column headtext
}
else
{if (Session[hfChartId.Value] != null)
{
//retrieve the session stored Chart
tmpChart = (MemoryStream)Session[hfChartId.Value];
//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
ch2.Import.Template.Load(tmpChart);
}
}
-----------------------------------------------------------------------
The Draw_Chart code is as below.
-------------------------------------------------------------------------
MemoryStream tmpChart = new MemoryStream();
Set_DataGrid();
//set web chart data
WebChart_Process();
//set max chart per page
rptWebChart.Chart.Page.MaxPointsPerPage = Convert.ToInt32(ctlChart.ChartNumSelected);
//set page count
ctlChart.TotalPageSelected = rptWebChart.Chart.Page.Count.ToString();
//set chart page
SetCurrentPage(ctlChart.TotalPageSelected);
//set current page
rptWebChart.Chart.Page.Current = Convert.ToInt32(ctlChart.CurrentPageSelected);
//rptWebChart.Chart.Series[0].GetSeriesMark += new Steema.TeeChart.Styles.Series.GetSeriesMarkEventHandler(this.serial_Num_GetSeriesMark);
//export Chart to a MemoryStream template
rptWebChart.Chart.Export.Template.Save(tmpChart);
//save template to a Session variable
Session.Add(hfChartId.Value, tmpChart);
-----------------------------------------------------------------------
AfterI change webchart.current=2 (it draws correct) and click the last point (valueindex should be 3) of chart , it can't return the correct valueindex or even can't trigger in click event. But it does not happen when I click other points in all pages.
To improve the performance, I use template chart at Page_Load as below code.
------------------------------------------------------------------------
Steema.TeeChart.Chart ch2 = rptWebChart.Chart;
MemoryStream tmpChart = new MemoryStream();
//
if (!IsPostBack)
{
hfChartId.Value = Guid.NewGuid().ToString();
//Value Initial
qryiostatistics wf = (qryiostatistics)Context.Handler;
Set_Initial_Value(wf);
//set back to query url at page_load
ctlOthers.BackToQueryStr = hfBackToQuery.Value;
//get data from SQL and web chart setting
Draw_Chart();
//Localize Grid Column headtext
}
else
{if (Session[hfChartId.Value] != null)
{
//retrieve the session stored Chart
tmpChart = (MemoryStream)Session[hfChartId.Value];
//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
ch2.Import.Template.Load(tmpChart);
}
}
-----------------------------------------------------------------------
The Draw_Chart code is as below.
-------------------------------------------------------------------------
MemoryStream tmpChart = new MemoryStream();
Set_DataGrid();
//set web chart data
WebChart_Process();
//set max chart per page
rptWebChart.Chart.Page.MaxPointsPerPage = Convert.ToInt32(ctlChart.ChartNumSelected);
//set page count
ctlChart.TotalPageSelected = rptWebChart.Chart.Page.Count.ToString();
//set chart page
SetCurrentPage(ctlChart.TotalPageSelected);
//set current page
rptWebChart.Chart.Page.Current = Convert.ToInt32(ctlChart.CurrentPageSelected);
//rptWebChart.Chart.Series[0].GetSeriesMark += new Steema.TeeChart.Styles.Series.GetSeriesMarkEventHandler(this.serial_Num_GetSeriesMark);
//export Chart to a MemoryStream template
rptWebChart.Chart.Export.Template.Save(tmpChart);
//save template to a Session variable
Session.Add(hfChartId.Value, tmpChart);
-----------------------------------------------------------------------