We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback


Overview

The WPF OHLC chart is like a candle chart. The horizontal lines at the left and right are used to show open and close values of the stock, and the vertical line represents high and low values. They are easily customizable and supports interactive features such as trackball, tooltip, selection, and zooming to track information of the data.

Beautiful WPF Open High Low Close Chart


Key features

The WPF OHLC chart shows the bull and bear color customization

Bull and bear

Customizable bull and bear colors.

The WPF OHLC chart with zooming and panning support

Zooming and scrolling

Supports zooming and panning when dealing with large amount of data to visualize data point in any region.

The WPF OHLC chart shows the multiple axes

Multiple axes

Use multiple axes to plot different data sets that widely vary from one another.

The WPF OHLC chart with technical indicator support

Technical indicators

Supports zooming and panning when dealing with large amount of data to visualize data point in any region.


Code example

<Window x:Class="ChartExample.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:ChartExample"
        xmlns:chart="clr-namespace:Syncfusion.UI.Xaml.Charts;assembly=Syncfusion.SfChart.WPF"
        mc:Ignorable="d"
        Title="WPF Open High Low Close (OHLC) Chart" Height="450" Width="700">
    
    <!--Setting DataContext-->
    <Window.DataContext>
        <local:ViewModel/>
    </Window.DataContext>
    
    <StackPanel>
        <chart:SfChart Height="300" Width="500">
            <!--Initialize the horizontal axis for the WPF Chart-->
            <chart:SfChart.PrimaryAxis>
                <chart:DateTimeAxis LabelFormat="ddd" />
            </chart:SfChart.PrimaryAxis>

            <!--Initialize the vertical axis for the WPF Chart-->
            <chart:SfChart.SecondaryAxis>
                <chart:NumericalAxis />
            </chart:SfChart.SecondaryAxis>
           
            <!--Adding HiLo Open Close Series to the WPF Chart-->
            <chart:HiLoOpenCloseSeries
                Close="Close"
                High="High" 
                ItemsSource="{Binding StockPriceDetails}"
                Low="Low"
                Open="Open"
                XBindingPath="Date" >
            </chart:HiLoOpenCloseSeries>
        </chart:SfChart>
    </StackPanel>
</Window>
public class HiLoChartModel
{
    public DateTime Date { get; set; }
    public double High { get; set; }
    public double Low { get; set; }
    public double Open { get; set; }
    public double Close { get; set; }
}

public class ViewModel
{
    public ObservableCollection<HiLoChartModel> StockPriceDetails { get; set; }

    public ViewModel()
    {
        this.StockPriceDetails = new ObservableCollection<HiLoChartModel>();
        DateTime date = new DateTime(2012, 1, 1);

        this.StockPriceDetails.Add(new HiLoChartModel() { Date = date.AddDays(0), Open = 873.8, High = 878.85, Low = 855.5, Close = 860.5 });
        this.StockPriceDetails.Add(new HiLoChartModel() { Date = date.AddDays(1), Open = 873.8, High = 878.85, Low = 855.5, Close = 860.5 });
        this.StockPriceDetails.Add(new HiLoChartModel() { Date = date.AddDays(2), Open = 861, High = 868.4, Low = 835.2, Close = 843.45 });
        this.StockPriceDetails.Add(new HiLoChartModel() { Date = date.AddDays(3), Open = 846.15, High = 853, Low = 838.5, Close = 847.5 });
        this.StockPriceDetails.Add(new HiLoChartModel() { Date = date.AddDays(4), Open = 842, High = 847.75, Low = 827, Close = 832 });
        this.StockPriceDetails.Add(new HiLoChartModel() { Date = date.AddDays(5), Open = 841, High = 845, Low = 827.85, Close = 838.65 });
        this.StockPriceDetails.Add(new HiLoChartModel() { Date = date.AddDays(6), Open = 846, High = 858.5, Low = 842, Close = 847.75 });
        this.StockPriceDetails.Add(new HiLoChartModel() { Date = date.AddDays(7), Open = 865, High = 872, Low = 851, Close = 858.9 });
        this.StockPriceDetails.Add(new HiLoChartModel() { Date = date.AddDays(8), Open = 846, High = 860.75, Low = 841, Close = 855 });
        this.StockPriceDetails.Add(new HiLoChartModel() { Date = date.AddDays(9), Open = 841, High = 845, Low = 827.85, Close = 838.65 });

    }
}

Learning resources

Navigate to GitHub code used to configure the WPF OHLC chart

GitHub Code

The WPF OHLC chart configuration code is available in GitHub.

Navigate to the options available in the user guide to customize the WPF OHLC chart

OHLC Chart User Guide

Learn more about the available options to customize WPF OHLC charts.

Navigate to the API references documentation of the WPF OHLC chart

OHLC Chart API Reference

Explore the WPF OHLC chart APIs.


100+ WPF CONTROLS

Scroll up icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon