maui-devexpress-dot-maui-dot-charts-a1c8a7f7.md
An interface that a point or segment colorizer should implement to specify legend items.
Namespace : DevExpress.Maui.Charts
Assembly : DevExpress.Maui.Charts.dll
NuGet Package : DevExpress.Maui.Charts
public interface ILegendItemProvider
The following members return ILegendItemProvider objects:
A colorizer class that implements the ILegendItemProvider interface should implement the following methods:
In this example, the bar chart visualizes GDP values for the G20 and colors data points according to which part of the world the country belongs.
Create a data source – a list of objects each of which stores a country’s name, GDP value, and the part of the world (region) where the country is located.
Create a class (ColorizerByRegion, in this example) that implements the IIndexBasedCustomPointColorizer interface. Specify a color for each region and implement the IIndexBasedCustomPointColorizer.GetColor method that returns a color for each data point depending on the Region data member’s value.
This class should also implement the IIndexBasedCustomPointColorizer.GetLegendItemProvider method and the ILegendItemProvider interface to specify legend items that show region colors.
Assign a ColorizerByRegion object to the BarSeries.PointColorizer property.
YieldIfNotNull<ILegendItemProvider>()
See Also