Page 1 of 1

Custom Legend for Histogram

Posted: Thu Mar 28, 2013 9:14 am
by 15663014
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

Re: Custom Legend for Histogram

Posted: Thu Mar 28, 2013 2:30 pm
by 10050769
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,