How to text align in Pie chart data label


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

By Amendra Kodituwakku - 12 Years Ago

Hi,

Can someone tell me how to change a pie chart that has labels outside with arrows (spider mode) with multiline text to be centered aligned and not left or right.

Thanks

AK

By Nevron Support - 12 Years Ago

Hi Amendra,

You need to turn off the automatic label alignment for the pie chart series. This currently can be achieved only trough code - you need to copy paste the following code in the Code tab of the designer:

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;
   }
  }
 }
}

Hope this helps - let us know if you meet any problems or have any questions.

By Amendra Kodituwakku - 12 Years Ago

That worked thanks.