Page 1 of 1

Wrong valueindex in WebChart_ClickSeries event !

Posted: Tue Aug 08, 2006 3:40 am
by 9640841
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);

-----------------------------------------------------------------------

Posted: Tue Aug 08, 2006 10:45 am
by Chris
Hello,

Can't you use the valueindex returned to calculate the real valueindex? That is, if the index returned is three and the current page is two then the real value index is (3 + (2 * MaxPointsPerPage)).

Posted: Wed Aug 09, 2006 1:08 am
by 9640841
I did it already in ClickSeries event as below
---------------------------------------------------
int trueIndex = rptWebChart.Chart.Page.MaxPointsPerPage * (Convert.ToInt32(ctlChart.CurrentPageSelected)-1) + valueIndex;
//set current select def code value
hfStageStr.Value = s.Labels[trueIndex].ToString();
---------------------------------------------------------

Let me anounce again, it just can't get right valueindex at last point of last page and the others are correct.

Please support to check that.

Posted: Wed Aug 09, 2006 8:18 am
by Chris
Hello,

OK. Would you be so kind as to send me *.aspx/*.aspx.cs (or *.aspx.vb) files which I can run 'as-is' to reproduce the problem here?

Many thanks!!