public static void Run() { //ExStart:AddColorToDataPoints using (Presentation pres = new Presentation()) { // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Charts(); IChart chart = pres.Slides[0].Shapes.AddChart(ChartType.Sunburst, 100, 100, 450, 400); IChartDataPointCollection dataPoints = chart.ChartData.Series[0].DataPoints; dataPoints[3].DataPointLevels[0].Label.DataLabelFormat.ShowValue = true; IDataLabel branch1Label = dataPoints[0].DataPointLevels[2].Label; branch1Label.DataLabelFormat.ShowCategoryName = false; branch1Label.DataLabelFormat.ShowSeriesName = true; branch1Label.DataLabelFormat.TextFormat.PortionFormat.FillFormat.FillType = FillType.Solid; branch1Label.DataLabelFormat.TextFormat.PortionFormat.FillFormat.SolidFillColor.Color = Color.Yellow; IFormat steam4Format = dataPoints[9].Format; steam4Format.Fill.FillType = FillType.Solid; steam4Format.Fill.SolidFillColor.Color = Color.FromArgb(0, 176, 240, 255); pres.Save(dataDir + "AddColorToDataPoints.pptx", SaveFormat.Pptx); } //ExEnd:AddColorToDataPoints }
public static void Run() { //ExStart:AddCustomError // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Charts(); // Creating empty presentation using (Presentation presentation = new Presentation()) { // Creating a bubble chart IChart chart = presentation.Slides[0].Shapes.AddChart(ChartType.Bubble, 50, 50, 400, 300, true); // Adding custom Error bars and setting its format IChartSeries series = chart.ChartData.Series[0]; IErrorBarsFormat errBarX = series.ErrorBarsXFormat; IErrorBarsFormat errBarY = series.ErrorBarsYFormat; errBarX.IsVisible = true; errBarY.IsVisible = true; errBarX.ValueType = ErrorBarValueType.Custom; errBarY.ValueType = ErrorBarValueType.Custom; // Accessing chart series data point and setting error bars values for individual point IChartDataPointCollection points = series.DataPoints; points.DataSourceTypeForErrorBarsCustomValues.DataSourceTypeForXPlusValues = DataSourceType.DoubleLiterals; points.DataSourceTypeForErrorBarsCustomValues.DataSourceTypeForXMinusValues = DataSourceType.DoubleLiterals; points.DataSourceTypeForErrorBarsCustomValues.DataSourceTypeForYPlusValues = DataSourceType.DoubleLiterals; points.DataSourceTypeForErrorBarsCustomValues.DataSourceTypeForYMinusValues = DataSourceType.DoubleLiterals; // Setting error bars for chart series points for (int i = 0; i < points.Count; i++) { points[i].ErrorBarsCustomValues.XMinus.AsLiteralDouble = i + 1; points[i].ErrorBarsCustomValues.XPlus.AsLiteralDouble = i + 1; points[i].ErrorBarsCustomValues.YMinus.AsLiteralDouble = i + 1; points[i].ErrorBarsCustomValues.YPlus.AsLiteralDouble = i + 1; } // Saving presentation presentation.Save(dataDir + "ErrorBarsCustomValues_out.pptx", SaveFormat.Pptx); //ExEnd:AddCustomError } }