Skip to main content

DxChartFinancialSeriesBase<T, TArgument, TValue>.OpenField Property

Specifies a lambda expression that defines how to obtain the Open value for each financial series point.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

Declaration

[Parameter]
public Expression<Func<T, TValue>> OpenField { get; set; }

Property Value

Type Description
Expression<Func<T, TValue>>

A lambda expression that identifies the Open value.

Remarks

Use the DxChart.Data property to bind a chart to an IEnumerable<T> data source. Then, specify fields that contain point arguments, opening, highest, lowest, and closing values to create financial chart points. To do so, use the following properties:

The following example creates a Candlestick chart and binds it to data:

Candlestick chart

@page "/"
@using FinChart.Data
<DxChart Data="@stockData">
    <DxChartLegend Position="RelativePosition.Outside" />
    <DxChartCandlestickSeries ArgumentField="@((DataPoint i) => i.Argument)"
                              OpenField="@((DataPoint i) => i.OpenValue)"
                              HighField="@((DataPoint i) => i.HighValue)"
                              LowField="@((DataPoint i) => i.LowValue)"
                              CloseField="@((DataPoint i) => i.CloseValue)"
                              Name="Stock Prices" />
</DxChart>

@code {
    private DataPoint[] stockData;
    protected override void OnInitialized() {
        stockData = GetDataPoints();
    }
    public class DataPoint {
        public DateTime Argument { get; set; }
        public double OpenValue  { get; set; }
        public double HighValue  { get; set; }
        public double LowValue   { get; set; }
        public double CloseValue { get; set; }
    }
    public DataPoint[] GetDataPoints() {
        DataPoint[] stockData = new DataPoint[] {
            new DataPoint() { Argument = new DateTime(2022, 1, 1 ),  OpenValue = 12.35, HighValue = 13.5,  LowValue = 12.12, CloseValue = 13.5  },
            new DataPoint() { Argument = new DateTime(2022, 1, 2 ),  OpenValue = 12.45, HighValue = 13.68, LowValue = 12.02, CloseValue = 13.4  },
            // Other points.
            new DataPoint() { Argument = new DateTime(2022, 1, 29 ), OpenValue = 16.8, HighValue = 17.14, LowValue = 16.74, CloseValue = 17.09 },
            new DataPoint() { Argument = new DateTime(2022, 1, 30 ), OpenValue = 17.04, HighValue = 18.74, LowValue = 17.01, CloseValue = 18.66 },
            new DataPoint() { Argument = new DateTime(2022, 1, 31 ), OpenValue = 18.33, HighValue = 19.2, LowValue = 18.22, CloseValue = 18.99 }
        };
        return stockData;
    }
}
See Also