So I'm trying to use IsHidden to hide some series in order to not clutter plot area.
While it hides series correctly, when trying to filter those series from PowerPoint itself index is shifted and wrong series are shown, which is totally wrong and makes this feature unusable.
Please see this video to get idea what is going one (pay attention how different series is selected in filter panel)
Check this code snippet:
- Code: Select all
static void Main(string[] args)
{
var presentation = new Presentation();
var slide = presentation.Slides[0];
var chart = slide.Shapes.AppendChart(ChartType.ScatterStraightLinesAndMarkers, new RectangleF(0, 0, 500, 500),false);
chart.ChartLegend.Position = ChartLegendPositionType.TopRight;
chart.ChartLegend.Top = 100;
chart.ChartLegend.IsOverlay = true;
chart.ChartLegend.Fill.FillType = FillFormatType.Solid;
chart.ChartLegend.Fill.SolidColor.Color = Color.White;
chart.ChartLegend.Line.SolidFillColor.Color = Color.Blue;
int count = 7;
int pointCount = 10;
chart.Series.SeriesLabel = chart.ChartData[0, 0, 0, count - 1];
for (int i = 0; i < count; i++)
{
chart.ChartData[0, i].Value = "Series" + i;
for (var j = 0; j < pointCount; j++)
{
chart.ChartData[j + 1, i].Value = i;
chart.ChartData[j + 1, count + i].Value = i + j + count;
}
chart.Series[i].YValues = chart.ChartData[1, i, pointCount, i];
chart.Series[i].XValues = chart.ChartData[1, count + i, pointCount, count + i];
// Only Show Series with index 1 and 6
chart.Series[i].IsHidden = i != 1 && i != count - 1;
}
presentation.SaveToFile("D://test.pptx", FileFormat.Pptx2013);
Process.Start("D://test.pptx");
}
I would kindly ask you to provide fix asap as it is important feature for us.
Regards