WPF

Upgrade Guide User Guide Demos Support Forums Download
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Interface IChartData - WPF API Reference | Syncfusion

    Show / Hide Table of Contents

    Interface IChartData

    Represents strongly typed Chart datapoints collection.

    Inherited Members
    System.IDisposable.Dispose()
    Namespace: Syncfusion.Windows.Chart
    Assembly: Syncfusion.Chart.Wpf.dll
    Syntax
    public interface IChartData : INotifyCollectionChanged, IDisposable
    Remarks

    Interface defines methods and properties that are required for proper chart building.

    Examples

    This sample demonstrates how interface can be implemented: C#:

    class CustomPoint : IChartDataPoint
    {
    public CustomPoint(double X, double Y)
    {
    this.X = X;
    this.Y = Y;
    this.Values = new double[] {Y};
    }
    public double X {get; set;}
    public double Y {get; set;}
    public double[] Values {get; set;}
    public bool IsEmpty {get; set;}
    public bool Visible {get; set;}
    public ChartSegment ParentSegment {get; set;}
    public object Item {get; set;}
    public object Clone()
    {
    CustomPoint customPoint = new CustomPoint(this.X, this.Y);
    //...
    // Filling proper fields.
    //...
    return customPoint;
    }
    }
    // Custom collection strongly typed as CustomPoint that implements IChartData.
    class CustomChartPointsCollection : ObservableCollection <CustomPoint>,
    IChartData
    {
    public new IChartDataPoint this[int index]
    {
    get { return base[index]; }
    }
    public ChartValueType XValueType { get; set; }
    }
    //Using classes
    //...
    //Creating a new chart1 with area and series.
    //...
    CustomChartPointsCollection customCollection = new
    CustomChartPointsCollection();
    customCollection.Add(new CustomPoint(1, 3));
    customCollection.Add(new CustomPoint(2, 5));
    customCollection.Add(new CustomPoint(3, 2));
    customCollection.Add(new CustomPoint(4, 8));
    chart1.Areas[0].Series[0].Data = customCollection;
    XAML:

    This type is not intended to be used from XAML.

    Properties

    ChartXValueType

    Gets or Sets the type of the Chart X value

    Declaration
    ChartValueType ChartXValueType { get; set; }
    Property Value
    Type Description
    ChartValueType

    Count

    Gets the points count.

    Declaration
    int Count { get; }
    Property Value
    Type Description
    System.Int32

    Total points count

    Item[Int32]

    Gets the IChartDataPoint at the specified index.

    Declaration
    IChartDataPoint this[int index] { get; }
    Parameters
    Type Name Description
    System.Int32 index

    The index value

    Property Value
    Type Description
    IChartDataPoint

    IChartDataPoint point at specified index.

    XValueType

    Gets the type of the X value.

    Declaration
    ChartValueType XValueType { get; }
    Property Value
    Type Description
    ChartValueType

    Value can be set from one of ChartValueType enumeration.

    See Also

    ChartListData
    Back to top Generated by DocFX
    Copyright © 2001 - 2021 Syncfusion Inc. All Rights Reserved