Yüksek Düşük Kapanış (HLC) Hisse Senedi Grafiği Oluştur
Olası Kullanım Senaryoları
Yüksek-Düşük-Kapanış (HLC) hisse senedi grafiği dört veri sütununu kullanır. İlk sütun genellikle bir tarihtir, ancak hisse adları da kullanılabilir. Sıradaki üç sütun, sırasıyla yüksek, düşük ve kapanış fiyatları içindir. Her kategori için fiyat aralığı, düşükten yükseğe dikey bir çizgi ile gösterilir ve kapanış fiyatı, bu çizginin sağında uzayan bir işaret kullanılarak gösterilir.
Grafikte görünürlük iyileştirmeleri
Grafik daha sezgisel görünmesi için bazen işaretin görünümünü değiştirebilir veya ikincil eksen üzerinde göstermesini sağlayabiliriz.
Örnek Kod
Aşağıdaki örnek kod, örnek Excel dosyasını yükler ve çıktı Excel dosyasını oluşturur.
// Create an instance of Workbook | |
Workbook workbook = new Workbook("High-Low-Close.xlsx"); | |
// Access the first worksheet. | |
Worksheet worksheet = workbook.Worksheets[0]; | |
//Create High-Low-Close-Stock Chart | |
int pieIdx = worksheet.Charts.Add(ChartType.StockHighLowClose, 5, 6, 20, 12); | |
// Retrieve the Chart object | |
Chart chart = worksheet.Charts[pieIdx]; | |
// Set the legend can be showed | |
chart.ShowLegend = true; | |
// Set the chart title name | |
chart.Title.Text = "High-Low-Close Stock"; | |
// Set the Legend at the bottom of the chart area | |
chart.Legend.Position = LegendPositionType.Bottom; | |
// Set data range | |
chart.SetChartDataRange("A1:D9", true); | |
// Set category data | |
chart.NSeries.CategoryData = "A2:A9"; | |
// Set the marker with the built-in data | |
chart.NSeries[2].Marker.MarkerStyle = ChartMarkerType.Dash; | |
chart.NSeries[2].Marker.MarkerSize = 20; | |
chart.NSeries[2].Marker.Area.Formatting = FormattingType.Custom; | |
chart.NSeries[2].Marker.Area.ForegroundColor = Color.Maroon; | |
// Fill the PlotArea area with nothing | |
chart.PlotArea.Area.FillFormat.FillType = FillType.None; | |
// Save the Excel file | |
workbook.Save("out.xlsx"); |