Page 1 of 1
LegendCheckBoxes not working propperly.
Posted: Thu Mar 29, 2012 3:35 pm
by 15661479
Hi
Strange behaviours that occur using the legend checkboxes:
1 - When I click on a checkbox that was checked, the other ones are checked again (if they weren't of course).
2 - If I click on a checkbox that was unchecked, it remains the same.
3 - If I click outside of the legend all checkboxes are checked again.
As I was adding the chart dinamically I thought it could be that but I tried again adding the chart directly to the markup but the strange behaviour remains the same.
Attached you will find both samples.
I am using the last version available.
What could be wrong?
Thanks in advance for your help!
Re: LegendCheckBoxes not working propperly.
Posted: Fri Mar 30, 2012 3:27 pm
by 10050769
Hello Hermes,
I suggest do something us next code:
Code: Select all
public partial class _Default : System.Web.UI.Page
{
TimeSpan timespant;
public static System.IO.MemoryStream tmpChart;
private static int index =-1;
private static int counter = 1;
// private static int ActualSeconds, DateSeconds,seconds;
private static System.Collections.ArrayList legendClickState;
protected void Page_Load(object sender, EventArgs e)
{
Steema.TeeChart.Chart ch1;
timespant = TimeSpan.FromSeconds(5);
if (Session["ch1"] == null)
{
ch1 = WebChart1.Chart;
ch1.Legend.CheckBoxes = true;
ch1.Series.Add(new Steema.TeeChart.Styles.Line());
ch1.Series.Add(new Steema.TeeChart.Styles.Line());
ch1.Series.Add(new Steema.TeeChart.Styles.Line());
ch1.Series.Add(new Steema.TeeChart.Styles.Line());
legendClickState= new System.Collections.ArrayList();
//timer.Interval = 20;
for (int i = 0; i < ch1.Series.Count; ++i)
{
ch1[i].FillSampleValues();
ch1[i].XValues.DateTime = true;
CheckedSeries chk = new CheckedSeries(WebChart1.Chart[i].Active, i,timespant);//,addr[i].ToString());
legendClickState.Add(chk);
}
ch1.Axes.Bottom.Labels.DateTimeFormat = "MM/dd hh:mm";
ch1.Axes.Bottom.Increment = Steema.TeeChart.Utils.GetDateTimeStep(Steema.TeeChart.DateTimeSteps.FifteenMinutes);
ch1.Axes.Bottom.Labels.Angle = 90;
tmpChart = new System.IO.MemoryStream();
ch1.Legend.CheckBoxes = true;
//export Chart to a MemoryStream template
ch1.Export.Template.Save(tmpChart);
// mysession = Session.SessionID;
//save template to a Session variable
Session.Add("ch1", tmpChart);
// WebChart1.ClickLegend += new Steema.TeeChart.Web.WebChart.ClickEventHandler(WebChart1_ClickLegend);
}
else
{
//retrieve the session stored Chart
tmpChart = (System.IO.MemoryStream)Session["ch1"];
//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
WebChart1.Chart.Import.Template.Load(tmpChart);
ch1 = WebChart1.Chart;
CheckLegendClick(WebChart1);
}
}
private void CheckLegendClick(Steema.TeeChart.Web.WebChart wChart)
{
System.Drawing.Bitmap bmp = WebChart1.Chart.Bitmap((int)wChart.Width.Value, (int)wChart.Height.Value);
index = wChart.Chart.Legend.Clicked(wChart.ClickedX, wChart.ClickedY);
if (index != -1)
{
//tempspan
if (Session["LegendClick"] == null)
{
Session.Add("LegendClick", legendClickState);
}
else
{
//timer.Start();
legendClickState = CheckBoxBeforeDraw(legendClickState);
int Seconds = DateTime.Now.Second;
for (int i = 0; i < wChart.Chart.Series.Count; i++)
{
if (((CheckedSeries)(legendClickState[i])).Index == index)
{
CheckedSeries chk = (CheckedSeries)legendClickState[index];
if ((Seconds - chk.TimeSpan.Seconds)>=0 && counter == 1)
{
chk.IsActive = !chk.IsActive;
legendClickState.RemoveAt(chk.Index);
legendClickState.Insert(chk.Index, chk);
bmp = WebChart1.Chart.Bitmap();
Session.Add("LegendClick", legendClickState);
counter++;
}
else if(counter>1)
{
counter = 1;
}
}
}
}
}
}
private ArrayList CheckBoxBeforeDraw(ArrayList legendClickState)
{
legendClickState = (System.Collections.ArrayList)Session["LegendClick"];
for (int i = 0; i < WebChart1.Chart.Series.Count; ++i)
{
CheckedSeries chk = (CheckedSeries)legendClickState[i];
WebChart1.Chart[i].Active = chk.IsActive;
}
return legendClickState;
}
public struct CheckedSeries
{
public CheckedSeries(bool isActive, int index, TimeSpan timespan)
{
IsActive = isActive;
Index = index;
TimeSpan = timespan;
}
public bool IsActive;
public int Index;
public TimeSpan TimeSpan;
}
}
Can you tell us if previous help you?
Thanks,
Re: LegendCheckBoxes not working propperly.
Posted: Tue Apr 24, 2012 2:21 pm
by 15661479
Hi!
Thanks for the answer and sorry for the late response.
It seems a lot of work to do as We add the chart dinamically on the page, expecting that not much work would be done after the chart is generated (we have other controls on the page too). So before I try the solution I should ask: is it expected that this functionality to work by itself in the near future? I mean without adding all this code?
Besides before trying the solution I think the static variables would not be addecuate in a multiuser enviroment am I right? Still, I will now try your solution for a static chart but would like to know the answer to the previous question before I start working on the actual project.
Thanks again!
Re: LegendCheckBoxes not working propperly.
Posted: Wed Apr 25, 2012 8:29 am
by 10050769
Hello Hermes,
It seems a lot of work to do as We add the chart dinamically on the page, expecting that not much work would be done after the chart is generated (we have other controls on the page too). So before I try the solution I should ask: is it expected that this functionality to work by itself in the near future? I mean without adding all this code?
It problem already exist in bug list report with number(TW77012763). We will try to fix it for next maintenance releases but at the moment the only solution I can recommend you is use my previous code.
Thanks,
Re: LegendCheckBoxes not working propperly.
Posted: Wed Apr 25, 2012 8:29 am
by 10050769
Hello Hermes,
It seems a lot of work to do as We add the chart dinamically on the page, expecting that not much work would be done after the chart is generated (we have other controls on the page too). So before I try the solution I should ask: is it expected that this functionality to work by itself in the near future? I mean without adding all this code?
It problem already exist in bug list report with number(TW77012763). We will try to fix it for next maintenance releases but at the moment the only solution I can recommend you is use my previous code.
Thanks,
Re: LegendCheckBoxes not working propperly.
Posted: Wed Apr 25, 2012 1:19 pm
by 15661479
Great I will try to adapt this solution to my project until the bug is fixed!
Is there any way to suscribe to the bug so I can get a notification when the bug is fixed?
Thanks a lot!
Re: LegendCheckBoxes not working propperly.
Posted: Wed Apr 25, 2012 3:21 pm
by 10050769
Hello Hermes,
You should be aware/subscribe to any of the Steema Software communication channels (
this forum,
Steema's home page,
Steema's RSS feed,
twitter or
facebook) for new release announcements and what's implemented on them at the release notes accompanying the news, for example:
http://www.teechart.net/support/viewtop ... =4&t=13090.
Thanks,
Re: LegendCheckBoxes not working propperly.
Posted: Tue Jul 24, 2012 10:10 pm
by 15661479
Hi!
Checking the version info of the last two releases I see that this issue hasn't been addressed yet, is there a planned date for this to be fixed/released so we can take it into account?
Thanks!
Re: LegendCheckBoxes not working propperly.
Posted: Thu Jul 26, 2012 2:07 pm
by narcis
Hi Hermes,
We have checked with the latest version of TeeChart and can confirm that the ClickLegend event quoted earlier in this thread is only visited once on Legend Checkbox click. The change in behaviour may have occurred during interim maintenance updates. With respect to the second part of your enquiry, we are looking at alternative means to actuate Legend click without the need for AutoPostback True, but it would require a re-work to part of the basic functionality of WebChart. It is a possibility but has been pushed back a little in priority order. We've put it down to be revisited now.
Re: LegendCheckBoxes not working propperly.
Posted: Tue Jun 10, 2014 3:58 pm
by 15661479
Hi,
I was searching for the bug TW77012763 in the versión list but it seems it not appear.
Was the problem solved?
And the point " we are looking at alternative means to actuate Legend click without the need for AutoPostback True" ?
thanks
Re: LegendCheckBoxes not working propperly.
Posted: Tue Jun 10, 2014 4:08 pm
by Christopher
Hello,
Hermes wrote:
I was searching for the bug TW77012763 in the versión list but it seems it not appear.
Was the problem solved?
The bug is still open with id=388 as can be seen
here. This bug database is public, so please feel free to comment on it.
I have made a request for the development team to reappraise this particular defect.