Kıvılcım Ekle
Contents
[
Hide
]
Bir kıvılcım ekleyin
Kıvılcım, bir çalışma sayfası hücresinde verilerin görsel bir temsilini sağlayan küçük bir grafiktir. Kıvılcımları, mevsimsel artış veya azalış, ekonomik döngüler gibi bir dizi değerdeki eğilimleri göstermek, veri serisinin maksimum ve minimum değerlerini vurgulamak için kullanın. En büyük etki için kıvılcımı verilerinin yakınına yerleştirin. Üç tür Kıvılcım vardır: Çizgi, Sütun ve Yığılmış.
Aspose.Cells for Python via .NET ile sparkline oluşturmak çok basittir; aşağıdaki örnek kodlar ile:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from aspose.cells import CellArea, Workbook | |
from aspose.cells.charts import SparklineType | |
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(".") | |
# Instantiating a Workbook object | |
book = Workbook() | |
sheet = book.worksheets[0] | |
sheet.cells.get("A1").put_value(5) | |
sheet.cells.get("B1").put_value(2) | |
sheet.cells.get("C1").put_value(1) | |
sheet.cells.get("D1").put_value(3) | |
# Define the CellArea | |
ca = CellArea() | |
ca.start_column = 4 | |
ca.end_column = 4 | |
ca.start_row = 0 | |
ca.end_row = 0 | |
idx = sheet.sparkline_groups.add(SparklineType.LINE, sheet.name + "!A1:D1", False, ca) | |
group = sheet.sparkline_groups[idx] | |
group.sparklines.add(sheet.name + "!A1:D1", 0, 4) | |
#region Customize Sparklines | |
# Create CellsColor | |
clr = book.create_cells_color() | |
clr.color = Color.orange | |
group.series_color = clr | |
# set the high points are colored green and the low points are colored red | |
group.show_high_point = True | |
group.show_low_point = True | |
group.high_point_color.color = Color.green | |
group.low_point_color.color = Color.red | |
# set line weight | |
group.line_weight = 1.0 | |
# you also can choose a nice visual style | |
# group.PresetStyle = SparklinePresetStyleType.Style10; | |
#endregion Customize Sparklines | |
# Saving the Excel file | |
book.save(dataDir + "output.xlsx") |