java.lang.Object
com.aspose.words.ChartSeriesGroup
public class ChartSeriesGroup
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. Example:
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");
// 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");
| Property Getters/Setters Summary | ||
|---|---|---|
int | getAxisGroup() | |
void | setAxisGroup(int value) | |
| Gets or sets the axis group to which this series group belongs. The value of the property is AxisGroup integer constant. | ||
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() | |
void | setBubbleScale(int value) | |
| Gets or sets the size of the bubbles as a percentage of their default size. | ||
int | getGapWidth() | |
void | setGapWidth(int value) | |
| Gets or sets the percentage of gap width between chart elements. | ||
int | getOverlap() | |
void | setOverlap(int value) | |
| Gets or sets the percentage of how much the series bars or columns overlap. | ||
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. The value of the property is ChartSeriesType integer constant. | ||
| Property Getters/Setters Detail |
|---|
getAxisGroup/setAxisGroup | |
public int getAxisGroup() / public void setAxisGroup(int value) | |
Example:
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");
// 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");getAxisX | |
public ChartAxis getAxisX() | |
Example:
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");
// 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");getAxisY | |
public ChartAxis getAxisY() | |
Example:
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");
// 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");getBubbleScale/setBubbleScale | |
public int getBubbleScale() / public void setBubbleScale(int value) | |
Applies only to series groups of the
The range of acceptable values is from 0 to 300 inclusive.
Example:
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");
getGapWidth/setGapWidth | |
public int getGapWidth() / public void setGapWidth(int value) | |
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.
Example:
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");
getOverlap/setOverlap | |
public int getOverlap() / public void setOverlap(int value) | |
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.
Example:
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");
getSeries | |
public ChartSeriesCollection getSeries() | |
Example:
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");
// 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");getSeriesType | |
public int getSeriesType() | |