Chart Manipulations

Chart Manipulations

Switch Data over axis

A new property has been added which Swap the data over the axis. Data being charted on the X axis will move to the Y axis and vice versa. Below sample example is given.

Changing Category axis

CategoryAxisType can be changed to Date or Text.However, CategoryAxisType.Auto is not supported at the moment. New property CategoryAxisType has been added to IAxis and Axis classes which specifies type of category axis.

Using Callouts

New property ShowLabelAsDataCallout has been added to DataLabelFormat class and IDataLabelFormat interface, which determines either specified chart’s data label will be displayed as data callout or as data label. In the example given below, we have set the Callouts.

Specifying center gap in Doughnut Chart

In order to specify the size of the hole in a doughnut chart. Please follow the steps below:

  • Instantiate Presentation class.
  • Add doughnut chart on the slide.
  • Specify the size of the hole in a doughnut chart.
  • Write presentation to disk.

In the example given below, we have set the size of the hole in a doughnut chart.

Setting the RotationX, RotationY and DepthPercents properties of 3D Chart

Aspose.Slides for .NET provides a simple API for setting these properties. This following article will help you how set different properties like X,Y Rotation , DepthPercents etc. The sample code applies setting the above said properties.

  1. Create an instance of the Presentation class.
  2. Access first slide.
  3. Add chart with default data.
  4. Set Rotation3D properties.
  5. Write the modified presentation to a PPTX file.

Calculates actual values of chart elements

Aspose.Slides for .NET provides a simple API for getting these properties. This will help you to Calculates actual values of chart elements. The actual values include position of elements that implement IActualLayout interface (IActualLayout.ActualX, IActualLayout.ActualY, IActualLayout.ActualWidth, IActualLayout.ActualHeight) and actual axes values (IAxis.ActualMaxValue, IAxis.ActualMinValue, IAxis.ActualMajorUnit, IAxis.ActualMinorUnit, IAxis.ActualMajorUnitScale, IAxis.ActualMinorUnitScale).

Get Actual Max value of vertical axis on a chart

Aspose.Slides for .NET provides a simple API for getting value of vertical axis. 

  1. Create an instance of the Presentation class.
  2. Access first slide.
  3. Add chart with default data.
  4. Get actual maximum value on the axis.
  5. Get actual minimum value on the axis.
  6. Get actual major unit of the axis.
  7. Get actual minor unit of the axis.
  8. Get actual major unit scale of the axis.
  9. Get actual minor unit scale of the axis.

Get Width, Height for ChartPlotArea

Aspose.Slides for .NET provides a simple API for . 

  1. Create an instance of the Presentation class.
  2. Access first slide.
  3. Add chart with default data.
  4. Call method IChart.ValidateChartLayout() before to get actual values.
  5. Gets actual X location (left) of the chart element relative to the left top corner of the chart.
  6. Gets actual top of the chart element relative to the left top corner of the chart.
  7. Gets actual width of the chart element.
  8. Gets actual height of the chart element.

Calculates actual position of parent chart elements

Aspose.Slides for .NET provides a simple API for getting these properties. Properties of IActualLayout provide information about actual position of parent chart element. It is necessary to call method IChart.ValidateChartLayout() previously to fill properties with actual values.

Setting chart data from workbook

A new property has been added to set chart data from workbook. Now Aspose.Slides does allow ReadWorkbookStream() and WrtiteWorkbookStream() methods to read and write chart data workbooks containing chart data edited using Aspose.Cells. However, the chart data needs to be organized in same way or of similar type as of source type. Below sample example is given.

Setting the GapWidth property of Chart Series

Aspose.Slides for .NET provides a simple API for setting GapWidth property. The sample code applies setting the GapWidth property.

  1. Create an instance of the Presentation class.
  2. Access first slide.
  3. Add chart with default data.
  4. Access any chart series.
  5. Set GapWidth property.
  6. Write the modified presentation to a PPTX file.

Setting the WorkBook Cell As Chart DataLabel

Aspose.Slides for .NET provides a simple API for getting value from WorkBook Cell used as DataLabel:

  1. Create an instance of the Presentation class.
  2. Obtain a slide’s reference by its index.
  3. Add a chart with default data along with the Bubble type.
  4. Accessing the chart series.
  5. Setting Workbook cell as data label.
  6. Save the presentation to a PPTX file.

Get chart external data source workbook path

Aspose.Slides for .NET provides a simple API for getting value from WorkBook Cell used as DataLabel:

  1. Create an instance of the Presentation class.
  2. Obtain a slide’s reference by its index.
  3. Create object for chart shape
  4. Create object for source type of ChartDataSourceType which represents data source of the chart.
  5. If Source Type is equal to external workbook the get chart external data source workbook path.

Second plot options for Pie of Pie and Bar of Pie chart

Aspose.Slides for .NET now supports, second plot options for Pie of Pie or Bar of Pie chart. In this topic, we will see with example how to Specify these options using Aspose.Slides. In order to specify the properties. Please follow the steps below:

  1. Instantiate Presentation class object.
  2. Add chart on the slide.
  3. Specify the second plot options of chart.
  4. Write presentation to disk.

In the example given below, we have set different properties of Pie of Pie chart.

Setting the RotationX, RotationY and DepthPercents properties of 3D Chart

Aspose.Slides for .NET provides a simple API for setting these properties. This following article will help you how set different properties like X,Y Rotation , DepthPercents etc. The sample code applies setting the above said properties.

  1. Create an instance of the Presentation class.
  2. Access first slide.
  3. Add chart with default data.
  4. Set Rotation3D properties.
  5. Write the modified presentation to a PPTX file.

Setting automatic pie chart slice colors

Aspose.Slides for .NET provides a simple API for setting automatic pie chart slide colors. The sample code applies setting the above said properties.

  1. Create an instance of the Presentation class.
  2. Access first slide.
  3. Add chart with default data.
  4. Set chart Title.
  5. Set first series to Show Values.
  6. Set the index of chart data sheet.
  7. Getting the chart data worksheet.
  8. Delete default generated series and categories.
  9. Add new categories.
  10. Add new series.

Write the modified presentation to a PPTX file.

Setting Precision of Data in chart Data Labels

Aspose.Slides for .NET provides a simple API for setting precision of data in chart data label. Below sample example is given. 

Support for setting date format for Category Axis Value

Aspose.Slides for .NET provides a simple API for setting date format for category axis value. Below sample example is given. 

Support for setting rotation angle for chart axis title

Aspose.Slides for .NET provides a simple API for setting rotation angle for chart axis title. Below sample example is given. 

Support of setting Position Axis in Category or Value Axis

Aspose.Slides for .NET provides a simple API for setting Position axis in category or Value axis. Below sample example is given. 

Support for showing Display Unit label on Chart value axis

Aspose.Slides for .NET provides support for showing Display unit label on chart value axis. Below sample example is given. 

Support for Bubble chart Size scaling

Aspose.Slides for .NET provides support for Bubble chart size scaling. In Aspose.Slides for .NET IChartSeries.BubbleSizeScale and IChartSeriesGroup.BubbleSizeScale properties have been added. Below sample example is given. 

Get Chart Image

Aspose.Slides for .NET provides support for extracting image of specific chart. Below sample example is given. 

Changing Series Color

Aspose.Slides for .NET provides support for changing series color. 

  1. Instantiate Presentation class object.
  2. Add chart on the slide.
  3. Access specific series of chart.
  4. Set fill type and fill color.
  5. Save modified presentation.

Below sample example is given. 

Setting chart area rounded borders

Aspose.Slides for .NET provides support for setting chart area. IChart.HasRoundedCorners and Chart.HasRoundedCorners properties have been added in Aspose.Slides. 

  1. Instantiate Presentation class object.
  2. Add chart on the slide.
  3. Set fill type and fill color of chart
  4. Set round corner property True.
  5. Save modified presentation.

Below sample example is given. 

Change color of categories in a series

Aspose.Slides for .NET provides support for changing color of categories in a series color. 

  1. Instantiate Presentation class object.
  2. Add chart on the slide.
  3. Access specific series of chart.
  4. Set fill type and fill color.
  5. Save modified presentation.

Below sample example is given. 

Setting font properties for chart data table

Aspose.Slides for .NET provides support for changing color of categories in a series color. 

  1. Instantiate Presentation class object.
  2. Add chart on the slide.
  3. set chart table.
  4. Set font height.
  5. Save modified presentation.

Below sample example is given. 

Setting Callout For Doughnut chart

Aspose.Slides for .NET provides support for setting series data label callout shape for a Doughnut chart. Below sample example is given. 

Hide Information From Chart

This topic helps you to understand how to hide information from chart. Using Aspose.Slides for .NET you can hide Title, Vertical Axis, Horizontal Axis and Grid Lines from chart. Below code example shows how to use these properties.

Set Font Properties for Chart

Aspose.Slides for .NET provides support for setting the font related properties for the chart. Please follow the steps below for setting the font properties for chart.

  • Instantiate Presentation class object.
  • Add chart on the slide.
  • Set font height.
  • Save modified presentation.

Below sample example is given.