Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

Series3DDataSourceAdapter.CalculatedFields Property

Returns a collection of calculated fields.

Namespace: DevExpress.Xpf.Charts

Assembly: DevExpress.Xpf.Charts.v24.2.dll

NuGet Package: DevExpress.Wpf.Charts

#Declaration

public ChartCalculatedFieldCollection CalculatedFields { get; }

#Property Value

Type Description
ChartCalculatedFieldCollection

A collection that stores calculated fields.

#Remarks

Calculated fields allow you to evaluate values based on an expression and use them as a data source for series arguments, values, 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.

#Example

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].

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 ("Series1", 12, 10),
                            new DataPoint ("Series1", 11.2, 11.46),
                            new DataPoint ("Series1", 13.1, 11.90),
                            new DataPoint ("Series1", 10.74, 12.1),
                            new DataPoint ("Series1", 9.6, 12.236),
                            new DataPoint ("Series1", 10.2, 12.325),
                            new DataPoint ("Series2", 13.9, 12.625),
                            new DataPoint ("Series2", 11.4, 13.896),
                            new DataPoint ("Series2", 13.7, 14.123),
                            new DataPoint ("Series2", 15.4, 14.623),
                            new DataPoint ("Series2", 13.9, 15.007),
                            new DataPoint ("Series2", 13, 15.452),
                            new DataPoint ("Series2", 12.56, 15.756)
                };
                }
                return dataPoints;
            }
        }
    }
    public class DataPoint {
        public double X { get; set; }
        public double Y { get; set; }
        public string Name { get; set; }
        public DataPoint(string name, double x, double y) {
            this.Name = name;
            this.X = x;
            this.Y = y;
        }
    }
}
See Also