public class ChartSeriesGroup
extends java.lang.Object
Remarks:
Combo charts contains multiple chart series groups, with a separate group for each series type.
Also, you can create a chart series group to assign secondary axes to one or more chart series.
To learn more, visit the Working with Charts documentation article.
Examples:
Shows how to work with the secondary axis of chart.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Shape shape = builder.insertChart(ChartType.LINE, 450.0, 250.0);
Chart chart = shape.getChart();
ChartSeriesCollection series = chart.getSeries();
// Delete default generated series.
series.clear();
String[] categories = new String[] { "Category 1", "Category 2", "Category 3" };
series.add("Series 1 of primary series group", categories, new double[] { 2.0, 3.0, 4.0 });
series.add("Series 2 of primary series group", categories, new double[] { 5.0, 2.0, 3.0 });
// Create an additional series group, also of the line type.
ChartSeriesGroup newSeriesGroup = chart.getSeriesGroups().add(ChartSeriesType.LINE);
// Specify the use of secondary axes for the new series group.
newSeriesGroup.setAxisGroup(AxisGroup.SECONDARY);
// Hide the secondary X axis.
newSeriesGroup.getAxisX().setHidden(true);
// Define title of the secondary Y axis.
newSeriesGroup.getAxisY().getTitle().setShow(true);
newSeriesGroup.getAxisY().getTitle().setText("Secondary Y axis");
Assert.assertEquals(ChartSeriesType.LINE, newSeriesGroup.getSeriesType());
// Add a series to the new series group.
ChartSeries series3 =
newSeriesGroup.getSeries().add("Series of secondary series group", categories, new double[] { 13.0, 11.0, 16.0 });
series3.getFormat().getStroke().setWeight(3.5);
doc.save(getArtifactsDir() + "Charts.SecondaryAxis.docx");
| Modifier and Type | Method and Description |
|---|---|
int |
getAxisGroup()
Gets the axis group to which this series group belongs.
|
ChartAxis |
getAxisX()
Provides access to properties of the X axis of this series group.
|
ChartAxis |
getAxisY()
Provides access to properties of the Y axis of this series group.
|
int |
getBubbleScale()
Gets the size of the bubbles as a percentage of their default size.
|
int |
getDoughnutHoleSize()
Gets the hole size of the parent doughnut chart as a percentage.
|
int |
getFirstSliceAngle()
Gets the angle, in degrees, of the first slice of the parent pie chart.
|
int |
getGapWidth()
Gets the percentage of gap width between chart elements.
|
int |
getOverlap()
Gets the percentage of how much the series bars or columns overlap.
|
int |
getSecondSectionSize()
Gets the size of the pie chart secondary section as a percentage.
|
ChartSeriesCollection |
getSeries()
Gets a collection of series that belong to this series group.
|
int |
getSeriesType()
Gets the type of chart series included in this group.
|
void |
setAxisGroup(int value)
Sets the axis group to which this series group belongs.
|
void |
setBubbleScale(int value)
Sets the size of the bubbles as a percentage of their default size.
|
void |
setDoughnutHoleSize(int value)
Sets the hole size of the parent doughnut chart as a percentage.
|
void |
setFirstSliceAngle(int value)
Sets the angle, in degrees, of the first slice of the parent pie chart.
|
void |
setGapWidth(int value)
Sets the percentage of gap width between chart elements.
|
void |
setOverlap(int value)
Sets the percentage of how much the series bars or columns overlap.
|
void |
setSecondSectionSize(int value)
Sets the size of the pie chart secondary section as a percentage.
|
public int getSeriesType()
Examples:
Shows how to work with the secondary axis of chart.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Shape shape = builder.insertChart(ChartType.LINE, 450.0, 250.0);
Chart chart = shape.getChart();
ChartSeriesCollection series = chart.getSeries();
// Delete default generated series.
series.clear();
String[] categories = new String[] { "Category 1", "Category 2", "Category 3" };
series.add("Series 1 of primary series group", categories, new double[] { 2.0, 3.0, 4.0 });
series.add("Series 2 of primary series group", categories, new double[] { 5.0, 2.0, 3.0 });
// Create an additional series group, also of the line type.
ChartSeriesGroup newSeriesGroup = chart.getSeriesGroups().add(ChartSeriesType.LINE);
// Specify the use of secondary axes for the new series group.
newSeriesGroup.setAxisGroup(AxisGroup.SECONDARY);
// Hide the secondary X axis.
newSeriesGroup.getAxisX().setHidden(true);
// Define title of the secondary Y axis.
newSeriesGroup.getAxisY().getTitle().setShow(true);
newSeriesGroup.getAxisY().getTitle().setText("Secondary Y axis");
Assert.assertEquals(ChartSeriesType.LINE, newSeriesGroup.getSeriesType());
// Add a series to the new series group.
ChartSeries series3 =
newSeriesGroup.getSeries().add("Series of secondary series group", categories, new double[] { 13.0, 11.0, 16.0 });
series3.getFormat().getStroke().setWeight(3.5);
doc.save(getArtifactsDir() + "Charts.SecondaryAxis.docx");
ChartSeriesType constants.public int getAxisGroup()
Examples:
Shows how to work with the secondary axis of chart.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Shape shape = builder.insertChart(ChartType.LINE, 450.0, 250.0);
Chart chart = shape.getChart();
ChartSeriesCollection series = chart.getSeries();
// Delete default generated series.
series.clear();
String[] categories = new String[] { "Category 1", "Category 2", "Category 3" };
series.add("Series 1 of primary series group", categories, new double[] { 2.0, 3.0, 4.0 });
series.add("Series 2 of primary series group", categories, new double[] { 5.0, 2.0, 3.0 });
// Create an additional series group, also of the line type.
ChartSeriesGroup newSeriesGroup = chart.getSeriesGroups().add(ChartSeriesType.LINE);
// Specify the use of secondary axes for the new series group.
newSeriesGroup.setAxisGroup(AxisGroup.SECONDARY);
// Hide the secondary X axis.
newSeriesGroup.getAxisX().setHidden(true);
// Define title of the secondary Y axis.
newSeriesGroup.getAxisY().getTitle().setShow(true);
newSeriesGroup.getAxisY().getTitle().setText("Secondary Y axis");
Assert.assertEquals(ChartSeriesType.LINE, newSeriesGroup.getSeriesType());
// Add a series to the new series group.
ChartSeries series3 =
newSeriesGroup.getSeries().add("Series of secondary series group", categories, new double[] { 13.0, 11.0, 16.0 });
series3.getFormat().getStroke().setWeight(3.5);
doc.save(getArtifactsDir() + "Charts.SecondaryAxis.docx");
AxisGroup constants.public void setAxisGroup(int value)
Examples:
Shows how to work with the secondary axis of chart.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Shape shape = builder.insertChart(ChartType.LINE, 450.0, 250.0);
Chart chart = shape.getChart();
ChartSeriesCollection series = chart.getSeries();
// Delete default generated series.
series.clear();
String[] categories = new String[] { "Category 1", "Category 2", "Category 3" };
series.add("Series 1 of primary series group", categories, new double[] { 2.0, 3.0, 4.0 });
series.add("Series 2 of primary series group", categories, new double[] { 5.0, 2.0, 3.0 });
// Create an additional series group, also of the line type.
ChartSeriesGroup newSeriesGroup = chart.getSeriesGroups().add(ChartSeriesType.LINE);
// Specify the use of secondary axes for the new series group.
newSeriesGroup.setAxisGroup(AxisGroup.SECONDARY);
// Hide the secondary X axis.
newSeriesGroup.getAxisX().setHidden(true);
// Define title of the secondary Y axis.
newSeriesGroup.getAxisY().getTitle().setShow(true);
newSeriesGroup.getAxisY().getTitle().setText("Secondary Y axis");
Assert.assertEquals(ChartSeriesType.LINE, newSeriesGroup.getSeriesType());
// Add a series to the new series group.
ChartSeries series3 =
newSeriesGroup.getSeries().add("Series of secondary series group", categories, new double[] { 13.0, 11.0, 16.0 });
series3.getFormat().getStroke().setWeight(3.5);
doc.save(getArtifactsDir() + "Charts.SecondaryAxis.docx");
value - The axis group to which this series group belongs. The value must be one of AxisGroup constants.public ChartAxis getAxisX()
Examples:
Shows how to work with the secondary axis of chart.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Shape shape = builder.insertChart(ChartType.LINE, 450.0, 250.0);
Chart chart = shape.getChart();
ChartSeriesCollection series = chart.getSeries();
// Delete default generated series.
series.clear();
String[] categories = new String[] { "Category 1", "Category 2", "Category 3" };
series.add("Series 1 of primary series group", categories, new double[] { 2.0, 3.0, 4.0 });
series.add("Series 2 of primary series group", categories, new double[] { 5.0, 2.0, 3.0 });
// Create an additional series group, also of the line type.
ChartSeriesGroup newSeriesGroup = chart.getSeriesGroups().add(ChartSeriesType.LINE);
// Specify the use of secondary axes for the new series group.
newSeriesGroup.setAxisGroup(AxisGroup.SECONDARY);
// Hide the secondary X axis.
newSeriesGroup.getAxisX().setHidden(true);
// Define title of the secondary Y axis.
newSeriesGroup.getAxisY().getTitle().setShow(true);
newSeriesGroup.getAxisY().getTitle().setText("Secondary Y axis");
Assert.assertEquals(ChartSeriesType.LINE, newSeriesGroup.getSeriesType());
// Add a series to the new series group.
ChartSeries series3 =
newSeriesGroup.getSeries().add("Series of secondary series group", categories, new double[] { 13.0, 11.0, 16.0 });
series3.getFormat().getStroke().setWeight(3.5);
doc.save(getArtifactsDir() + "Charts.SecondaryAxis.docx");
ChartAxis value.public ChartAxis getAxisY()
Examples:
Shows how to work with the secondary axis of chart.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Shape shape = builder.insertChart(ChartType.LINE, 450.0, 250.0);
Chart chart = shape.getChart();
ChartSeriesCollection series = chart.getSeries();
// Delete default generated series.
series.clear();
String[] categories = new String[] { "Category 1", "Category 2", "Category 3" };
series.add("Series 1 of primary series group", categories, new double[] { 2.0, 3.0, 4.0 });
series.add("Series 2 of primary series group", categories, new double[] { 5.0, 2.0, 3.0 });
// Create an additional series group, also of the line type.
ChartSeriesGroup newSeriesGroup = chart.getSeriesGroups().add(ChartSeriesType.LINE);
// Specify the use of secondary axes for the new series group.
newSeriesGroup.setAxisGroup(AxisGroup.SECONDARY);
// Hide the secondary X axis.
newSeriesGroup.getAxisX().setHidden(true);
// Define title of the secondary Y axis.
newSeriesGroup.getAxisY().getTitle().setShow(true);
newSeriesGroup.getAxisY().getTitle().setText("Secondary Y axis");
Assert.assertEquals(ChartSeriesType.LINE, newSeriesGroup.getSeriesType());
// Add a series to the new series group.
ChartSeries series3 =
newSeriesGroup.getSeries().add("Series of secondary series group", categories, new double[] { 13.0, 11.0, 16.0 });
series3.getFormat().getStroke().setWeight(3.5);
doc.save(getArtifactsDir() + "Charts.SecondaryAxis.docx");
ChartAxis value.public ChartSeriesCollection getSeries()
Examples:
Shows how to work with the secondary axis of chart.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Shape shape = builder.insertChart(ChartType.LINE, 450.0, 250.0);
Chart chart = shape.getChart();
ChartSeriesCollection series = chart.getSeries();
// Delete default generated series.
series.clear();
String[] categories = new String[] { "Category 1", "Category 2", "Category 3" };
series.add("Series 1 of primary series group", categories, new double[] { 2.0, 3.0, 4.0 });
series.add("Series 2 of primary series group", categories, new double[] { 5.0, 2.0, 3.0 });
// Create an additional series group, also of the line type.
ChartSeriesGroup newSeriesGroup = chart.getSeriesGroups().add(ChartSeriesType.LINE);
// Specify the use of secondary axes for the new series group.
newSeriesGroup.setAxisGroup(AxisGroup.SECONDARY);
// Hide the secondary X axis.
newSeriesGroup.getAxisX().setHidden(true);
// Define title of the secondary Y axis.
newSeriesGroup.getAxisY().getTitle().setShow(true);
newSeriesGroup.getAxisY().getTitle().setText("Secondary Y axis");
Assert.assertEquals(ChartSeriesType.LINE, newSeriesGroup.getSeriesType());
// Add a series to the new series group.
ChartSeries series3 =
newSeriesGroup.getSeries().add("Series of secondary series group", categories, new double[] { 13.0, 11.0, 16.0 });
series3.getFormat().getStroke().setWeight(3.5);
doc.save(getArtifactsDir() + "Charts.SecondaryAxis.docx");
public int getOverlap()
Remarks:
Applies to series groups of all bar and column types.
The range of acceptable values is from -100 to 100 inclusive. A value of 0 indicates that there is no space between bars/columns. If the value is -100, the distance between bars/columns is equal to their width. A value of 100 means that the bars/columns overlap completely.
Examples:
Show how to configure gap width and overlap.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Shape shape = builder.insertChart(ChartType.COLUMN, 450.0, 250.0);
ChartSeriesGroup seriesGroup = shape.getChart().getSeriesGroups().get(0);
// Set column gap width and overlap.
seriesGroup.setGapWidth(450);
seriesGroup.setOverlap(-75);
doc.save(getArtifactsDir() + "Charts.ConfigureGapOverlap.docx");
public void setOverlap(int value)
Remarks:
Applies to series groups of all bar and column types.
The range of acceptable values is from -100 to 100 inclusive. A value of 0 indicates that there is no space between bars/columns. If the value is -100, the distance between bars/columns is equal to their width. A value of 100 means that the bars/columns overlap completely.
Examples:
Show how to configure gap width and overlap.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Shape shape = builder.insertChart(ChartType.COLUMN, 450.0, 250.0);
ChartSeriesGroup seriesGroup = shape.getChart().getSeriesGroups().get(0);
// Set column gap width and overlap.
seriesGroup.setGapWidth(450);
seriesGroup.setOverlap(-75);
doc.save(getArtifactsDir() + "Charts.ConfigureGapOverlap.docx");
value - The percentage of how much the series bars or columns overlap.public int getGapWidth()
Remarks:
Applies only to series groups of the bar, column, pie-of-bar, pie-of-pie, histogram, box&whisker, waterfall and funnel types.
The range of acceptable values is from 0 to 500 inclusive. For bar/column-based series groups, the property represents the space between bar clusters as a percentage of their width. For pie-of-pie and bar-of-pie charts, this is the space between the primary and secondary sections of the chart.
Examples:
Show how to configure gap width and overlap.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Shape shape = builder.insertChart(ChartType.COLUMN, 450.0, 250.0);
ChartSeriesGroup seriesGroup = shape.getChart().getSeriesGroups().get(0);
// Set column gap width and overlap.
seriesGroup.setGapWidth(450);
seriesGroup.setOverlap(-75);
doc.save(getArtifactsDir() + "Charts.ConfigureGapOverlap.docx");
public void setGapWidth(int value)
Remarks:
Applies only to series groups of the bar, column, pie-of-bar, pie-of-pie, histogram, box&whisker, waterfall and funnel types.
The range of acceptable values is from 0 to 500 inclusive. For bar/column-based series groups, the property represents the space between bar clusters as a percentage of their width. For pie-of-pie and bar-of-pie charts, this is the space between the primary and secondary sections of the chart.
Examples:
Show how to configure gap width and overlap.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Shape shape = builder.insertChart(ChartType.COLUMN, 450.0, 250.0);
ChartSeriesGroup seriesGroup = shape.getChart().getSeriesGroups().get(0);
// Set column gap width and overlap.
seriesGroup.setGapWidth(450);
seriesGroup.setOverlap(-75);
doc.save(getArtifactsDir() + "Charts.ConfigureGapOverlap.docx");
value - The percentage of gap width between chart elements.public int getBubbleScale()
Remarks:
Applies only to series groups of the ChartSeriesType.BUBBLE and ChartSeriesType.BUBBLE_3_D types.
The range of acceptable values is from 0 to 300 inclusive. The default value is 100.
Examples:
Show how to set size of the bubbles.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Insert a bubble 3D chart.
Shape shape = builder.insertChart(ChartType.BUBBLE_3_D, 450.0, 250.0);
ChartSeriesGroup seriesGroup = shape.getChart().getSeriesGroups().get(0);
// Set bubble scale to 200%.
seriesGroup.setBubbleScale(200);
doc.save(getArtifactsDir() + "Charts.BubbleScale.docx");
public void setBubbleScale(int value)
Remarks:
Applies only to series groups of the ChartSeriesType.BUBBLE and ChartSeriesType.BUBBLE_3_D types.
The range of acceptable values is from 0 to 300 inclusive. The default value is 100.
Examples:
Show how to set size of the bubbles.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Insert a bubble 3D chart.
Shape shape = builder.insertChart(ChartType.BUBBLE_3_D, 450.0, 250.0);
ChartSeriesGroup seriesGroup = shape.getChart().getSeriesGroups().get(0);
// Set bubble scale to 200%.
seriesGroup.setBubbleScale(200);
doc.save(getArtifactsDir() + "Charts.BubbleScale.docx");
value - The size of the bubbles as a percentage of their default size.public int getFirstSliceAngle()
Remarks:
Applies to series groups of the ChartSeriesType.PIE, ChartSeriesType.PIE_3_D and ChartSeriesType.DOUGHNUT types.
The range of acceptable values is from 0 to 360 inclusive. The default value is 0.
Examples:
Shows how to create and format Doughnut chart.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Shape shape = builder.insertChart(ChartType.DOUGHNUT, 400.0, 400.0);
Chart chart = shape.getChart();
// Delete the default generated series.
chart.getSeries().clear();
String[] categories = new String[] { "Category 1", "Category 2", "Category 3" };
chart.getSeries().add("Series 1", categories, new double[] { 4.0, 2.0, 5.0 });
// Format the Doughnut chart.
ChartSeriesGroup seriesGroup = chart.getSeriesGroups().get(0);
seriesGroup.setDoughnutHoleSize(10);
seriesGroup.setFirstSliceAngle(270);
doc.save(getArtifactsDir() + "Charts.DoughnutChart.docx");
public void setFirstSliceAngle(int value)
Remarks:
Applies to series groups of the ChartSeriesType.PIE, ChartSeriesType.PIE_3_D and ChartSeriesType.DOUGHNUT types.
The range of acceptable values is from 0 to 360 inclusive. The default value is 0.
Examples:
Shows how to create and format Doughnut chart.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Shape shape = builder.insertChart(ChartType.DOUGHNUT, 400.0, 400.0);
Chart chart = shape.getChart();
// Delete the default generated series.
chart.getSeries().clear();
String[] categories = new String[] { "Category 1", "Category 2", "Category 3" };
chart.getSeries().add("Series 1", categories, new double[] { 4.0, 2.0, 5.0 });
// Format the Doughnut chart.
ChartSeriesGroup seriesGroup = chart.getSeriesGroups().get(0);
seriesGroup.setDoughnutHoleSize(10);
seriesGroup.setFirstSliceAngle(270);
doc.save(getArtifactsDir() + "Charts.DoughnutChart.docx");
value - The angle, in degrees, of the first slice of the parent pie chart.public int getDoughnutHoleSize()
Remarks:
Applies only to series groups of the ChartSeriesType.DOUGHNUT type.
The range of acceptable values is from 0 to 90 inclusive. The default value is 75.
Examples:
Shows how to create and format Doughnut chart.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Shape shape = builder.insertChart(ChartType.DOUGHNUT, 400.0, 400.0);
Chart chart = shape.getChart();
// Delete the default generated series.
chart.getSeries().clear();
String[] categories = new String[] { "Category 1", "Category 2", "Category 3" };
chart.getSeries().add("Series 1", categories, new double[] { 4.0, 2.0, 5.0 });
// Format the Doughnut chart.
ChartSeriesGroup seriesGroup = chart.getSeriesGroups().get(0);
seriesGroup.setDoughnutHoleSize(10);
seriesGroup.setFirstSliceAngle(270);
doc.save(getArtifactsDir() + "Charts.DoughnutChart.docx");
public void setDoughnutHoleSize(int value)
Remarks:
Applies only to series groups of the ChartSeriesType.DOUGHNUT type.
The range of acceptable values is from 0 to 90 inclusive. The default value is 75.
Examples:
Shows how to create and format Doughnut chart.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Shape shape = builder.insertChart(ChartType.DOUGHNUT, 400.0, 400.0);
Chart chart = shape.getChart();
// Delete the default generated series.
chart.getSeries().clear();
String[] categories = new String[] { "Category 1", "Category 2", "Category 3" };
chart.getSeries().add("Series 1", categories, new double[] { 4.0, 2.0, 5.0 });
// Format the Doughnut chart.
ChartSeriesGroup seriesGroup = chart.getSeriesGroups().get(0);
seriesGroup.setDoughnutHoleSize(10);
seriesGroup.setFirstSliceAngle(270);
doc.save(getArtifactsDir() + "Charts.DoughnutChart.docx");
value - The hole size of the parent doughnut chart as a percentage.public int getSecondSectionSize()
Remarks:
Applies to series groups of the ChartSeriesType.PIE_OF_PIE and ChartSeriesType.PIE_OF_BAR types.
The range of acceptable values is from 5 to 200 inclusive. The default value is 75.
Examples:
Shows how to create and format pie of Pie chart.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Shape shape = builder.insertChart(ChartType.PIE_OF_PIE, 440.0, 300.0);
Chart chart = shape.getChart();
// Delete the default generated series.
chart.getSeries().clear();
String[] categories = new String[] { "Category 1", "Category 2", "Category 3", "Category 4" };
chart.getSeries().add("Series 1", categories, new double[] { 11.0, 8.0, 4.0, 3.0 });
// Format the Pie of Pie chart.
ChartSeriesGroup seriesGroup = chart.getSeriesGroups().get(0);
seriesGroup.setGapWidth(10);
seriesGroup.setSecondSectionSize(77);
doc.save(getArtifactsDir() + "Charts.PieOfPieChart.docx");
public void setSecondSectionSize(int value)
Remarks:
Applies to series groups of the ChartSeriesType.PIE_OF_PIE and ChartSeriesType.PIE_OF_BAR types.
The range of acceptable values is from 5 to 200 inclusive. The default value is 75.
Examples:
Shows how to create and format pie of Pie chart.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Shape shape = builder.insertChart(ChartType.PIE_OF_PIE, 440.0, 300.0);
Chart chart = shape.getChart();
// Delete the default generated series.
chart.getSeries().clear();
String[] categories = new String[] { "Category 1", "Category 2", "Category 3", "Category 4" };
chart.getSeries().add("Series 1", categories, new double[] { 11.0, 8.0, 4.0, 3.0 });
// Format the Pie of Pie chart.
ChartSeriesGroup seriesGroup = chart.getSeriesGroups().get(0);
seriesGroup.setGapWidth(10);
seriesGroup.setSecondSectionSize(77);
doc.save(getArtifactsDir() + "Charts.PieOfPieChart.docx");
value - The size of the pie chart secondary section as a percentage.