Back to Devexpress

IIndexBasedCustomPointColorizer Interface

mobilecontrols-devexpress-dot-xamarinforms-dot-charts-301c4e9b.md

latest2.3 KB
Original Source

IIndexBasedCustomPointColorizer Interface

An interface that should be implemented by a custom point colorizer that has access to indexes of the data source items corresponding to series points.

Namespace : DevExpress.XamarinForms.Charts

Assembly : DevExpress.XamarinForms.Charts.dll

NuGet Package : DevExpress.XamarinForms.Charts

Declaration

csharp
public interface IIndexBasedCustomPointColorizer :
    IPointColorizer,
    IStackedPointColorizer,
    IWeightedPointColorizer,
    IRangePointColorizer

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

IIndexBasedCustomPointColorizer Members

DevExpress.XamarinForms.Charts Namespace