Sparklines ve 3D Format Ayarlarını Kullanma
Sparklines Kullanma
Microsoft Excel 2010, bilgileri daha önce hiç olmadığı kadar fazla şekilde analiz etmenizi sağlar. Kullanıcıların yeni veri analiz ve görselleştirme araçlarıyla önemli veri eğilimlerini takip etmesine ve vurgulamasına izin verir. Sparklines, veriyi ve tabloyu aynı anda görüntüleyebileceğiniz mini grafiklerdir. Sparklines uygun şekilde kullanıldığında, veri analizi daha hızlı ve daha anlaşılır olur. Ayrıca, aşırı kalabalık çalışma tablolarını çok fazla meşgul grafiklerle önler. Onlar, aynı tabloda veriyi görmek için basit bir görünüm sağlar. Ayrıca, Aspose.Cells, elektronik tablolardaki sparklines’ı manipüle etmek için bir API sağlar.
Aspose.Cells for Python via .NET, elektronik tablolar içindeki sparkline’leri manipüle etmek için bir API sağlar.
Microsoft Excel’de Sparklines Kullanma
Microsoft Excel 2010’da Sparklines eklemek için:
- Sparklines’ların görünmesini istediğiniz hücreleri seçin. Onları görüntülemeyi kolaylaştırmak için, verinin yanındaki hücreleri seçin.
- Menü şeridinde Ekle‘yi tıklayın, ardından Sparklines grubunda Sütun‘u seçin.
- Kaynak verinin bulunduğu çalışma sayfasındaki hücre aralığını seçin veya girin. Grafikler görünecektir.
Sparklines, örneğin, bir bayan voleybol ligi için kazanma veya kaybetme kaydını görmek için size yardımcı olur. Sparklines, ligdeki her takımın tüm sezonlarının toplamını dahi verebilir.
Aspose.Cells for Python via .NET kullanılarak sparkline’ler
Geliştiriciler, Aspose.Cells for Python via .NET tarafından sağlanan API’yi kullanarak şablon dosyasında sparkline oluşturabilir, silebilir veya okuyabilirler. Sparkline’leri yöneten sınıflar aspose.cells.charts ad alanında bulunur, bu yüzden bu özellikleri kullanmadan önce bu alanı içe aktarmanız gerekir.
Belirli bir veri aralığı için özel grafikler ekleyerek, geliştiriciler seçili hücre alanlarına farklı türde küçük grafikler eklemek özgürlüğüne sahiptir.
Aşağıdaki örnek, Sparklines özelliğini sergiler. Örnek, şunları gösterir:
- Basit bir şablon dosyasını açın.
- Bir çalışma sayfası için sparklines bilgilerini okuyun.
- Belirli bir veri aralığı için yeni sparklines ekleyin.
- Excel dosyasını diske kaydedin.
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(".") | |
# Instantiate a Workbook | |
# Open a template file | |
book = Workbook(dataDir + "Book1.xlsx") | |
# Get the first worksheet | |
sheet = book.worksheets[0] | |
# Use the following lines if you need to read the Sparklines | |
# Read the Sparklines from the template file (if it has) | |
for g in sheet.sparkline_groups: | |
# Display the Sparklines group information e.g type, number of sparklines items | |
print("sparkline group: type:" + str(g.type) + ", sparkline items count:" + str(len(g.sparklines))) | |
for s in g.sparklines: | |
# Display the individual Sparkines and the data ranges | |
print("sparkline: row:" + str(s.row) + ", col:" + str(s.column) + ", dataRange:" + s.data_range) | |
# Add Sparklines | |
# Define the CellArea D2:D10 | |
ca = CellArea() | |
ca.start_column = 4 | |
ca.end_column = 4 | |
ca.start_row = 1 | |
ca.end_row = 7 | |
# Add new Sparklines for a data range to a cell area | |
idx = sheet.sparkline_groups.add(SparklineType.COLUMN, "Sheet1!B2:D8", False, ca) | |
group = sheet.sparkline_groups[idx] | |
# Create CellsColor | |
clr = book.create_cells_color() | |
clr.color = Color.orange | |
group.series_color = clr | |
# Save the excel file | |
book.save(dataDir + "Book1.out.xlsx") |
3B Formatını Ayarlama
3D grafikleri gerekebilir, böylece sadece durumunuza uygun sonuçları alabilirsiniz. Aspose.Cells for Python via .NET, Microsoft Excel 2007 3D biçimlendirmesini uygulamak için ilgili API’yi sağlar.
Aşağıda, bir grafik oluşturmayı ve Microsoft Excel 2007 3B biçimlendirmesini uygulamayı sergilemek için tam bir örnek verilmiştir. Örnek kodu çalıştırdıktan sonra bir sütun grafiği (3B efektleri ile) çalışma sayfasına eklenecektir.
from aspose.cells import Workbook | |
from aspose.cells.charts import ChartType | |
from aspose.cells.drawing import BevelPresetType, LightRigType, PresetMaterialType | |
from aspose.pydrawing import Color | |
from os import os, path | |
# 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 directory if it is not already present. | |
IsExists = path.isdir(dataDir) | |
if notIsExists: | |
os.makedirs(dataDir) | |
# Instantiate a new Workbook | |
book = Workbook() | |
# Add a Data Worksheet | |
dataSheet = book.worksheets.add("DataSheet") | |
# Add Chart Worksheet | |
sheet = book.worksheets.add("MyChart") | |
# Put some values into the cells in the data worksheet | |
dataSheet.cells.get("B1").put_value(1) | |
dataSheet.cells.get("B2").put_value(2) | |
dataSheet.cells.get("B3").put_value(3) | |
dataSheet.cells.get("A1").put_value("A") | |
dataSheet.cells.get("A2").put_value("B") | |
dataSheet.cells.get("A3").put_value("C") | |
# Define the Chart Collection | |
charts = sheet.charts | |
# Add a Column chart to the Chart Worksheet | |
chartSheetIdx = charts.add(ChartType.COLUMN, 5, 0, 25, 15) | |
# Get the newly added Chart | |
chart = book.worksheets[2].charts[0] | |
# Set the background/foreground color for PlotArea/ChartArea | |
chart.plot_area.area.background_color = Color.white | |
chart.chart_area.area.background_color = Color.white | |
chart.plot_area.area.foreground_color = Color.white | |
chart.chart_area.area.foreground_color = Color.white | |
# Hide the Legend | |
chart.show_legend = False | |
# Add Data Series for the Chart | |
chart.n_series.add("DataSheet!B1:B3", True) | |
# Specify the Category Data | |
chart.n_series.category_data = "DataSheet!A1:A3" | |
# Get the Data Series | |
ser = chart.n_series[0] | |
# Apply the 3-D formatting | |
spPr = ser.shape_properties | |
fmt3d = spPr.format_3d | |
# Specify Bevel with its height/width | |
bevel = fmt3d.top_bevel | |
bevel.type = BevelPresetType.CIRCLE | |
bevel.height = 2.0 | |
bevel.width = 5.0 | |
# Specify Surface material type | |
fmt3d.surface_material_type = PresetMaterialType.WARM_MATTE | |
# Specify surface lighting type | |
fmt3d.surface_lighting_type = LightRigType.THREE_POINT | |
# Specify lighting angle | |
fmt3d.lighting_angle = 20.0 | |
# Specify Series background/foreground and line color | |
ser.area.background_color = Color.maroon | |
ser.area.foreground_color = Color.maroon | |
ser.border.color = Color.maroon | |
# Save the Excel file | |
book.save(dataDir + "3d_format.out.xlsx") |