//Creates a Presentation instance
IPresentation pptxDoc = Presentation.Create();
// Create an instance of Presentation Renderer for converting chart to image
pptxDoc.PresentationRenderer = new PresentationRenderer();
//Adds a blank slide to the Presentation
ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank);
//Adds chart to the slide with position and size
IPresentationChart chart = slide.Charts.AddChart(100, 10, 700, 500);
//Specifies the chart title
chart.ChartTitle = "Sales Analysis";
//Sets chart data - Row1
chart.ChartData.SetValue(1, 2, "Jan");
chart.ChartData.SetValue(1, 3, "Feb");
chart.ChartData.SetValue(1, 4, "March");
//Sets chart data - Row2
chart.ChartData.SetValue(2, 1, 2010);
chart.ChartData.SetValue(2, 2, 0);
chart.ChartData.SetValue(2, 3, 0);
chart.ChartData.SetValue(2, 4, 0);
//Sets chart data - Row3
chart.ChartData.SetValue(3, 1, 2011);
chart.ChartData.SetValue(3, 2, 800);
chart.ChartData.SetValue(3, 3, 700);
chart.ChartData.SetValue(3, 4, 600);
//Sets chart data - Row4
chart.ChartData.SetValue(4, 1, 2012);
chart.ChartData.SetValue(4, 2, 600);
chart.ChartData.SetValue(4, 3, 700);
chart.ChartData.SetValue(4, 4, 800);
//Sets the data range of the category axis
chart.PrimaryCategoryAxis.CategoryLabels = chart.ChartData[2, 1, 4, 1];
//Creates a new chart series with the name
IOfficeChartSerie seriesJan = chart.Series.Add("Jan");
//Sets the data range of chart series – start row, start column, end row, end column
seriesJan.Values = chart.ChartData[2, 2, 4, 2];
//Creates a new chart series with the name
IOfficeChartSerie seriesFeb = chart.Series.Add("Feb");
//Sets the data range of chart series – start row, start column, end row, end column
seriesFeb.Values = chart.ChartData[2, 3, 4, 3];
//Creates a new chart series with the name
IOfficeChartSerie seriesMarch = chart.Series.Add("March");
//Sets the data range of chart series – start row, start column, end row, end column
seriesMarch.Values = chart.ChartData[2, 4, 4, 4];
//Specifies the chart type
chart.ChartType = OfficeChartType.Bar_Stacked_100;
using (var stream = new MemoryStream())
{
pptxDoc.PresentationRenderer.ConvertToImage(chart, stream);
slide.Shapes.AddPicture(stream, 100, 10, 700, 500);
}
//Save the PowerPoint file
pptxDoc.Save("Output.pptx");
//Close the PowerPoint instance
pptxDoc.Close();
This generates the following chart image, how can I get the 0 bars to display like the above image: