Page 1 of 1

Multiple Legends

Posted: Tue May 03, 2016 10:17 am
by 9526439
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 9468 times
Multiple Legends.rar
Demo
(58.97 KiB) Downloaded 1084 times
Please provide me any solution asap.
Thanks in advance.

Re: Multiple Legends

Posted: Tue May 03, 2016 12:01 pm
by Christopher
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 9467 times

Re: Multiple Legends

Posted: Wed May 04, 2016 4:58 am
by 9526439
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

Re: Multiple Legends

Posted: Wed May 04, 2016 9:11 am
by Christopher
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;
      }
    }