Aspose::Words::Drawing::Charts::ChartTitle class

ChartTitle class

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

class ChartTitle : public System::Object


get_Overlay()Determines whether other chart elements shall be allowed to overlap title. By default overlay is false.
get_Show()Determines whether the title shall be shown for this chart. Default value is true.
get_Text()Gets or sets the text of the chart title. If null or empty value is specified, auto generated title will be shown.
GetType() const override
Is(const System::TypeInfo&) const override
set_Overlay(bool)Setter for Aspose::Words::Drawing::Charts::ChartTitle::get_Overlay.
set_Show(bool)Setter for Aspose::Words::Drawing::Charts::ChartTitle::get_Show.
set_Text(const System::String&)Setter for Aspose::Words::Drawing::Charts::ChartTitle::get_Text.
static Type()


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.

// Set the "Overlay" property to "true" Give other chart elements more room by allowing them to overlap the title

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

See Also