Aspose::Words::Drawing::Charts::ChartLegendEntry class

ChartLegendEntry class

Represents a chart legend entry. To learn more, visit the Working with Charts documentation article.

class ChartLegendEntry : public Aspose::Words::Drawing::Core::Dml::IDmlExtensionListSource,
                         public Aspose::Words::Drawing::Charts::Core::IChartItemTextProperties

Methods

MethodDescription
get_Font()Provides access to the font formatting of this legend entry.
get_IsHidden() constGets or sets a value indicating whether this entry is hidden in the chart legend. The default value is false.
GetType() const override
Is(const System::TypeInfo&) const override
set_IsHidden(bool)Setter for Aspose::Words::Drawing::Charts::ChartLegendEntry::get_IsHidden.
static Type()

Remarks

A legend entry corresponds to a specific chart series or trendline.

The text of the entry is the name of the series or trendline. The text cannot be changed.

Examples

Shows how to work with a legend font.

auto doc = System::MakeObject<Aspose::Words::Document>(get_MyDir() + u"Reporting engine template - Chart series.docx");
System::SharedPtr<Aspose::Words::Drawing::Charts::Chart> chart = (System::ExplicitCast<Aspose::Words::Drawing::Shape>(doc->GetChild(Aspose::Words::NodeType::Shape, 0, true)))->get_Chart();

System::SharedPtr<Aspose::Words::Drawing::Charts::ChartLegend> chartLegend = chart->get_Legend();
// Set default font size all legend entries.
chartLegend->get_Font()->set_Size(14);
// Change font for specific legend entry.
chartLegend->get_LegendEntries()->idx_get(1)->get_Font()->set_Italic(true);
chartLegend->get_LegendEntries()->idx_get(1)->get_Font()->set_Size(12);
// Get legend entry for chart series.
System::SharedPtr<Aspose::Words::Drawing::Charts::ChartLegendEntry> legendEntry = chart->get_Series()->idx_get(0)->get_LegendEntry();

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

See Also