Aspose::Words::Drawing::Charts::ChartXValue class

ChartXValue class

Represents an X value for a chart series.

class ChartXValue : public System::Object

Methods

MethodDescription
Equals(System::SharedPtr<System::Object>) overrideGets a flag indicating whether the specified object is equal to the current X value object.
static FromDateTime(System::DateTime)Creates a ChartXValue instance of the DateTime type.
static FromDouble(double)Creates a ChartXValue instance of the Double type.
static FromMultilevelValue(const System::SharedPtr<Aspose::Words::Drawing::Charts::ChartMultilevelValue>&)Creates a ChartXValue instance of the Multilevel type.
static FromString(const System::String&)Creates a ChartXValue instance of the String type.
static FromTimeSpan(System::TimeSpan)Creates a ChartXValue instance of the Time type.
get_DateTimeValue() constGets the stored datetime value.
get_DoubleValue() constGets the stored numeric value.
get_MultilevelValue() constGets the stored multilevel value.
get_StringValue() constGets the stored string value.
get_TimeValue() constGets the stored time value.
get_ValueType() constGets the type of the X value stored in the object.
GetHashCode() const overrideGets a hash code for the current X value object.
GetType() const override
Is(const System::TypeInfo&) const override
static Type()

Remarks

This class contains a number of static methods for creating an X value of a particular type. The 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.

Examples

Shows how to populate chart series with data.

auto doc = System::MakeObject<Aspose::Words::Document>();
auto builder = System::MakeObject<Aspose::Words::DocumentBuilder>(doc);

System::SharedPtr<Aspose::Words::Drawing::Shape> shape = builder->InsertChart(Aspose::Words::Drawing::Charts::ChartType::Column, 432, 252);
System::SharedPtr<Aspose::Words::Drawing::Charts::Chart> chart = shape->get_Chart();
System::SharedPtr<Aspose::Words::Drawing::Charts::ChartSeries> series1 = chart->get_Series()->idx_get(0);

// Clear X and Y values of the first series.
series1->ClearValues();

// Populate the series with data.
series1->Add(Aspose::Words::Drawing::Charts::ChartXValue::FromDouble(3), Aspose::Words::Drawing::Charts::ChartYValue::FromDouble(10), 10);
series1->Add(Aspose::Words::Drawing::Charts::ChartXValue::FromDouble(5), Aspose::Words::Drawing::Charts::ChartYValue::FromDouble(5));
series1->Add(Aspose::Words::Drawing::Charts::ChartXValue::FromDouble(7), Aspose::Words::Drawing::Charts::ChartYValue::FromDouble(11));
series1->Add(Aspose::Words::Drawing::Charts::ChartXValue::FromDouble(9));

System::SharedPtr<Aspose::Words::Drawing::Charts::ChartSeries> series2 = chart->get_Series()->idx_get(1);
// Clear X and Y values of the second series.
series2->Clear();

// Populate the series with data.
series2->Add(Aspose::Words::Drawing::Charts::ChartXValue::FromDouble(2), Aspose::Words::Drawing::Charts::ChartYValue::FromDouble(4));
series2->Add(Aspose::Words::Drawing::Charts::ChartXValue::FromDouble(4), Aspose::Words::Drawing::Charts::ChartYValue::FromDouble(7));
series2->Add(Aspose::Words::Drawing::Charts::ChartXValue::FromDouble(6), Aspose::Words::Drawing::Charts::ChartYValue::FromDouble(14));
series2->Add(Aspose::Words::Drawing::Charts::ChartXValue::FromDouble(8), Aspose::Words::Drawing::Charts::ChartYValue::FromDouble(7));

doc->Save(get_ArtifactsDir() + u"Charts.PopulateChartWithData.docx");

See Also