Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2060
UltraDataChart - Grouping Legend Items
posted

Hi,

How can you group items on the legend.

I'm plotting events on a graph but I only need their event description to be displayed on the legend because each event description is the same colour.

Here's a sample of my events data:

Event Name

Event Description

Date

Colour

FT Advert

Publication

1 Sep 2014

Blue

New Share Type Availability

Mailshot

5 Sep 2014

Olive

Tax Benefits

Mailshot

12 Sep 2014

Olive

 

 

 

 

I'd like to plot each event, which I'm currently doing but because the Event Description defines the colour of the line I'd like the legend to show one instance of the Event Description next to it's line colour.

At the moment the legend will show:

----- Publication

-----  Mailshot

-----  Mailshot

Ideally it would just read

-----  Publication

-----  Mailshot

Kind regards,

Nathan

Ps:  My apologies I've misfiled this under the WinChart forum.

  • 29105
    Verified Answer
    Offline posted

    Hello Nathan,

    I've been working on a solution for you. I updated the sample our team provided to you previously to include another line with the same string title and added some checking in place for any duplicate titles and set that item's LegendItemVisibility property to Collapsed. The following code can be added in DataChartLine.cs.


      foreach (Series series in chart.Series)           
      {               
          if (series is ScatterLineSeries)               
         {                   
              if (title == series.Title as string)         
              {      
                       scatterLine.LegendItemVisibility = Infragistics.Portable.Components.UI.Visibility.Collapsed;                
                       break;             
              }  
          }            
      }

    Let me know if you have any questions regarding this matter.

    DataGridVerticalGridlines.zip