DevExtreme v23.1 is now available.
Explore our newest features/capabilities and share your thoughts with us.
This demo uses custom patterns and gradients for PieChart slices.
Call the registerGradient() method to obtain a gradient ID. Specify method arguments as follows:
type
This method supports two gradient types: 'linear' and 'radial'.
options
An object for gradient options.
colors
An array of gradient colors. Each color is an object that includes color
and offset
fields. The offset
field specifies the starting point for each color.
rotationAngle
(linear gradients only)
You can use this option to rotate linear gradients.
To obtain a pattern ID, call the registerPattern() method. Specify method arguments as follows:
options
An object with pattern options.
height
Template height.
width
Template width.
template
A repeating SVG-based template that creates the required pattern.
To fill all slices with the same pattern or gradient, assign a pattern ID to series.color.fillId
. If you want to customize each slice individually, implement the customizePoint function (review this demo for more information).
Custom patterns and gradients are not limited to the PieChart. The following DevExtreme components support the use of patterns/gradients: