[Expand]General Information
[Expand]WinForms Controls
[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
[Collapse]Office File API
  Demo Application
  Redistribution and Deployment
 [Collapse]Spreadsheet Document API
   Product Structure
   Getting Started
  [Expand]Spreadsheet Document
   Supported Formats
  [Expand]Cell Basics
  [Expand]Formulas
   Defined Names
   Data Binding
  [Expand]Pivot Tables
  [Expand]Charts and Graphics
  [Expand]Mail Merge
  [Collapse]Examples
   [Expand]Files
   [Expand]Workbooks
   [Expand]Worksheets
   [Expand]Rows and Columns
   [Expand]Cells
   [Expand]Formulas
   [Expand]Import and Export Data
   [Expand]Data Binding
    Sorting
   [Expand]Mail Merge
    Search
   [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 Appearance 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]Formatting Cells
   [Expand]Conditional Formatting
   [Expand]Group Data
   [Expand]Filter Data
   [Expand]Tables
   [Expand]Pivot Tables
   [Expand]Printing
   [Expand]Pictures
   [Expand]Protection
 [Expand]Word Processing Document API
 [Expand]PDF Document API
 [Expand]Excel Export Library
 [Expand]Snap Report API
 [Expand]Zip Compression and Archive API
 [Expand]Barcode Generation API
 [Expand]Unit Conversion API
 [Expand]API Reference
[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/spreadsheet-chart-api-examples-t132724 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.

  • 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?​​​​​​​