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. |
is_defined | Gets a flag indicating whether any format is defined. |
shape_type | Gets or sets the shape type of the parent chart element. |
stroke | Gets line formatting for the parent chart element. |
Methods
Name | Description |
---|---|
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
- module aspose.words.drawing.charts