[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Property Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Collapse]Spreadsheet
   [Expand]Product Information
    Product Structure
    Getting Started
   [Expand]Spreadsheet Document
    Supported Formats
   [Expand]Cell Basics
   [Expand]Spreadsheet Formulas
    Defined Names
    Data Binding
    Data Validation
   [Expand]Data Presentation
    Data Grouping
   [Expand]Pivot Table Overview
   [Expand]Charting Overview
    Shapes
    Printing
    Events
   [Expand]Mail Merge Overview
    Protection
    Find and Replace
   [Expand]Visual Elements
    Services
   [Expand]Shortcuts
   [Collapse]Examples
    [Expand]Files
    [Expand]Workbooks
    [Expand]Worksheets
    [Expand]Rows and Columns
    [Expand]Cells
    [Expand]Formulas
    [Expand]Import and Export Data
    [Expand]Data Binding
    [Expand]Mail Merge
    [Expand]Formatting Cells
    [Expand]Conditional Formatting
    [Expand]Group Data
    [Expand]Filter Data
    [Expand]Tables
    [Expand]Pivot Tables
    [Expand]Printing
    [Expand]Pictures
    [Collapse]Charts
      How to: Create and Modify a Chart
      How to: Create a Stock Chart
      How to: Format Chart Elements
      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]Protection
    [Expand]Customization
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[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]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

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/winforms-spreadsheet-chart-api-e5222 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 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 WinForms 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?​​​​​​​