创建成交量 开盘 最高 最低 收盘(VOHLC)股票图表

可能的使用场景

我们将要看的第四个股票图表是成交量开盘最高最低收盘图表。 再次强调,您必须按正确的顺序拥有数据。如果需要重新排列数据表,应在设置图表之前进行。 此图表包括一个立即在第一个(类别)列之后的成交量列,并且图表在主轴上显示此成交量的柱形图,而价格则移至次要轴。

todo:image_alt_text

成交量-开盘-最高-最低-收盘(VHLC)股票图表

todo:image_alt_text

示例代码

以下示例代码加载了示例Excel文件,并生成了输出Excel文件

from aspose.cells import Workbook
from aspose.cells.charts import ChartType, LegendPositionType
from aspose.cells.drawing import FillType
from aspose.pydrawing import Color
# Create an instance of Workbook
workbook = Workbook("Volume-Open-High-Low-Close.xlsx")
# Access the first worksheet.
worksheet = workbook.worksheets[0]
# Create High-Low-Close-Stock Chart
pieIdx = worksheet.charts.add(ChartType.STOCK_VOLUME_OPEN_HIGH_LOW_CLOSE, 5, 6, 20, 12)
# Retrieve the Chart object
chart = worksheet.charts[pieIdx]
# Set the legend can be showed
chart.show_legend = True
# Set the chart title name
chart.title.text = "Volume-Open-High-Low-Close Stock"
# Set the Legend at the bottom of the chart area
chart.legend.position = LegendPositionType.BOTTOM
# Set data range
chart.set_chart_data_range("A1:F9", True)
# Set category data
chart.n_series.category_data = "A2:A9"
# Set Color for the first series(Volume) data
chart.n_series[0].area.foreground_color = Color.from_argb(79, 129, 189)
# Fill the PlotArea area with nothing
chart.plot_area.area.fill_format.fill_type = FillType.NONE
# Save the Excel file
workbook.save("out.xlsx")