Dear,
I am using ASPose.Slide version 7.3 to create a .pptx presentation in which i added a simple clustered bar chart. For some bars (based on rules i have in my application), I need to hide only the bar and keep the value in the CategoryAxis, kindly find the result i desire in “ClusteredBar after edit.png” screenshot. In order to do so i am using a “null” value for the bar i need to hide, kindly find the code i am using bellow:
private void CreateSlide()
{
SlideEx slide = pres.Slides[0];
ChartEx clusteredBarChart = slide.Shapes.AddChart(ChartTypeEx.ClusteredBar, 10, 10, 400, 400);
clusteredBarChart.CategoryAxis.IsPlotOrderReversed = true;
clusteredBarChart.HasLegend = false;
clusteredBarChart.GapWidth = 20;
clusteredBarChart.ChartData.Series.Clear();
clusteredBarChart.ChartData.Categories.Clear();
clusteredBarChart.ValueAxis.IsVisible = false;
clusteredBarChart.CategoryAxis.TickLabelPosition = TickLabelPositionType.Low;
ChartDataCellFactory fact = clusteredBarChart.ChartData.ChartDataCellFactory;
clusteredBarChart.ChartData.Series.Add(fact.GetCell(0, 0, 1, “Series 1”), clusteredBarChart.Type);
ChartSeriesEx series = clusteredBarChart.ChartData.Series[0];
clusteredBarChart.ChartData.Categories.Add(fact.GetCell(0, 1, 0, “C1”));
series.Values.Add(fact.GetCell(0, 1, 1, 24));
clusteredBarChart.ChartData.Categories.Add(fact.GetCell(0, 2, 0, “C2”));
series.Values.Add(fact.GetCell(0, 2, 1, 23));
clusteredBarChart.ChartData.Categories.Add(fact.GetCell(0, 3, 0, “C3”));
series.Values.Add(fact.GetCell(0, 3, 1, -10));
clusteredBarChart.ChartData.Categories.Add(fact.GetCell(0, 4, 0, “C4”));
series.Values.Add(fact.GetCell(0, 4, 1, null));
series.Labels.TextProperties.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FillFormat.FillType = FillTypeEx.Solid;
series.Labels.TextProperties.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FontHeight = 12;
series.Labels.ShowValue = true;
}
In “ClusteredBar before edit.png” screenshot, you can realist that setting a null value for any bar leads in removing the bar completely from the chart (bar + Category Axis)(C4 does not show in the Axis). But when I click “Edit Data” in the chart, the value of the bar appears in the Axis and still the bar is hidden, as shows “ClusteredBar after edit.png” screenshot (now C4 shows in the Axis).
Is there any way I could do to have the result in “ClusteredBar after edit.png” screenshot without the need to click on “Edit Data”.
Thank you in advance,
Sami Simon