java.lang.Object
com.aspose.words.ChartYValueCollection
- All Implemented Interfaces:
- java.lang.Iterable
public class ChartYValueCollection
- extends java.lang.Object
Represents a collection of Y values for a chart series.
All items of the collection other than null must have the same ChartYValue.ValueType.
The collection allows only changing Y values. To add or insert new values to a chart series, or remove values,
the appropriate methods of the ChartSeries class can be used.
Example:
Shows how to get chart series data.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder();
Shape shape = builder.insertChart(ChartType.COLUMN, 432.0, 252.0);
Chart chart = shape.getChart();
ChartSeries series = chart.getSeries().get(0);
double minValue = Double.MAX_VALUE;
int minValueIndex = 0;
double maxValue = -Double.MAX_VALUE;
int maxValueIndex = 0;
for (int i = 0; i < series.getYValues().getCount(); i++)
{
// Clear individual format of all data points.
// Data points and data values are one-to-one in column charts.
series.getDataPoints().get(i).clearFormat();
// Get Y value.
double yValue = series.getYValues().get(i).getDoubleValue();
if (yValue < minValue)
{
minValue = yValue;
minValueIndex = i;
}
if (yValue > maxValue)
{
maxValue = yValue;
maxValueIndex = i;
}
}
// Change colors of the max and min values.
series.getDataPoints().get(minValueIndex).getFormat().getFill().setForeColor(Color.RED);
series.getDataPoints().get(maxValueIndex).getFormat().getFill().setForeColor(Color.GREEN);
doc.save(getArtifactsDir() + "Charts.GetChartSeriesData.docx");
- See Also:
- ChartSeries.add(com.aspose.words.ChartXValue), ChartSeries.add(com.aspose.words.ChartXValue,com.aspose.words.ChartYValue), ChartSeries.add(com.aspose.words.ChartXValue,com.aspose.words.ChartYValue,double), ChartSeries.insert(int,com.aspose.words.ChartXValue), ChartSeries.insert(int,com.aspose.words.ChartXValue,com.aspose.words.ChartYValue), ChartSeries.insert(int,com.aspose.words.ChartXValue,com.aspose.words.ChartYValue,double), ChartSeries.remove(int)
|
Property Getters/Setters Summary |
int | getCount() | |
|
Gets the number of items in this collection.
|
ChartYValue | get(int index) | |
void | set(int index, ChartYValue value) | |
|
Gets or sets the Y value at the specified index.
|
|
Property Getters/Setters Detail |
getCount | |
public int getCount()
|
-
Gets the number of items in this collection.
-
Gets or sets the Y value at the specified index.
Empty values are represented as null.
iterator | |
public java.util.Iterator<ChartYValue> iterator() |
-
Returns an enumerator object.
See Also:
Aspose.Words Documentation - the home page for the Aspose.Words Product Documentation.
Aspose.Words Support Forum - our preferred method of support.