The chart data points are defined by the DataPoint class and more specifically its inheritors. The different chart series types work with different class that derives from DataPoint. Each class contains common information about the data point - its layout slot, the related view model, label, selection state, parent series and more.
This article contains a brief information about the data point types and a reference sheet showing the DataPoint implementation used by each chart series.
The DataContext of most chart templates and styles, as ToolTipTemplate, DefaultVisualStyle, PointTemplate, etc., is an object of type DataPoint which you can use to access the view model or other information related to the data point.
The following table shows which data points are being used by the corresponding series.
|Cartesian Chart Data Points||Pie Chart Data Points||Polar Chart Data Points|
DataPoint is an abstract class used as a base by the concerete data point impelementations. The class contains information related to the element plotted in the chart. There are several classes that derive from DataPoint and they all share some common properties.
Presenter: A property of type IChartElementPresenter that holds a reference to the parent series where the data point is visualized.
LayoutSlot: A property of type RadRect that holds the rectangle where the data point is visualized. You can use it to get the size and the screen coordinates of the visual element representing the point.
DataItem: A property of type object that holds a reference to the view model of the data point. This property is valid only in a data-bound scenario. In a sampling scenario the property holds an object of type DataPointSamplingInfo instead of the view model (the data item).
IsSelected: A property of type bool that indicates if the data point is selected. For more information, see the Selection help article.
IsInPlotRange: A property of type bool that indicates whether the data point's visual is in the plot area range. This is the actual range of the axes.
Label: A property of type object that contains the label associated with the data point.
Each different DataPoint inheritor implements properties that define the values used to plot it in the chart.
The CategoricalDataPoint class is used by the Cartesian chart series and it exposes two additional properties that define the position of the data point in the Cartesian coordinate system.
The Category property defines the category of the data point on the categorical or date-time axis. And the Value property defines the value of the data point on the numeric axis.
The BubbleDataPoint derives from the CategoricalDataPoint and extends it with an additional BubbleSize property. The property defines the size of the bubble.
The RangeDataPoint is a type of categorical data point, so it has a Category property. But, instead of a single value it works with two values - high and low. The values could be get/set via the High and Low properties and they define the range in which the data point visual will be drawn.
The OhlcDataPoint is a type of categorical data point, so it has a Category property. But, instead of a single value it works with few additional values accessed via the following properties: High, Low, Open and Close. This type of data point is used in the financial series of the chart (ohlc and candlestick).
Additionaly, the class exposes two properties that indicate whether the data point follows rasising (bullish) or falling (bearish) trend. The properties are IsRising and IsFalling.
This data point model is used by the Cartesian chart series and it exposes two additional properties that define the position of the data point in the Cartesian coordinate system.
The XValue property defines the value of the data point on the horizontal axis. And the YValue property defines the value of the data point on the vertical axis.
The ScatterBubbleDataPoint derives from the ScatterDataPoint and extends it with an additional BubbleSize property. The property defines the size of the bubble.
This data point model is used in pie and doughnut series. It is a single value data point and it exposes a Value property.
The pie data point also allows you to define its offset from the center of the pie. You can do that via the OffsetFromCenter property. Note that the property works with relative units between 0 and 1.
This data point model is used in polar chart series and it exposes two properties defining the position of the data point in the polar cooridnate system.
The Angle property defines the angle of the data point on the radial (circular) axis. And the Value property defines the value of the data point on the polar (linear) axis.
In a sampling scenario the DataItem property of the DataPoint object doesn't contain a data object from the view models collection. This is because in this case a number data items are aggregated into a single DataPoint object. In this scenario the DataItem property will contain an object of type DataPointSamplingInfo. See more about this in the ChartDataSource help article.