Aspose::Words::Drawing::Charts::ChartDataTable class

ChartDataTable class

Allows to specify properties of a chart data table.

class ChartDataTable : public Aspose::Words::Drawing::Charts::Core::IChartItemTextProperties,
                       public Aspose::Words::Drawing::Charts::Core::IChartFormatSource

Methods

MethodDescription
get_Font()Provides access to font formatting of the data table.
get_Format()Provides access to fill of text background and border formatting of the data table.
get_HasHorizontalBorder() constGets or sets a flag indicating whether a horizontal border of the data table is displayed. The default value is true.
get_HasLegendKeys() constGets or sets a flag indicating whether legend keys are displayed in the data table. The default value is true.
get_HasOutlineBorder() constGets or sets a flag indicating whether an outline border, that is, a border around series and category names, is displayed. The default value is true.
get_HasVerticalBorder() constGets or sets a flag indicating whether a vertical border of the data table is displayed. The default value is true.
get_Show() constGets or sets a flag indicating whether the data table will be shown for the chart. Default value is false.
GetType() const override
Is(const System::TypeInfo&) const override
set_HasHorizontalBorder(bool)Setter for Aspose::Words::Drawing::Charts::ChartDataTable::get_HasHorizontalBorder.
set_HasLegendKeys(bool)Setter for Aspose::Words::Drawing::Charts::ChartDataTable::get_HasLegendKeys.
set_HasOutlineBorder(bool)Setter for Aspose::Words::Drawing::Charts::ChartDataTable::get_HasOutlineBorder.
set_HasVerticalBorder(bool)Setter for Aspose::Words::Drawing::Charts::ChartDataTable::get_HasVerticalBorder.
set_Show(bool)Setter for Aspose::Words::Drawing::Charts::ChartDataTable::get_Show.
static Type()

Examples

Shows how to show data table with chart series 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::ChartSeriesCollection> series = chart->get_Series();
series->Clear();
auto xValues = System::MakeArray<double>({2020, 2021, 2022, 2023});
series->Add(u"Series1", xValues, System::MakeArray<double>({5, 11, 2, 7}));
series->Add(u"Series2", xValues, System::MakeArray<double>({6, 5.5, 7, 7.8}));
series->Add(u"Series3", xValues, System::MakeArray<double>({10, 8, 7, 9}));

System::SharedPtr<Aspose::Words::Drawing::Charts::ChartDataTable> dataTable = chart->get_DataTable();
dataTable->set_Show(true);

dataTable->set_HasLegendKeys(false);
dataTable->set_HasHorizontalBorder(false);
dataTable->set_HasVerticalBorder(false);
dataTable->set_HasOutlineBorder(false);

dataTable->get_Font()->set_Italic(true);
dataTable->get_Format()->get_Stroke()->set_Weight(1);
dataTable->get_Format()->get_Stroke()->set_DashStyle(Aspose::Words::Drawing::DashStyle::ShortDot);
dataTable->get_Format()->get_Stroke()->set_Color(System::Drawing::Color::get_DarkBlue());

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

See Also