ChartXValue class
ChartXValue class
Represents an X value for a chart series.
Remarks
This class contains a number of static methods for creating an X value of a particular type. The ChartXValue.valueType property allows you to determine the type of an existing X value.
All non-null X values of a chart series must be of the same ChartXValueType type.
Properties
Name | Description |
---|---|
dateTimeValue | Gets the stored datetime value. |
doubleValue | Gets the stored numeric value. |
multilevelValue | Gets the stored multilevel value. |
stringValue | Gets the stored string value. |
timeValue | Gets the stored time value. |
valueType | Gets the type of the X value stored in the object. |
Methods
Name | Description |
---|---|
fromDateTime(value) | Creates a ChartXValue instance of the ChartXValueType.DateTime type. |
fromDouble(value) | Creates a ChartXValue instance of the ChartXValueType.Double type. |
fromMultilevelValue(value) | Creates a ChartXValue instance of the ChartXValueType.Multilevel type. |
fromString(value) | Creates a ChartXValue instance of the ChartXValueType.String type. |
fromTimeSpan(value) | Creates a ChartXValue instance of the ChartXValueType.Time type. |
Examples
Shows how to populate chart series with data.
let doc = new aw.Document();
let builder = new aw.DocumentBuilder(doc);
let shape = builder.insertChart(aw.Drawing.Charts.ChartType.Column, 432, 252);
let chart = shape.chart;
let series1 = chart.series.at(0);
// Clear X and Y values of the first series.
series1.clearValues();
// Populate the series with data.
series1.add(aw.Drawing.Charts.ChartXValue.fromDouble(3), aw.Drawing.Charts.ChartYValue.fromDouble(10), 10);
series1.add(aw.Drawing.Charts.ChartXValue.fromDouble(5), aw.Drawing.Charts.ChartYValue.fromDouble(5));
series1.add(aw.Drawing.Charts.ChartXValue.fromDouble(7), aw.Drawing.Charts.ChartYValue.fromDouble(11));
series1.add(aw.Drawing.Charts.ChartXValue.fromDouble(9));
let series2 = chart.series.at(1);
// Clear X and Y values of the second series.
series2.clear();
// Populate the series with data.
series2.add(aw.Drawing.Charts.ChartXValue.fromDouble(2), aw.Drawing.Charts.ChartYValue.fromDouble(4));
series2.add(aw.Drawing.Charts.ChartXValue.fromDouble(4), aw.Drawing.Charts.ChartYValue.fromDouble(7));
series2.add(aw.Drawing.Charts.ChartXValue.fromDouble(6), aw.Drawing.Charts.ChartYValue.fromDouble(14));
series2.add(aw.Drawing.Charts.ChartXValue.fromDouble(8), aw.Drawing.Charts.ChartYValue.fromDouble(7));
doc.save(base.artifactsDir + "Charts.PopulateChartWithData.docx");
See Also
- module Aspose.Words.Drawing.Charts