Visualizing financial market data—such as opening, high, low, closing prices together with volume—is a common requirement for analysts and developers. Aspose.Cells for .NET makes it effortless to generate a StockVolumeOpenHighLowClose chart directly from code. In this guide you will learn how to:
- Set up a workbook and populate it with OHLCV data.
- Add a
StockVolumeOpenHighLowClosechart. - Customize series, axes, legends, and styling.
- Save the workbook to XLSX (or other supported formats).
Let’s dive in!
Table of Contents
- C# Excel Library to Create StockVolumeOpenHighLowClose Chart
- Create a StockVolumeOpenHighLowClose Chart in Excel using C#
- Get a Free License
- Free Resources
- Conclusion
- See Also
C# Excel Library to Create StockVolumeOpenHighLowClose Chart
Aspose.Cells for .NET is a high‑performance Excel processing library that enables developers to create, edit, and render Excel files without Microsoft Office. It offers a rich charting API, including the ChartType.StockVolumeOpenHighLowClose chart, which combines a stock chart (open‑high‑low‑close) with a volume column chart.
Key benefits of using Aspose.Cells for financial charting:
- No Office Interop – Works in cloud, services, and desktop environments.
- Full .NET Standard support – Compatible with .NET 6, .NET 7, .NET Framework, and .NET Core.
- Extensive customization – Control series type, axes, markers, colors, and more.
- High‑speed processing – Efficient handling of large datasets.
Installation
Add Aspose.Cells to your project via NuGet:
PM> Install-Package Aspose.Cells
or via the .NET CLI:
dotnet add package Aspose.Cells
Create a StockVolumeOpenHighLowClose Chart in Excel using C#
Below you will find two complete examples:
- Basic chart – demonstrates the minimal steps required.
- Styled chart – shows how to customize colors, secondary axis, markers, and legend.
Both examples are ready to compile and run.
Step‑by‑Step Implementation
- Create a
Workbookinstance. - Access the first worksheet (
workbook.Worksheets[0]). - Populate OHLCV data (Open, High, Low, Close, Volume).
- Add a chart using
ChartType.StockVolumeOpenHighLowClose. - Configure the series – set the data range, series names, and chart type for each series if needed.
- Optional customization – axes titles, legend position, colors, markers, secondary axis for volume, etc.
- Save the workbook to the desired format.
Full Example – Basic Chart
Explanation of the key lines
| Line | Purpose |
|---|---|
ChartType.StockVolumeOpenHighLowClose | Creates a combined stock (OHLC) and volume column chart. |
chart.NSeries.Add("=MarketData!$B$2:$E$6", true); | Adds the OHLC series (Open‑High‑Low‑Close). |
chart.NSeries.Add("=MarketData!$F$2:$F$6", true); | Adds the Volume series. |
chart.NSeries[0].CategoryData = "MarketData!$A$2:$A$6"; | Sets dates as the X‑axis categories. |
chart.ShowLegend = true; | Enables the legend so series names are visible. |
Running the program produces StockVolumeOpenHighLowClose_Basic.xlsx with a functional financial chart.
Full Example – Styled Chart with Secondary Axis
The following example adds a professional look: custom colors, a secondary axis for volume, marker styles for the stock series, and a transparent plot area.
Highlights of this example
- Candlestick style for the OHLC series (
ChartType.Candlestick) with green upward bars and red downward bars. - Secondary Y‑axis for volume (
PlotOnSecondAxis = true). - Semi‑transparent column fill for volume to keep the stock bars visible.
- Date formatting on the category axis (
"mmm dd"). - Legend placed on the right for better space utilization.
Running the program creates StockVolumeOpenHighLowClose_Styled.xlsx, a polished financial chart ready for presentations or further analysis.
Get a Free License
Aspose.Cells offers a temporary free license that removes evaluation watermarks and enables full functionality for testing. Visit the temporary license page to obtain yours instantly.
// Example of applying a temporary license
var license = new License();
license.SetLicense("Aspose.Total.lic"); // Path to your downloaded license file
Free Resources
- Developer’s Guide – https://docs.aspose.com/cells/net/
- Free Online Apps – https://products.aspose.app/cells/family
- API Reference – https://reference.aspose.com/cells/net/
- How‑to Articles & Blog – https://blog.aspose.com/categories/aspose.cells-product-family/
Conclusion
Creating a StockVolumeOpenHighLowClose chart with Aspose.Cells for .NET is straightforward:
- Populate your worksheet with OHLCV data.
- Add the combined chart type.
- Customize series, axes, and styling to match your visual standards.
- Save the workbook in any supported format.
With the provided code snippets you can integrate financial charting into reporting tools, dashboards, or automated Excel generation pipelines with just a few lines of C#.
For additional assistance, visit our free support forum – our experts are ready to help.