public class ChartYValue
extends java.lang.Object
Remarks:
This class contains a number of static methods for creating an Y value of a particular type. The getValueType() property allows you to determine the type of an existing Y value.
All non-null Y values of a chart series must be of the same ChartYValueType type.
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object obj)
Gets a flag indicating whether the specified object is equal to the current Y value object.
|
static ChartYValue |
fromDateTime(java.util.Date value)
Creates a
ChartYValue instance of the ChartYValueType.DATE_TIME type. |
static ChartYValue |
fromDouble(double value)
Creates a
ChartYValue instance of the ChartYValueType.DOUBLE type. |
static ChartYValue |
fromTimeSpan(long value)
Creates a
ChartYValue instance of the ChartYValueType.TIME type. |
java.util.Date |
getDateTimeValue()
Gets the stored datetime value.
|
double |
getDoubleValue()
Gets the stored numeric value.
|
long |
getTimeValue()
Gets the stored time value.
|
int |
getValueType()
Gets the type of the Y value stored in the object.
|
int |
hashCode() |
public static ChartYValue fromDouble(double value)
ChartYValue instance of the ChartYValueType.DOUBLE type.
Examples:
Shows how to populate chart series with data.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Shape shape = builder.insertChart(ChartType.COLUMN, 432.0, 252.0);
Chart chart = shape.getChart();
ChartSeries series1 = chart.getSeries().get(0);
// Clear X and Y values of the first series.
series1.clearValues();
// Populate the series with data.
series1.add(ChartXValue.fromDouble(3.0), ChartYValue.fromDouble(10.0), 10.0);
series1.add(ChartXValue.fromDouble(5.0), ChartYValue.fromDouble(5.0));
series1.add(ChartXValue.fromDouble(7.0), ChartYValue.fromDouble(11.0));
series1.add(ChartXValue.fromDouble(9.0));
ChartSeries series2 = chart.getSeries().get(1);
// Clear X and Y values of the second series.
series2.clear();
// Populate the series with data.
series2.add(ChartXValue.fromDouble(2.0), ChartYValue.fromDouble(4.0));
series2.add(ChartXValue.fromDouble(4.0), ChartYValue.fromDouble(7.0));
series2.add(ChartXValue.fromDouble(6.0), ChartYValue.fromDouble(14.0));
series2.add(ChartXValue.fromDouble(8.0), ChartYValue.fromDouble(7.0));
doc.save(getArtifactsDir() + "Charts.PopulateChartWithData.docx");
public static ChartYValue fromDateTime(java.util.Date value)
ChartYValue instance of the ChartYValueType.DATE_TIME type.public static ChartYValue fromTimeSpan(long value)
ChartYValue instance of the ChartYValueType.TIME type.public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int getValueType()
ChartYValueType constants.public double getDoubleValue()
public java.util.Date getDateTimeValue()
public long getTimeValue()