PieChart

Stimulsoft Reports.NET discussion
Post Reply
abhi_svks
Posts: 20
Joined: Wed Apr 16, 2008 2:22 am
Location: Chennai

PieChart

Post by abhi_svks »

Hi ,

How can I change the pie slice shape legends to sqaure shape legends?

I want to customize the color in the pie chart. How to perform this?

Since I used the chart wizard and generated the pie chart.


Thanks
Kamaraj.P
Stéphane
Posts: 74
Joined: Wed Dec 06, 2006 3:45 am
Location: Paris (France)

PieChart

Post by Stéphane »

How can I change the pie slice shape legends to sqaure shape legends?
I don't think you can change the markers style. You can change their size (property MarkerSize of the Legend) but not the shape.
I want to customize the color in the pie chart. How to perform this?
You can change the colors with the Style property by choosing a predefined style. If you want to do your own style, you must create your own StiChartStyle class :

Code: Select all

public class StiCustomChartStyle : StiChartStyle
{
  private Color[] m_styleColors;

  public StiCustomChartStyle ()
    : base()
  {
  }

  public override Color[] StyleColors
  {
    get
    {
      if (m_styleColors == null)
      {
        m_styleColors = new Color[] { Color.FromArgb(153, 204, 255),
          Color.FromArgb(204, 153, 255), Color.FromArgb(204, 255, 204), 
          Color.FromArgb(255, 255, 153), Color.FromArgb(255, 153, 204),
          Color.FromArgb(255, 204, 153), Color.FromArgb(51, 204, 204), 
          Color.FromArgb(153, 204, 0), Color.FromArgb(255, 204, 0), 
          Color.FromArgb(255, 153,  0), Color.FromArgb(255, 102, 0), 
          Color.FromArgb(51, 102, 255), Color.FromArgb(0, 204, 255), 
          Color.FromArgb(204, 255, 255), Color.FromArgb(204, 204, 255), 
          Color.FromArgb(153, 51, 102), Color.FromArgb(102, 102, 153)
          };
      }
      return m_styleColors;
    }
  }

  /// 
  /// Gets a service name
  /// 
  public override string ServiceName
  {
    get { return StiLocalization.Get("Chart", "Style") + "99"; }
  }

  public override Color BasicStyleColor
  {
     get { return Color.FromArgb(212, 210, 208); }
  }
}
And don't forget to add this new service :

Code: Select all

StiConfig.Services.Add(new StiCustomChartStyle());
Cordially,
Kakone
Post Reply