wpf-devexpress-dot-xpf-dot-charts-dot-seriespoint3ddatasourceadapter-8889b6aa.md
Returns a collection of calculated fields.
Namespace : DevExpress.Xpf.Charts
Assembly : DevExpress.Xpf.Charts.v25.2.dll
NuGet Package : DevExpress.Wpf.Charts
public ChartCalculatedFieldCollection CalculatedFields { get; }
Public ReadOnly Property CalculatedFields As ChartCalculatedFieldCollection
| Type | Description |
|---|---|
| ChartCalculatedFieldCollection |
A collection that stores calculated fields.
|
Calculated fields allow you to evaluate values based on an expression and use them as a data source for series arguments,values, tooltips, crosshair labels, and so on.
To add a calculated field to a Chart3D Control, add a ChartCalculatedField object to the adapter’s CalculatedFields collection and specify its parameters.
The following example shows how to create a calculated field and then use this field as a data source for a series. The field’s values are calculated by the following expression: [X] * [Y].
<dxc:Chart3DControl AspectRatio="1 1 0.5">
<dxc:Chart3DControl.DataContext>
<local:ChartViewModel/>
</dxc:Chart3DControl.DataContext>
<dxc:Series3DStorage>
<dxc:Series3D DisplayName="Series"
CrosshairLabelPattern="X: {X:f1}
Y: {Y:f1}
Value: {V}">
<dxc:Series3D.View>
<dxc:Point3DSeriesView/>
</dxc:Series3D.View>
<dxc:SeriesPoint3DDataSourceAdapter DataSource="{Binding DataPoints}"
XArgumentDataMember="X"
YArgumentDataMember="Y"
ValueDataMember="Value">
<dxc:SeriesPoint3DDataSourceAdapter.CalculatedFields>
<dxc:ChartCalculatedField Expression="[X]*[Y]"
FieldName="Value"
FieldType="Double"/>
</dxc:SeriesPoint3DDataSourceAdapter.CalculatedFields>
</dxc:SeriesPoint3DDataSourceAdapter>
</dxc:Series3D>
</dxc:Series3DStorage>
</dxc:Chart3DControl>
using System.Collections.Generic;
using System.Windows;
namespace Chart3DCalculatedFields {
public partial class MainWindow : Window {
public MainWindow() {
InitializeComponent();
}
}
public class ChartViewModel {
List<DataPoint> dataPoints;
public List<DataPoint> DataPoints {
get {
if (dataPoints == null) {
dataPoints = new List<DataPoint> {
new DataPoint (12, 10),
new DataPoint (11.2, 11.46),
new DataPoint (13.1, 11.90),
new DataPoint (10.74, 12.1),
new DataPoint (9.6, 12.236),
new DataPoint (10.2, 12.325),
new DataPoint (13.9, 12.625),
new DataPoint (11.4, 13.896),
new DataPoint (13.7, 14.123),
new DataPoint (15.4, 14.623),
new DataPoint (13.9, 15.007),
new DataPoint (13, 15.452),
new DataPoint (12.56, 15.756)
};
}
return dataPoints;
}
}
}
public class DataPoint {
public double X { get; set; }
public double Y { get; set; }
public DataPoint(double x, double y) {
this.X = x;
this.Y = y;
}
}
}
Imports System.Collections.Generic
Imports System.Windows
Namespace Chart3DCalculatedFields
Public Partial Class MainWindow
Inherits Window
Public Sub New()
InitializeComponent()
End Sub
End Class
Public Class ChartViewModel
Private f_DataPoints As List(Of DataPoint)
Public ReadOnly Property DataPoints As List(Of DataPoint)
Get
If f_DataPoints Is Nothing Then
f_DataPoints = New List(Of DataPoint) From {
New DataPoint(12, 10),
New DataPoint(11.2, 11.46),
New DataPoint(13.1, 11.90),
New DataPoint(10.74, 12.1),
New DataPoint(9.6, 12.236),
New DataPoint(10.2, 12.325),
New DataPoint(13.9, 12.625),
New DataPoint(11.4, 13.896),
New DataPoint(13.7, 14.123),
New DataPoint(15.4, 14.623),
New DataPoint(13.9, 15.007),
New DataPoint(13, 15.452),
New DataPoint(12.56, 15.756)
}
End If
Return f_DataPoints
End Get
End Property
End Class
Public Class DataPoint
Public Property X As Double
Public Property Y As Double
Public Sub New(ByVal x As Double, ByVal y As Double)
Me.X = x
Me.Y = y
End Sub
End Class
End Namespace
See Also
SeriesPoint3DDataSourceAdapter Class