ChartFormat class
ChartFormat class
Represents the formatting of a chart element. To learn more, visit the Working with Charts documentation article.
Properties
Name | Description |
---|---|
fill | Gets fill formatting for the parent chart element. |
isDefined | Gets a flag indicating whether any format is defined. |
shapeType | Gets or sets the shape type of the parent chart element. |
stroke | Gets line formatting for the parent chart element. |
Methods
Name | Description |
---|---|
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
- module Aspose.Words.Drawing.Charts