Suş grafik nasıl oluşturulur

Contents
[ ]

Aspose.Cells for Python via .NET API’leri, çizgi grafiği yardımıyla su damlası grafiği oluşturmaya olanak tanır. Ayrıca, grafiğin görünümünü özelleştirerek su damlası şeklini vermek için Series.up_bars ve Series.down_bars özelliklerini ayarlayabilirsiniz.

Aşağıda verilen kod parçacığı, sıfırdan bir su damlası grafiği oluşturmak için Aspose.Cells for Python via .NET API’nin kullanımını göstermektedir.

from aspose.cells import Workbook
from aspose.cells.charts import ChartType, FormattingType
from aspose.pydrawing import Color
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET
# The path to the documents directory.
dataDir = RunExamples.GetDataDir(".")
# Create an instance of Workbook
workbook = Workbook()
# Retrieve the first Worksheet in Workbook
worksheet = workbook.worksheets[0]
# Retrieve the Cells of the first Worksheet
cells = worksheet.cells
# Input some data which chart will use as source
cells.get("A1").put_value("Previous Year")
cells.get("A2").put_value("January")
cells.get("A3").put_value("March")
cells.get("A4").put_value("August")
cells.get("A5").put_value("October")
cells.get("A6").put_value("Current Year")
cells.get("B1").put_value(8.5)
cells.get("B2").put_value(1.5)
cells.get("B3").put_value(7.5)
cells.get("B4").put_value(7.5)
cells.get("B5").put_value(8.5)
cells.get("B6").put_value(3.5)
cells.get("C1").put_value(1.5)
cells.get("C2").put_value(4.5)
cells.get("C3").put_value(3.5)
cells.get("C4").put_value(9.5)
cells.get("C5").put_value(7.5)
cells.get("C6").put_value(9.5)
# Add a Chart of type Line in same worksheet as of data
idx = worksheet.charts.add(ChartType.LINE, 4, 4, 25, 13)
# Retrieve the Chart object
chart = worksheet.charts[idx]
# Add Series
chart.n_series.add("$B$1:$C$6", True)
# Add Category Data
chart.n_series.category_data = "$A$1:$A$6"
# Series has Up Down Bars
chart.n_series[0].has_up_down_bars = True
# Set the colors of Up and Down Bars
chart.n_series[0].up_bars.area.foreground_color = Color.green
chart.n_series[0].down_bars.area.foreground_color = Color.red
# Make both Series Lines invisible
chart.n_series[0].border.is_visible = False
chart.n_series[1].border.is_visible = False
# Set the Plot Area Formatting Automatic
chart.plot_area.area.formatting = FormattingType.AUTOMATIC
# Delete the Legend
chart.legend.legend_entries[0].is_deleted = True
chart.legend.legend_entries[1].is_deleted = True
# Save the workbook
workbook.save(dataDir + "output_out.xlsx")