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.
is_definedGets a flag indicating whether any format is defined.
shape_typeGets or sets the shape type of the parent chart element.
strokeGets line formatting for the parent chart element.

Methods

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

Examples

Shows how to use chart formating.

doc = aw.Document()
builder = aw.DocumentBuilder(doc=doc)
shape = builder.insert_chart(chart_type=aw.drawing.charts.ChartType.COLUMN, width=432, height=252)
chart = shape.chart
# Delete series generated by default.
series = chart.series
series.clear()
categories = ['Category 1', 'Category 2']
series.add(series_name='Series 1', categories=categories, values=[1, 2])
series.add(series_name='Series 2', categories=categories, values=[3, 4])
# Format chart background.
chart.format.fill.solid(aspose.pydrawing.Color.dark_slate_gray)
# Hide axis tick labels.
chart.axis_x.tick_labels.position = aw.drawing.charts.AxisTickLabelPosition.NONE
chart.axis_y.tick_labels.position = aw.drawing.charts.AxisTickLabelPosition.NONE
# Format chart title.
chart.title.format.fill.solid(aspose.pydrawing.Color.light_goldenrod_yellow)
# Format axis title.
chart.axis_x.title.show = True
chart.axis_x.title.format.fill.solid(aspose.pydrawing.Color.light_goldenrod_yellow)
# Format legend.
chart.legend.format.fill.solid(aspose.pydrawing.Color.light_goldenrod_yellow)
doc.save(file_name=ARTIFACTS_DIR + 'Charts.ChartFormat.docx')

See Also