Nevron Charts for SSRS - Mixed Label Layouts and Center text

143 views Asked by At

I have to build the following chart (rendered in excel):

enter image description here

Using Nevron Charts for SSRS I have gotten this far:

enter image description here

I am not able to center the labels and also unable to mix and match label layouts.

Notice the sample has spider labels mixed with centered labels (i.e. labels placed on pie sector). Also, I had to use the following expression to add both the category and value with a new line to the label as follows: ="<label>" & "<br/>" & "<value>" & "%"

Since it's still one label, I cannot center it as required.

Any ideas? Hacks are fine too.

1

There are 1 answers

0
UrAvgProdigyDev On

I did a google search and found a link to this article which might be able to answer you question: https://www.nevron.com/Forum/6489/How-to-text-align-in-Pie-chart-data-label

Basically, the user wanted the labels to be center-aligned text and not towards a certain side(left or right). As I think this might work for you here is the code below:

using System;
using System.Drawing;
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)
  {
   if (context.Document.Charts.Count == 0)
    return;
    
   NChart chart = context.Document.Charts[0];
   
   NPieSeries pieSeries = chart.Series[0] as NPieSeries;
   
   if (pieSeries != null)
   {
    pieSeries.AutomaticLabelAlignment = false;
   }
  }
 }
}

Hopefully this works for you!