Chart Plot Area
Contents
[
Hide
]
Get Width, Height of Chart Plot Area
Aspose.Slides for Android via Java provides a simple API for .
- Create an instance of the Presentation class.
- Access first slide.
- Add chart with default data.
- Call method IChart.validateChartLayout() before to get actual values.
- Gets actual X location (left) of the chart element relative to the left top corner of the chart.
- Gets actual top of the chart element relative to the left top corner of the chart.
- Gets actual width of the chart element.
- Gets actual height of the chart element.
// Create an instance of Presentation class
Presentation pres = new Presentation();
try {
Chart chart = (Chart)pres.getSlides().get_Item(0).getShapes().addChart(ChartType.ClusteredColumn, 100, 100, 500, 350);
chart.validateChartLayout();
double x = chart.getPlotArea().getActualX();
double y = chart.getPlotArea().getActualY();
double w = chart.getPlotArea().getActualWidth();
double h = chart.getPlotArea().getActualHeight();
} finally {
if (pres != null) pres.dispose();
}
Set Layout Mode of Chart Plot Area
Aspose.Slides for Android via Java provides a simple API to set the layout mode of the chart plot area. Methods setLayoutTargetType and getLayoutTargetType have been added to ChartPlotArea class and IChartPlotArea interface. If the layout of the plot area defined manually this property specifies whether to layout the plot area by its inside (not including axis and axis labels) or outside (including axis and axis labels). There are two possible values which are defined in LayoutTargetType enum.
- LayoutTargetType.Inner - specifies that the plot area size shall determine the size of the plot area, not including the tick marks and axis labels.
- LayoutTargetType.Outer - specifies that the plot area size shall determine the size of the plot area, the tick marks, and the axis labels.
Sample code is given below.
// Create an instance of Presentation class
Presentation pres = new Presentation();
try {
ISlide slide = pres.getSlides().get_Item(0);
IChart chart = slide.getShapes().addChart(ChartType.ClusteredColumn, 20, 100, 600, 400);
chart.getPlotArea().setX(0.2f);
chart.getPlotArea().setY(0.2f);
chart.getPlotArea().setWidth(0.7f);
chart.getPlotArea().setHeight(0.7f);
chart.getPlotArea().setLayoutTargetType(LayoutTargetType.Inner);
pres.save("SetLayoutMode_outer.pptx", SaveFormat.Pptx);
} finally {
if (pres != null) pres.dispose();
}