Legend Hyphen


https://www.nevron.com/Forum/Topic5067.aspx
Print Topic | Close Window

By nick thompson - 13 Years Ago
Hi there,

How do we remove this hyphen from the legend (see screenshot)?

Regards
Nick
By Nevron Support - 13 Years Ago

Hi Nick,

This is caused by an empty values name when you use series grouping. You can wordaround it using some custom code - for example:


using System;
using System.Drawing;
using System.Windows.Forms;
using Nevron.GraphicsCore;
using Nevron.Chart;
using Nevron.ReportingServices;

namespace MyNamespace
{
 /// <summary>
 /// Sample class
 /// </summary>
 public class MyClass
 {
  /// <summary>
  /// Main entry point
  /// </summary>
  /// <param name="context"></param>
  public static void RSMain(NRSChartCodeContext context)
  {
   NChart chart = context.Document.Charts[0];
   
   for (int i = 0; i < chart.Series.Count; i++)
   {
    NSeriesBase series = chart.Series[i];
    
    if (series.Name.EndsWith(" - "))
    {
     series.Name = series.Name.Substring(0, series.Name.Length - 3);
    }
   }
  }
 }
}

Next version will have more options for grouped series names. Let us know if you meet any problems...

By Alan Schofield - 12 Years Ago

I'm not sure if this is still relevant but I had a similar issue under the following circumstances.

With a stacked column chart:

X = Year
Y = Amount
Data grouped by Category.

Value Grouping:
Label = blank
Value = "=Sum(Fields!Amount.Value)"

Category Grouping:
Label = "=Fields!PeriodDesc.Value"  (this is the readable Year in this case)
Group By= "=Fields!PeriodID.Value" (just the key field for the period)

Series Grouping:
Label = "=Fields!Category.Value"
Group By = "=Fields!Category.Value"

With these setting the legend rendered as "CategoryName -"

However, if I reversed this and set the Series Label to be blank (in the Series Grouping Editor dialog) and set the Label to =Fields!Category.Value (in the Values Grouping Editor) then the legend rendered as expected "CategoryName"

There was no need for any custom code.

Hope this helps somebody....

 

 

By Steve Cover - 11 Years Ago
Thanks a lot!

The solution you offered worked perfectly for me.
It was exactly the same issue I was having.

-Sandeep