Pie slices


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

By Julia Shah - 13 Years Ago

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 - 13 Years Ago

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