Nevron Forum

Pie slices

https://www.nevron.com/Forum/Topic4779.aspx

By Julia Shah - Thursday, January 27, 2011

Hi,

How can I make my pie chart's slices to show separately (cut out) from one another, like here for example? http://forum.nevron.com/download.aspx?id=352&MessageID=4716

Thanks!

By Nevron Support - Thursday, January 27, 2011

Hi Julia,

You'll have to use some custom code. The following code snippet shows how to apply detachments to all pie slices it can be modified to apply detachment to individual slices as well:


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)
  {
   NPieChart pieChart = context.Document.Charts[0] as NPieChart;
   
   if (pieChart == null)
    return;
    
   for (int i = 0; i < pieChart.Series.Count; i++)
   {
    NPieSeries pieSeries = (NPieSeries)pieChart.Series[i];
    for (int j = 0; j < pieSeries.Values.Count; j++)
    {
     pieSeries.Detachments.Add(2);
    }
   }
  }
 }
}