[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Collapse]WPF Controls
  Prerequisites
 [Expand]What's Installed
 [Expand].NET Core 3 Support
 [Expand]Common Concepts
 [Expand]MVVM Framework
 [Collapse]Controls and Libraries
   Reporting
  [Expand]Data Grid
  [Expand]Ribbon, Bars and Menu
  [Expand]Charts Suite
  [Expand]Pivot Grid
  [Expand]Scheduler
  [Collapse]Spreadsheet
    Product Structure
   [Expand]Getting Started
   [Expand]Spreadsheet Document
    Supported Formats
   [Expand]Cell Basics
   [Expand]Formulas
    Defined Names
    Data Binding
    Data Validation
   [Expand]Data Presentation
   [Expand]Pivot Table Overview
   [Expand]Charts and Graphics
    Printing
    Events
    Protection
    Operation Restrictions
    Find and Replace
   [Expand]Mail Merge
   [Expand]Visual Elements
    Services
    Themes and Templates
   [Expand]Shortcuts
   [Collapse]Examples
    [Expand]Files
    [Expand]Workbooks
    [Expand]Worksheet
    [Expand]Rows and Columns
    [Expand]Cells
    [Expand]Formulas
    [Expand]Data Binding
    [Expand]Formatting Cells
    [Expand]Conditional Formatting
    [Expand]Group Data
    [Expand]Filter Data
    [Expand]Tables
    [Expand]Pivot Tables
    [Expand]Printing
    [Expand]Pictures
    [Expand]Shapes
    [Collapse]Charts
      How to: Create and Modify a Chart
      How to: Create a Stock Chart
      How to: Format Chart Elements
      How to: Change the Color of Series Points
      How to: Display the Chart Title
      How to: Display and Format Data Labels
      How to: Show or Hide the Chart Legend
      How to: Change the Display of Chart Axes
      How to: Protect a Chart
      How to: Create a Chart Sheet
      How to: Move a Chart to a Chart Sheet
      How to: Specify Chart Sheet Print Options
      How to: Remove a Chart Sheet
      How to: Protect a Chart Sheet
    [Expand]Sparklines
    [Expand]Protection
    [Expand]Mail Merge
    [Expand]Cell Templates
    [Expand]Commands
    [Expand]Customization
  [Expand]Rich Text Editor
  [Expand]Tree List
  [Expand]Gauge Controls
  [Expand]Map Control
  [Expand]Layout Management
  [Expand]Windows Modern UI
  [Expand]Printing-Exporting
  [Expand]Data Editors
  [Expand]Navigation Controls
  [Expand]Spell Checker
  [Expand]Property Grid
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Gantt Control
  [Expand]Diagram Control
  [Expand]Windows and Utility Controls
   Dialogs, Notifications and Panels
  [Expand]Scheduler (legacy)
 [Expand]Scaffolding Wizard
 [Expand]Localization
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

How to: Create a Stock Chart

This topic demonstrates how to create stock charts using the continuous and noncontiguous cell ranges as data sources.

Expanded Use a Continuous Source Range to Create a Stock Chart

Depending on the stock chart type, arrange columns or rows in the source range in the same order as the stock chart name:

  • High-Low-Close
  • Open-High-Low-Close
  • Volume-High-Low-Close
  • Volume-Open-High-Low-Close

For example, to create an Open-High-Low-Close stock chart, organize columns containing the stock data in the following order: open, high, low and close (see the image below).

After you arrange data in the source range, call the ChartCollection.Add method and pass the specified range as a parameter to create a chart. Refer to the How to: Create and Modify a Chart example for details on how to create a chart in code and adjust its settings.

Note

A complete sample project is available in the DevExpress-Examples/wpf-spreadsheet-chart-api-t113198 repository on GitHub.

Expanded Use a Noncontiguous Source Range to Create a Stock Chart

You can use the SeriesCollection.Add method to add a separate data series to a chart if a stock chart's data is in non-adjacent columns. The number and order of series depend on the stock chart type:

  • High-Low-Close
  • Open-High-Low-Close
  • Volume-High-Low-Close
  • Volume-Open-High-Low-Close

  • High-Low-Close Stock Chart

    To create this chart, add three series to the SeriesCollection collection in the following order: high, low, and close.

    If you save the created chart and open it in Microsoft Excel, the chart is not shown as a standard High-Low-Close chart. Instead, it displays three lines for each stock price and high-low lines connecting the high and low price values. To make the chart display correctly in Microsoft Excel, adjust the series' appearance as described below:

    1. Use the Series.Outline.SetNoFill method (ShapeOutlineFill.SetNoFill) to hide lines for the high, low and close data series.
    2. Set the Series.Marker.Symbol (Marker.Symbol) property to MarkerStyle.None to hide the high and low data series' markers.
    3. Use the Series.Marker options to change the data markers' appearance for the close data series. In this example, the marker style (Marker.Symbol) is set to MarkerStyle.Dash and the marker color is black.

    Note that these settings do not affect the chart's appearance in the SpreadsheetControl because the control uses WPF Charts to render a chart.

  • Open-High-Low-Close Stock Chart

    Add four series to the SeriesCollection collection in the following order: open, high, low, and close to create an Open-High-Low-Close stock chart.

  • Volume-High-Low-Close Stock Chart

    A Volume-High-Low-Close chart uses two ChartView objects of the following types: the ChartType.ColumnClustered type to display trading volume and the ChartType.StockHighLowClose type to show stock prices. Use the ChartView.Series.Add method to add data series to each chart view. The ChartType.StockHighLowClose view requires three data series in the following order: high, low, and close.

    To make the chart display correctly in Microsoft Excel, adjust the high, low and close series' appearance as described in the High-Low-Close Stock Chart section.

  • Volume-Open-High-Low-Close Stock Chart

    A Volume-Open-High-Low-Close chart uses two ChartView objects of the following types: the ChartType.ColumnClustered type to display trading volume and the ChartType.StockOpenHighLowClose type to show stock prices. Use the ChartView.Series.Add method to add data series to each chart view. The ChartType.StockOpenHighLowClose view requires four data series in the following order: open, high, low, and close.

Expanded See Also

Is this topic helpful?​​​​​​​