Kombo Grafik Nasıl Oluşturulur

Olası Kullanım Senaryoları

Excel’deki kombo grafikler, verinizi anlaşılır hale getirmek için iki veya daha fazla grafik türünü kolayca birleştirebileceğiniz bu seçeneği kullanmanızı sağlar. Kombo grafikler, verinizin fiyat ve hacim dahil olmak üzere birden çok türde değeri içerdiğinde yardımcı olur. Ayrıca, veri serilerinizin sayıları seriye göre geniş ölçüde değiştiğinde Kombo grafikler uygundur. Aşağıdaki veri kümesini örnek olarak alırsak, bu verilerin VHCL ‘de bahsedilen verilere oldukça benzer olduğunu gözlemleyebiliriz. Series0’ı “Toplam Gelir” olarak görselleştirmek istiyorsak, bunu bir Çizgi grafiği olarak nasıl yapmalıyız?

todo:image_alt_text

Kombo grafik

Aşağıdaki kodu çalıştırdıktan sonra, aşağıda gösterildiği gibi Kombo grafiği göreceksiniz.

todo:image_alt_text

Örnek Kod

Aşağıdaki örnek kod örnek Excel dosyasını yükler ve çıktı Excel dosyasını oluşturur.

from aspose.cells import Workbook
from aspose.cells.charts import ChartMarkerType, ChartType, FormattingType, LegendPositionType
from aspose.cells.drawing import LineType
from aspose.pydrawing import Color
# Create the workbook
workbook = Workbook("combo.xlsx")
# Access the first worksheet
worksheet = workbook.worksheets[0]
# Add a stock vloume(VHLC)
pieIdx = worksheet.charts.add(ChartType.STOCK_VOLUME_HIGH_LOW_CLOSE, 15, 0, 34, 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 = "Combo Chart"
# Set the Legend at the bottom of the chart area
chart.legend.position = LegendPositionType.BOTTOM
# Set data range
chart.set_chart_data_range("A1:E12", True)
# Set category data
chart.n_series.category_data = "A2:A12"
# Set the Series[1] Series[2] and Series[3] to different Marker Style
for j in range(len(chart.n_series)):
if j == 1:
chart.n_series[j].marker.marker_style = ChartMarkerType.CIRCLE
chart.n_series[j].marker.marker_size = 15
chart.n_series[j].marker.area.formatting = FormattingType.CUSTOM
chart.n_series[j].marker.area.foreground_color = Color.pink
chart.n_series[j].border.is_visible = False
elif j == 2:
chart.n_series[j].marker.marker_style = ChartMarkerType.DASH
chart.n_series[j].marker.marker_size = 15
chart.n_series[j].marker.area.formatting = FormattingType.CUSTOM
chart.n_series[j].marker.area.foreground_color = Color.orange
chart.n_series[j].border.is_visible = False
elif j == 3:
chart.n_series[j].marker.marker_style = ChartMarkerType.SQUARE
chart.n_series[j].marker.marker_size = 15
chart.n_series[j].marker.area.formatting = FormattingType.CUSTOM
chart.n_series[j].marker.area.foreground_color = Color.light_blue
chart.n_series[j].border.is_visible = False
# Set the chart type for Series[0]
chart.n_series[0].type = ChartType.LINE
# Set style for the border of first series
chart.n_series[0].border.style = LineType.SOLID
# Set Color for the first series
chart.n_series[0].border.color = Color.dark_blue
# Fill the PlotArea area with nothing
chart.plot_area.area.formatting = FormattingType.NONE
# Save the Excel file
workbook.save("out.xlsx")