Back to Devexpress

ILegendItemProvider Interface

mobilecontrols-devexpress-dot-xamarinforms-dot-charts-22d2e1dd.md

latest3.5 KB
Original Source

ILegendItemProvider Interface

An interface that a point or segment colorizer should implement to specify legend items.

Namespace : DevExpress.XamarinForms.Charts

Assembly : DevExpress.XamarinForms.Charts.dll

NuGet Package : DevExpress.XamarinForms.Charts

Declaration

csharp
public interface ILegendItemProvider

The following members return ILegendItemProvider objects:

Remarks

A colorizer class that implements the ILegendItemProvider interface should implement the following methods:

Example

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.

  1. 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.

  2. 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.

  3. Assign a ColorizerByRegion object to the BarSeries.PointColorizer property.

See Also

ILegendItemProvider Members

DevExpress.XamarinForms.Charts Namespace