Crea un grafico di scorta High Low Close (HLC)

Possibili Scenari di Utilizzo

Il grafico di stock High-Low-Close (HLC) utilizza quattro colonne di dati. La prima colonna è una categoria, di solito una data ma anche i nomi delle azioni possono essere utilizzati. Le successive tre colonne in ordine sono per i prezzi alti, bassi e di chiusura. L’intervallo di prezzo per ogni categoria è indicato da una linea verticale da basso a alto, e il prezzo di chiusura è mostrato utilizzando un segno di spunta che si estende verso destra di questa linea.

todo:image_alt_text

Miglioramenti della visibilità nel grafico

A volte, per rendere il grafico più intuitivo, possiamo modificare l’aspetto del marcatore (chiusura), o farlo visualizzare sull’asse secondario.

todo:image_alt_text

Codice di Esempio

Il codice di esempio seguente carica il file Excel di esempio e genera il file Excel di output.

// 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");