Aspose::Words::Drawing::Charts::Chart class

Chart class

Provides access to the chart shape properties. To learn more, visit the Working with Charts documentation article.

class Chart : public Aspose::Words::Drawing::Charts::Core::IChartFormatSource

Methods

MethodDescription
get_Axes()Gets a collection of all axes of this chart.
get_AxisX()Provides access to properties of the X axis of the chart.
get_AxisY()Provides access to properties of the Y axis of the chart.
get_AxisZ()Provides access to properties of the Z axis of the chart.
get_DataTable()
get_Format()
get_Legend()Provides access to the chart legend properties.
get_Series()Provides access to series collection.
get_SeriesGroups()
get_SourceFullName()Gets the path and name of an xls/xlsx file this chart is linked to.
get_Title()Provides access to the chart title properties.
GetType() const override
Is(const System::TypeInfo&) const override
set_SourceFullName(const System::String&)Gets the path and name of an xls/xlsx file this chart is linked to.
static Type()

Examples

Shows how to insert a chart and set a title.

auto doc = MakeObject<Document>();
auto builder = MakeObject<DocumentBuilder>(doc);

// Insert a chart shape with a document builder and get its chart.
SharedPtr<Shape> chartShape = builder->InsertChart(ChartType::Bar, 400, 300);
SharedPtr<Chart> chart = chartShape->get_Chart();

// Use the "Title" property to give our chart a title, which appears at the top center of the chart area.
SharedPtr<ChartTitle> title = chart->get_Title();
title->set_Text(u"My Chart");

// Set the "Show" property to "true" to make the title visible.
title->set_Show(true);

// Set the "Overlay" property to "true" Give other chart elements more room by allowing them to overlap the title
title->set_Overlay(true);

doc->Save(ArtifactsDir + u"Charts.ChartTitle.docx");

See Also