SharePoint - SharePoint 2010: Defining the custom color(theme) for a Pie Chart using the Chart web part

Asked By hari sharepoint on 12-Jun-12 05:18 PM
I want to apply custom theme for pie chart webpart.........How to configure custom theme..........? 
TSN ... replied to hari sharepoint on 12-Jun-12 11:48 PM

Hi…

We need to apply custom chart type to a Chart control programmatically using Chart.ApplyCustomType Method.

 

Here is the sample from msdn  ..

private void Create3DPieChart()

{

    this.Range["A1", "A5"].Value2 = 22;

    this.Range["B1", "B5"].Value2 = 55;

    Microsoft.Office.Tools.Excel.Chart chart1 =

      this.Controls.AddChart(this.Range["D2", "H12"],”chart1");

    chart1.SetSourceData(this.Range["A1", "B5"],Excel.XlRowCol.xlColumns);

    chart1.ChartType = Excel.XlChartType.xl3DColumn;

    chart1.ApplyCustomType(Excel.XlChartType.xl3DPie,missing);

}

 

Jitendra Faye replied to hari sharepoint on 13-Jun-12 12:43 AM
reference from-

http://technet.microsoft.com/en-us/library/microsoft.office.tools.excel.chart.applycustomtype%28v=vs.80%29.aspx

Solution-

The following code example creates a Chart and then uses the ApplyCustomType method to apply the 3-D pie chart type to the chart. The example does not specify a value for the optional TypeName parameter because a standard chart type is being used.


private void Create3DPieChart()
{
    this.Range["A1", "A5"].Value2 = 22;
    this.Range["B1", "B5"].Value2 = 55;

    Microsoft.Office.Tools.Excel.Chart chart1 =
      this.Controls.AddChart(this.Range["D2", "H12"],
      "chart1");

    chart1.SetSourceData(this.Range["A1", "B5"],
      Excel.XlRowCol.xlColumns);
    chart1.ChartType = Excel.XlChartType.xl3DColumn;

    chart1.ApplyCustomType(Excel.XlChartType.xl3DPie,
      missing);
}


Hope this will help you.
hari sharepoint replied to Jitendra Faye on 13-Jun-12 03:31 PM
Hello,

Thank you for the answer, I am trying to create custom appearance theme instead of the chart. I have created pie carts using chart web part.
When we create pie chart OOTB it will give options to choose appeareance theme.There are 12 themes now, I wanna add a new custom theme with my own colors. There is an option in the dropdown saying custom but when I select it doesn't give any options to choose colors. Any suggestions.