We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Gray background on chart when iniWithSample set to false

This code produces a gray background in the plot area (specifically when iniWithSample = false) :

IChart chart = slide.Shapes.AddChart(ChartType.Line, x, y, scaleWidth, scaleHeight, false);

I’ve tried to set every background and fill property I can find to white and no luck. When iniWithSample = true it goes away.

Setting the chart Style property also has no effect.

Any help would be great.


I have observed your requirements and not able to completely understand which portion of chart background you are trying to change. Can you please share the generated presentation along with information that for which chart portion you need to change the background. I will investigate the issue further on our end to help you out.

Here are the different outputs - the gray background occurs when the initWithSample flat is true. The white background occurs when the flag is true.

Capture2.PNG (29.7 KB)
Capture1.PNG (34.8 KB)

Using the latest eval version


I suggest you to please try using following sample code on your end to serve the purpose.

public static void TestChartPlotArea()
    Presentation pres = new Presentation();
    IChart chart = pres.Slides[0].Shapes.AddChart(ChartType.Line, 30, 30, 400, 400);

    chart.PlotArea.Format.Fill.FillType = FillType.NoFill;
    //chart.PlotArea.Format.Fill.SolidFillColor.Color = Color.Red;

    pres.Save("C:\\Aspose Data\\ChartPlotColor.pptx", Aspose.Slides.Export.SaveFormat.Pptx);

I do but I don’t want the sample data included in the data set (which your example includes). Your snippet works but use this:

IChart chart = pres.Slides[0].Shapes.AddChart(ChartType.Line, 30, 30, 400, 400, false);

And let me know what you see. Notice the last parameter. I get a gray background in the plot area when set to false (the default is true - which includes the sample data).


I have shared the sample code with default sample data. The following line is actually related to fulfillment of your requirement related to clearing grey background. You can use any data for chart as per your requirement.

chart.PlotArea.Format.Fill.FillType = FillType.NoFill;

Please use the above code line in your application to clear the chart’s plot area color.