Chart Legend: Checkboxes not Clickable
Chart Legend: Checkboxes not Clickable
Hi
Toggling the visibility of certain series by using the corresponding checkboxes of the legend seems to fail under some special circumstances.
Imagine a series gets (invisibly) painted even beyond the chart axes. If such a line crosses the location of a checkbox, this checkbox is no longer clickable. Please take a look at the beautiful "TeePaperChart" attached to this post for further clarification.
Unfortunately we stick at version 2.0.2987.19069 as our reporting component has some issues with nested controls and just does not display the charts when using newer TeeCharts versions.
May I ask you for your assistance to find a workarround to get those checkboxes working under all circumstances? We would higly apprechiate your help.
Thank you very much
Manuel
Toggling the visibility of certain series by using the corresponding checkboxes of the legend seems to fail under some special circumstances.
Imagine a series gets (invisibly) painted even beyond the chart axes. If such a line crosses the location of a checkbox, this checkbox is no longer clickable. Please take a look at the beautiful "TeePaperChart" attached to this post for further clarification.
Unfortunately we stick at version 2.0.2987.19069 as our reporting component has some issues with nested controls and just does not display the charts when using newer TeeCharts versions.
May I ask you for your assistance to find a workarround to get those checkboxes working under all circumstances? We would higly apprechiate your help.
Thank you very much
Manuel
- Attachments
-
- 20100909174713_00001.jpg (16.85 KiB) Viewed 8477 times
Re: Chart Legend: Checkboxes not Clickable
Hi Manuel,
I've tried to reproduce the problem with the following code but I can't.
Note that I'm drawing a line at AfterDraw event over the series line to see if the hidden part of the series passes for the legend checkbox.
I couldn't reproduce it either in TeeChart v4 nor v2.
I've tried to reproduce the problem with the following code but I can't.
Note that I'm drawing a line at AfterDraw event over the series line to see if the hidden part of the series passes for the legend checkbox.
Code: Select all
public Form1()
{
InitializeComponent();
CreateChart();
InitializeChart();
}
private Steema.TeeChart.TChart tChart1;
private void CreateChart()
{
this.Width = 900;
this.Height = 600;
Steema.TeeChart.Commander chartController1 = new Steema.TeeChart.Commander();
chartController1.Dock = DockStyle.Top;
tChart1 = new Steema.TeeChart.TChart();
tChart1.Dock = DockStyle.Fill;
chartController1.Chart = tChart1;
this.Controls.Add(tChart1);
this.Controls.Add(chartController1);
}
private Steema.TeeChart.Styles.Line series;
private void InitializeChart()
{
tChart1.Aspect.View3D = false;
new Steema.TeeChart.Styles.Line(tChart1.Chart);
new Steema.TeeChart.Styles.Line(tChart1.Chart);
series = new Steema.TeeChart.Styles.Line(tChart1.Chart);
series.LinePen.Width = 3;
series.Add(10);
series.Add(0);
series.Add(10);
series.Add(0);
tChart1.Axes.Bottom.SetMinMax(0, 3);
tChart1.Axes.Left.SetMinMax(1.5, 10);
tChart1.Panel.MarginBottom = 7;
tChart1.Legend.CheckBoxes = true;
tChart1.Legend.Alignment = Steema.TeeChart.LegendAlignments.Bottom;
tChart1.Legend.CustomPosition = true;
tChart1.Legend.Left = 330;
tChart1.Legend.Top = 510;
tChart1.AfterDraw += new Steema.TeeChart.PaintChartEventHandler(tChart1_AfterDraw);
}
void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
if (tChart1[1].Active)
{
g.Pen.Width = 1;
g.Pen.Color = Color.Black;
g.Line(series.CalcXPos(0), series.CalcYPos(0), series.CalcXPos(1), series.CalcYPos(1));
g.Line(series.CalcXPos(1), series.CalcYPos(1), series.CalcXPos(2), series.CalcYPos(2));
}
}
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Chart Legend: Checkboxes not Clickable
Hi Yeray
Thank you for your message. Please find attached a small sample project which easily shows the issue described in my first post.
Best regards,
Manuel
Thank you for your message. Please find attached a small sample project which easily shows the issue described in my first post.
Best regards,
Manuel
- Attachments
-
- TeeChartDemo.zip
- (45.13 KiB) Downloaded 328 times
Re: Chart Legend: Checkboxes not Clickable
Hi Yeray
I am quite surprised that your example is working. I looked at the differences and figured out that two additional conditions must be met:
Best regards,
Manuel
I am quite surprised that your example is working. I looked at the differences and figured out that two additional conditions must be met:
- There must be a handler for the ClickSeries event of the chart
- Legend.CustomPosition must be false
Best regards,
Manuel
Code: Select all
public Form2()
{
InitializeComponent();
CreateChart();
InitializeChart();
}
private Steema.TeeChart.TChart tChart1;
private void CreateChart()
{
this.Width = 900;
this.Height = 600;
Steema.TeeChart.Commander chartController1 = new Steema.TeeChart.Commander();
chartController1.Dock = DockStyle.Top;
tChart1 = new Steema.TeeChart.TChart();
tChart1.Dock = DockStyle.Fill;
chartController1.Chart = tChart1;
this.Controls.Add(tChart1);
this.Controls.Add(chartController1);
}
private Steema.TeeChart.Styles.Line series;
private void InitializeChart()
{
tChart1.Aspect.View3D = false;
new Steema.TeeChart.Styles.Line(tChart1.Chart);
new Steema.TeeChart.Styles.Line(tChart1.Chart);
series = new Steema.TeeChart.Styles.Line(tChart1.Chart);
series.LinePen.Width = 3;
series.Add(10);
series.Add(0);
series.Add(10);
series.Add(0);
tChart1.Axes.Bottom.SetMinMax(0, 3);
tChart1.Axes.Left.SetMinMax(1.5, 10);
tChart1.Panel.MarginBottom = 7;
tChart1.Legend.CheckBoxes = true;
tChart1.Legend.Alignment = Steema.TeeChart.LegendAlignments.Bottom;
//tChart1.Legend.CustomPosition = true;
//tChart1.Legend.Left = 330;
//tChart1.Legend.Top = 510;
tChart1.AfterDraw += new Steema.TeeChart.PaintChartEventHandler(tChart1_AfterDraw);
tChart1.ClickSeries += new Steema.TeeChart.TChart.SeriesEventHandler(tChart1_ClickSeries);
}
void tChart1_ClickSeries(object sender, Steema.TeeChart.Styles.Series s, int valueIndex, MouseEventArgs e)
{
Console.WriteLine("Series clicked");
}
void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
if (tChart1[1].Active)
{
g.Pen.Width = 1;
g.Pen.Color = Color.Black;
g.Line(series.CalcXPos(0), series.CalcYPos(0), series.CalcXPos(1), series.CalcYPos(1));
g.Line(series.CalcXPos(1), series.CalcYPos(1), series.CalcXPos(2), series.CalcYPos(2));
}
}
Re: Chart Legend: Checkboxes not Clickable
Hello Manuel,
I have checked yeray's code again, and work well using either version 4 or version 2. Can you please explain us because previous code doesn't work fine for you? Because we can so we try to find a solution for your problem.
Thanks,
I have checked yeray's code again, and work well using either version 4 or version 2. Can you please explain us because previous code doesn't work fine for you? Because we can so we try to find a solution for your problem.
Thanks,
Best Regards,
Sandra Pazos / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: Chart Legend: Checkboxes not Clickable
Hi Sandra
Yeray's code is working fine. The problem is that we do not want to position the legend manually and that we need the series click event. As soon as you change those two things in Yeray's code it will expose the same issue as my code currently has. Please try out either the modified version of Yeray's code or the sample project I have provided earlier.
Thank you
Best regards,
Manuel
Yeray's code is working fine. The problem is that we do not want to position the legend manually and that we need the series click event. As soon as you change those two things in Yeray's code it will expose the same issue as my code currently has. Please try out either the modified version of Yeray's code or the sample project I have provided earlier.
Thank you
Best regards,
Manuel
Re: Chart Legend: Checkboxes not Clickable
Hi Manuel,
I could reproduce the problem now. It seems that the ClickSeries event may conflict with the legend checkboxes in the situation you described (the part of the series out of the chart rect would be over the legend). I've added it to the defect list to be fixed in future releases (TF02015147).
In the meanwhile you could try using MouseMove event in combination with series' click method instead of the ClickSeries event.
I could reproduce the problem now. It seems that the ClickSeries event may conflict with the legend checkboxes in the situation you described (the part of the series out of the chart rect would be over the legend). I've added it to the defect list to be fixed in future releases (TF02015147).
In the meanwhile you could try using MouseMove event in combination with series' click method instead of the ClickSeries event.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Chart Legend: Checkboxes not Clickable
Hi Yeray
Unfortunately, the series click event causes the same problem.
Based on the chart's MouseClick event and the Clicked method of the series it seems possible to implement a workarround:
Best regards,
Manuel
Unfortunately, the series click event causes the same problem.
Based on the chart's MouseClick event and the Clicked method of the series it seems possible to implement a workarround:
Code: Select all
void tChart1_MouseClick(object sender, MouseEventArgs e)
{
Rectangle chartR = tChart1.Chart.ChartRect;
if (chartR.Contains(e.Location))
{
for (int i = tChart1.Series.Count - 1; i >= 0 ; i--)
{
if (tChart1[i].Visible && tChart1[i].Clicked(e.X, e.Y) != -1)
{
Debug.WriteLine("Series " + i + " clicked");
break;
}
}
}
}
Manuel
Re: Chart Legend: Checkboxes not Clickable
Hello buchi,
Thanks for your information. I have checked your workaround and it seems that works fine here too .
Thanks,
Thanks for your information. I have checked your workaround and it seems that works fine here too .
Thanks,
Best Regards,
Sandra Pazos / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |