ChartDataTable

ChartDataTable class

Allows to specify properties of a chart data table.

public class ChartDataTable

Properties

NameDescription
Font { get; }Provides access to font formatting of the data table.
Format { get; }Provides access to fill of text background and border formatting of the data table.
HasHorizontalBorder { get; set; }Gets or sets a flag indicating whether a horizontal border of the data table is displayed. The default value is true.
HasLegendKeys { get; set; }Gets or sets a flag indicating whether legend keys are displayed in the data table. The default value is true.
HasOutlineBorder { get; set; }Gets 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.
HasVerticalBorder { get; set; }Gets or sets a flag indicating whether a vertical border of the data table is displayed. The default value is true.
Show { get; set; }Gets or sets a flag indicating whether the data table will be shown for the chart. Default value is false.

Examples

Shows how to show data table with chart series data.

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

Shape shape = builder.InsertChart(ChartType.Column, 432, 252);
Chart chart = shape.Chart;

ChartSeriesCollection series = chart.Series;
series.Clear();
double[] xValues = new double[] { 2020, 2021, 2022, 2023 };
series.Add("Series1", xValues, new double[] { 5, 11, 2, 7 });
series.Add("Series2", xValues, new double[] { 6, 5.5, 7, 7.8 });
series.Add("Series3", xValues, new double[] { 10, 8, 7, 9 });

ChartDataTable dataTable = chart.DataTable;
dataTable.Show = true;

dataTable.HasLegendKeys = false;
dataTable.HasHorizontalBorder = false;
dataTable.HasVerticalBorder = false;

dataTable.Font.Italic = true;
dataTable.Format.Stroke.Weight = 1;
dataTable.Format.Stroke.DashStyle = DashStyle.ShortDot;
dataTable.Format.Stroke.Color = Color.DarkBlue;

doc.Save(ArtifactsDir + "Charts.DataTable.docx");

See Also