The requested page is not available for the requested platform. You are viewing the content for Default platform.

ChartView Class

Visualizes data in the Cartesian coordinate system.

Namespace: DevExpress.XamarinForms.Charts

Assembly: DevExpress.XamarinForms.Charts.dll

Declaration

public class ChartView :
    ChartBaseView

Remarks

This view supports a wide variety of Cartesian series types and allows you to display data as any of the basic chart types or combination of different series views.

ChartView's properties allow you to add data series to a chart, configure chart axes, specify chart elements (legend, series labels and hints), and customize the chart appearance.

Chart View Elements

Chart Series

A chart visualizes data which series provide. Each series defines data appearance and behavior. ChartView supports different series types you can use to show data as areas, bars, points, bubbles, lines, etc.

Show Supported Series Types

Chart

Series Type

Area

AreaSeries

Displays data as filled areas on a chart, with each data point as a peak or hollow in this filled area.

Stacked Area

StackedAreaSeries

Displays data as areas on a chart, so that each data point value is aggregated with values of the underlying data points.

Full Stacked Area Series

FullStackedAreaSeries

Displays data as areas on a chart, so that each data point value is stacked with values of all the other corresponding data points and the total area is always the full area of the chart diagram.

Step Area Series

StepAreaSeries

Displays data as filled areas on a chart, with data points connected by horizontal and vertical lines.

Bar Series

BarSeries

Displays data as individual bars grouped by arguments, and each bar height is determined by the data value.

Stacked Bar Series

StackedBarSeries

Displays data as bars stacked by arguments, so that each stacked bar height is determined by the total of all the series values for the argument.

Full Stacked Bar Series

FullStackedBarSeries

Displays data as bars stacked by arguments, so that each stacked bar height is always the full height of the chart diagram and series values are displayed as percentages of a bar.

Side-By-Side Stacked Bar Series

SideBySideStackedBarSeries

Displays data as bars stacked according to the StackedGroup property value and grouped by arguments.

Side-By-Side Full Stacked Bar Series

SideBySideFullStackedBarSeries

Displays data as bars stacked according to the StackedGroup property value and grouped by arguments.

Point Series

PointSeries

Displays data as a collection of points.

Line Series

LineSeries

Displays data as points connected by a line.

Step Line Series

StepLineSeries

Displays data as points connected by horizontal and vertical lines.

Scatter Line Series

ScatterLineSeries

Displays data as a collection of points connected by a line, in the order they were indexed (opposite to LineSeries that automatically sorts all series points within the collection by their arguments).

Bubble Series

BubbleSeries

Displays three-dimensional data as a collection of bubbles, so that each bubble position visualizes the first two dimensions and the bubble size is the third dimension.

Stock Series

StockSeries

Displays an Open-High-Low-Close typical financial series so that each data point consists of a vertical line indicating the price range over one unit of time, and the left and right tick marks showing the opening and closing prices for that time period, respectively.

Candle Stick Series

CandleStickSeries

Displays an Open-High-Low-Close typical financial series so that each data point consists of a vertical line indicating the price range over one unit of time and a rectangle showing the opening and closing prices for that time period.

Note

To display Pie series, use the PieChartView view instead.

To add a series to a chart, add a series object of a type the ChartView supports to the ChartView.Series collection.

using DevExpress.XamarinForms.Charts;
// ...

chartView.Series.Add(new LineSeries { Data = new SeriesData() });

// ...
class SeriesData : IXYSeriesData {
    List<SeriesDataItem> data;

    public SeriesData() {
        data = new List<SeriesDataItem>() {
            new SeriesDataItem(new DateTime(1950, 1, 1), 227),
            new SeriesDataItem(new DateTime(1970, 1, 1), 361),
            new SeriesDataItem(new DateTime(1990, 1, 1), 623),
            new SeriesDataItem(new DateTime(2010, 1, 1), 982),,
            new SeriesDataItem(new DateTime(2030, 1, 1), 1416),
            new SeriesDataItem(new DateTime(2050, 1, 1), 1937)
        };
    }

    public int GetDataCount() => data.Count;
    public SeriesDataType GetDataType() => SeriesDataType.DateTime;
    public DateTime GetDateTimeArgument(int index) => data[index].Year;
    public object GetKey(int index) => null;
    public double GetValue(DevExpress.XamarinForms.Charts.ValueType valueType, int index) => data[index].Value;
    double IXYSeriesData.GetNumericArgument(int index) => 0;
    string IXYSeriesData.GetQualitativeArgument(int index) => string.Empty;
}

class SeriesDataItem {
    public DateTime Year { get; private set; }
    public double Value { get; private set; }

    public SeriesDataItem(DateTime year, double value) {
        this.Year = year;
        this.Value = value;
    }
}

Axes

To customize a chart's axis of arguments (X-axis) or axis of values (Y-axis), create an axis object of the supported type, configure it, and assign it to the ChartView.AxisX or ChartView.AxisY property.

Axis

Supported Types

X-Axis

DateTimeAxisX

NumericAxisX

QualitativeAxisX

Y-Axis

NumericAxisY

Inheritance

Implements

DevExpress.XamarinForms.Charts.Internal.IChartElement
DevExpress.XamarinForms.Core.Internal.IBindingContextParent
See Also