Multiple Legends

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
amol
Advanced
Posts: 231
Joined: Tue Mar 29, 2005 5:00 am

Multiple Legends

Post by amol » Tue May 03, 2016 10:17 am

Hi steema support,

We are facing an issue regarding multiple legends,
Why checkbox of legend 2 is not working independently?
We wants to work on checkbox of legend 2.
Legend.png
img1
Legend.png (32.91 KiB) Viewed 9465 times
Multiple Legends.rar
Demo
(58.97 KiB) Downloaded 1084 times
Please provide me any solution asap.
Thanks in advance.

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: Multiple Legends

Post by Christopher » Tue May 03, 2016 12:01 pm

amol wrote:We are facing an issue regarding multiple legends,
I'm not sure what you are trying to achieve with more than one legend, but I think you might like to consider use of the ExtraLegend tool, e.g.
extralegend.PNG
extralegend.PNG (199.99 KiB) Viewed 9464 times
Best Regards,
Christopher Ireland / 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

amol
Advanced
Posts: 231
Joined: Tue Mar 29, 2005 5:00 am

Re: Multiple Legends

Post by amol » Wed May 04, 2016 4:58 am

Hi steema,
Thanks for your prompt reply.
As you suggested we have gone through with the ExtraLegend tool, but here also we are unable to check/uncheck the series that is showing in the tool.
Basically our need is to check/uncheck checkboxes of the legend 2.
Is there is any other way to create Custom legend?

Thanks & Regards
PlanoResearch

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: Multiple Legends

Post by Christopher » Wed May 04, 2016 9:11 am

amol wrote: Basically our need is to check/uncheck checkboxes of the legend 2.
This requires a little extra code, e.g.

Code: Select all

    ExtraLegend legend;
    private void InitializeChart()
    {
      tChart1.Aspect.View3D = false;
      Line series1 = new Line(tChart1.Chart);
      Line series2 = new Line(tChart1.Chart);
      series1.FillSampleValues();
      series2.FillSampleValues();

      tChart1.Legend.CheckBoxes = true;

      legend = new ExtraLegend(tChart1.Chart);
      legend.Series = series2;
      legend.Legend.LegendStyle = LegendStyles.Series;
      legend.Legend.CheckBoxes = true;

      tChart1.MouseDown += TChart1_MouseDown;
    }

    private void TChart1_MouseDown(object sender, MouseEventArgs e)
    {
      int index = legend.Legend.Clicked(e.X, e.Y);

      if (index != -1)
      {
        Series s = tChart1.Chart.SeriesLegend(index, false);
        s.Active = !s.Active;
      }
    }
Best Regards,
Christopher Ireland / 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

Post Reply