ChartCalculatedField.Expression Property
In This Article
Gets or sets an expression the calculated field uses to evaluate its values.
Namespace: DevExpress.Xpf.Charts
Assembly: DevExpress.Xpf.Charts.v24.2.dll
NuGet Package: DevExpress.Wpf.Charts
#Declaration
#Property Value
Type | Description |
---|---|
String | A string that represents an expression written in Criteria Language. |
#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: [Time.Seconds] * [Velocity].
using System;
using System.Collections.Generic;
using System.Windows;
namespace CalculatedFields {
public class ChartViewModel {
List<DataPoint> dataPoints;
public List<DataPoint> DataPoints {
get {
if (dataPoints == null) {
dataPoints = new List<DataPoint> {
new DataPoint (new TimeSpan(0, 0, 0), 10),
new DataPoint (new TimeSpan(0, 0, 1), 11.46),
new DataPoint (new TimeSpan(0, 0, 2), 11.90),
new DataPoint (new TimeSpan(0, 0, 3), 12.1),
new DataPoint (new TimeSpan(0, 0, 4), 12.236),
new DataPoint (new TimeSpan(0, 0, 5), 12.325),
new DataPoint (new TimeSpan(0, 0, 6), 12.625),
new DataPoint (new TimeSpan(0, 0, 7), 13.896),
new DataPoint (new TimeSpan(0, 0, 8), 14.123),
new DataPoint (new TimeSpan(0, 0, 9), 14.623),
new DataPoint (new TimeSpan(0, 0, 10), 15.007),
new DataPoint (new TimeSpan(0, 0, 11), 15.452),
new DataPoint (new TimeSpan(0, 0, 12), 15.756)
};
}
return dataPoints;
}
}
}
public class DataPoint {
public TimeSpan Time { get; set; }
public double Velocity { get; set; }
public DataPoint(TimeSpan time, double velocity) {
this.Time = time;
this.Velocity = velocity;
}
}
}
See Also