Custom Legend for Histogram

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Tabina
Newbie
Newbie
Posts: 1
Joined: Tue Jul 17, 2012 12:00 am

Custom Legend for Histogram

Post by Tabina » Thu Mar 28, 2013 9:14 am

I am using the Histogram Series to display some data and I am assigning a color value to each data point depending on its value.

Code: Select all

       this.TChart = new TChart();
       this.Series = new Steema.TeeChart.WPF.Styles.Histogram(this.TChart.Chart);

        // set the histogram's datasource to content
        for (int i = 0; i < src.Content.Length; i++)
        {
          int value= src.Content[i];

          //get the color for the value
          Color col = ValueColorMapping[value];

          this.Series.Add(i, value, col);
        }

      // add the histogram to the series list
      this.TChart.Series.Add(this.Series);
Now I would like to see these colors in the histogram legend. If I use LegendStyles.Values the legend is far too long. Is it possible to remove any duplicates from the legends? Since my data contains a max. of 7 different values, I only want those 7 values to appear in the histogram legend.

Regards,

Tabina

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Custom Legend for Histogram

Post by Sandra » Thu Mar 28, 2013 2:30 pm

Hello Tabina,

To achieve remove or add items in your legend you could draw your own legend as in the example Christopher Ireland posted here.

I hope will helps.

Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply