ChartFormat class

ChartFormat class

Represents the formatting of a chart element. To learn more, visit the Working with Charts documentation article.

Properties

NameDescription
fillGets fill formatting for the parent chart element.
isDefinedGets a flag indicating whether any format is defined.
shapeTypeGets or sets the shape type of the parent chart element.
strokeGets line formatting for the parent chart element.

Methods

NameDescription
setDefaultFill()Resets the fill of the chart element to have the default value.

Examples

Shows how to use chart formating.

let doc = new aw.Document();
let builder = new aw.DocumentBuilder(doc);

let shape = builder.insertChart(aw.Drawing.Charts.ChartType.Column, 432, 252);
let chart = shape.chart;

// Delete series generated by default.
let series = chart.series;
series.clear();

let categories = [ "Category 1", "Category 2" ];
series.add("Series 1", categories, [ 1, 2 ]);
series.add("Series 2", categories, [ 3, 4 ]);

// Format chart background.
chart.format.fill.solid("#2F4F4F");

// Hide axis tick labels.
chart.axisX.tickLabels.position = aw.Drawing.Charts.AxisTickLabelPosition.None;
chart.axisY.tickLabels.position = aw.Drawing.Charts.AxisTickLabelPosition.None;

// Format chart title.
chart.title.format.fill.solid("#FFFACD");

// Format axis title.
chart.axisX.title.show = true;
chart.axisX.title.format.fill.solid("#FFFACD");

// Format legend.
chart.legend.format.fill.solid("#FFFACD");

doc.save(base.artifactsDir + "Charts.ChartFormat.docx");

See Also