HTML JPG PDF XML XLSX
  Product Family
XLSX

Create Candlestick(Open-High-Low-Close Stock) Charts via C#

Native and high performance MS Excel Charts creation programmatically using server side .NET APIs.

The Open-High-Low-Close (OHLC) chart uses five columns of data, in order: category, open, high, low, and close. The range of prices in each category is again indicated by a vertical line, while the range between open and close is given by a wider floating bar; if the price increases in the category (close is higher than open), the bar is filled with one color, while if the price decreases, the bar is filled with another. This type of chart is often called a candlestick chart.

How to Create Candlestick(Open-High-Low-Close Stock) Charts via C#

It is easy for the developers to create a Candlestick chart within running different reporting applications for data processing in just a few lines of code.

  1. Include the namespace in your class file
  2. Create Workbook class instance by sample Excel file .
  3. Add a Open-High-Low-Close Stock Chart to the worksheet by calling the Charts  collection’s Add  method, encapsulated in the Worksheet  object.
  4. Access the new Chart  object from the Charts collection by passing its index.
  5. Set the chart’s data source with Chart.SetChartDataRange method.
  6. Set category data with CategoryData property.
  7. Save as Excel or ODS Output file .

System Requirements

Just make sure that system have Microsoft Windows or a compatible OS with .NET Framework, .NET Core, Windows Azure, Mono or Xamarin Platforms as well as development environment like Microsoft Visual Studio.

- Install from command line as nuget install Aspose.Cells or via Package Manager Console of Visual Studio with Install-Package Aspose.Cells. - Alternatively, get the offline MSI installer or all DLLs in a ZIP file from downloads
 

Following source code shows how to create a Candlestick(Open-High-Low-Close Stock) Chart to MS Excel XLSX file using C#.