Grafik Oluşturma

Oluşturma Grafikleri

Aspose.Cells API’leri, Excel Grafiklerini herhangi bir ek araç veya uygulama gerektirmeden resimlere ve PDF biçimlerine dönüştürmeyi destekler. Render desteği sağlamak için,Çizelge sınıf açığa çıktıHayal etmek & ToPdfuygulama gereksinimlerine en iyi uyacak şekilde aşırı yükleme verisine sahip yöntemler.

Grafikleri Görüntülere Dönüştürme

buChart.ToImage & ToPdf yöntem, hem basit hem de gelişmiş işlemeyi desteklemek için çeşitli aşırı yüklemelere sahiptir. Uygulama gereksinimi, grafiği varsayılan boyutlarında oluşturmaksa,Chart.ToImageaşağıdaki gibi yöntem.

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// Instantiating a Workbook object
Workbook workbook = new Workbook();
// Adding a new worksheet to the Workbook
int sheetIndex = workbook.Worksheets.Add();
// Obtaining the reference of the newly added worksheet by passing its index to WorksheetCollection
Worksheet worksheet = workbook.Worksheets[sheetIndex];
// Adding sample values to cells
worksheet.Cells["A1"].PutValue(50);
worksheet.Cells["A2"].PutValue(100);
worksheet.Cells["A3"].PutValue(150);
worksheet.Cells["B1"].PutValue(4);
worksheet.Cells["B2"].PutValue(20);
worksheet.Cells["B3"].PutValue(50);
// Adding a chart to the worksheet
int chartIndex = worksheet.Charts.Add(Aspose.Cells.Charts.ChartType.Column, 5, 0, 15, 5);
// Accessing the instance of the newly added chart
Aspose.Cells.Charts.Chart chart = worksheet.Charts[chartIndex];
// Adding Series Collection (chart data source) to the chart ranging from "A1" cell to "B3"
chart.NSeries.Add("A1:B3", true);
// Converting chart to image
chart.ToImage(dataDir + "chartEMF_out.emf", ImageType.Emf);
// Converting chart to Bitmap
System.Drawing.Bitmap bitmap = chart.ToImage();
bitmap.Save(dataDir + "chartBMP_out.bmp", System.Drawing.Imaging.ImageFormat.Bmp);

Grafikleri gelişmiş ayarlarla görüntülere dönüştürmek de mümkündür. Aspose.Cells API’ler, bir aşırı yük sürümünü kullanıma sunduChart.ToImage örneğini kabul edebilecek bir yöntemResimVeyaBaskıSeçenekleri, çözünürlük, yumuşatma modu, görüntü formatı vb. gibi parametreleri belirlemeye izin verirken.

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// Instantiating a Workbook object
Workbook workbook = new Workbook();
// Adding a new worksheet to the Workbook
int sheetIndex = workbook.Worksheets.Add();
// Obtaining the reference of the newly added worksheet by passing its index to WorksheetCollection
Worksheet worksheet = workbook.Worksheets[sheetIndex];
// Adding sample values to cells
worksheet.Cells["A1"].PutValue(50);
worksheet.Cells["A2"].PutValue(100);
worksheet.Cells["A3"].PutValue(150);
worksheet.Cells["B1"].PutValue(4);
worksheet.Cells["B2"].PutValue(20);
worksheet.Cells["B3"].PutValue(50);
// Adding a chart to the worksheet
int chartIndex = worksheet.Charts.Add(Aspose.Cells.Charts.ChartType.Column, 5, 0, 15, 5);
// Accessing the instance of the newly added chart
Aspose.Cells.Charts.Chart chart = worksheet.Charts[chartIndex];
// Adding Series Collection (chart data source) to the chart ranging from "A1" cell to "B3"
chart.NSeries.Add("A1:B3", true);
// Create an instance of ImageOrPrintOptions and set a few properties
ImageOrPrintOptions options = new ImageOrPrintOptions()
{
VerticalResolution = 300,
HorizontalResolution = 300,
SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias
};
// Convert chart to image with additional settings
chart.ToImage(dataDir + "chartPNG_out.png", options);

Tabloyu PDF’e Oluşturma

Grafiği PDF biçimine dönüştürmek için Aspose.Cells API’leriChart.ToPdfelde edilen PDF’i disk yolunda veya Akışta saklama yeteneğine sahip yöntem.

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// Instantiating a Workbook object
Workbook workbook = new Workbook();
// Adding a new worksheet to the Workbook
int sheetIndex = workbook.Worksheets.Add();
// Obtaining the reference of the newly added worksheet by passing its index to WorksheetCollection
Worksheet worksheet = workbook.Worksheets[sheetIndex];
// Adding sample values to cells
worksheet.Cells["A1"].PutValue(50);
worksheet.Cells["A2"].PutValue(100);
worksheet.Cells["A3"].PutValue(150);
worksheet.Cells["B1"].PutValue(4);
worksheet.Cells["B2"].PutValue(20);
worksheet.Cells["B3"].PutValue(50);
// Adding a chart to the worksheet
int chartIndex = worksheet.Charts.Add(Aspose.Cells.Charts.ChartType.Column, 5, 0, 15, 5);
// Accessing the instance of the newly added chart
Aspose.Cells.Charts.Chart chart = worksheet.Charts[chartIndex];
// Adding Series Collection (chart data source) to the chart ranging from "A1" cell to "B3"
chart.NSeries.Add("A1:B3", true);
// Converting chart to PDF
chart.ToPdf(dataDir + "chartPDF_out.pdf");

Oluşturma için Desteklenen Grafik Türleri

Şu anda işleme için desteklenmeyen birkaç grafik türü vardır. Bu tür grafik türleri şunları içerir:** içinde N****Aşağıdaki tablonun desteklenen** sütunu.

Grafik tipi Grafik alt türü desteklenen
Kolon Kolon e
SütunYığılmış e
Sütun100YığılmışYüzde e
Sütun3Dkümelenmiş e
Sütun3DSığılmış e
Sütun3D100YığılmışYüzde e
Sütun3D e
Bar Bar e
Çubuk Yığılmış e
Bar100YığılmışYüzde e
Bar3Dkümelenmiş e
Bar3DSyığılmış e
Bar3D100YığılmışYüzde e
Astar Astar e
Sıra Yığılmış e
Line100PercentYığılmış e
LineWithDataMarkers e
LineStackedWithDataMarkers e
Line100PercentStackedWithDataMarkers e
Çizgi3D e
Turta Turta e
Pasta3D e
Turta Turtası e
PastaPatladı e
Pie3DEpatladı e
pasta çubuğu e
Dağılım Dağılım e
DağılımConnectedByCurvesWithDataMarker e
ScatterConnectedByCurvesWithoutDataMarker e
ScatterConnectedByLinesWithDataMarker e
ScatterConnectedByLinesWithoutDataMarker e
Alan Alan e
Yığılmış Alan e
Alan100YığılmışYüzde e
Alan3D e
Alan3Dyığınlanmış e
Alan3D100YığılmışYüzde e
Tatlı çörek Tatlı çörek e
DonutPatladı e
Radar Radar e
RadarWithDataMarkers e
Radar Dolu e
Yüzey Yüzey3D N
SurfaceWireframe3D N
Yüzey Konturu N
Yüzey Kontur Tel Kafes N
kabarcık kabarcık e
Bubble3D N
Stoklamak StokYüksekDüşükKapat e
StokAçıkYüksekDüşükKapat e
StokHacimYüksekDüşükKapat e
Stok HacmiAçıkYüksekDüşükKapalı e
silindir silindir e
Silindir Yığılmış e
Cylinder100PercentYığılmış e
Silindirik Çubuk e
Silindirik ÇubukYığılmış e
SilindirikÇubukYüzde100Yığılmış e
Silindirik Sütun3D e
koni koni e
koni yığılmış e
Koni100YüzdeYığılmış e
Konik Çubuk e
Konik ÇubukYığılmış e
ConicalBar100PercentYığılmış e
Konik Sütun3D e
Piramit Piramit e
PiramitYığılmış e
Piramit100YüzdeYığılmış e
PiramitBar e
PiramitÇubuğuYığılmış e
PiramitBar100PercentYığınlanmış e
PiramitSütun3D e
KutuBıyık KutuBıyık Y
Huni Huni e
ParetoLine ParetoLine e
güneş patlaması güneş patlaması e
ağaç haritası ağaç haritası e
Şelale Şelale e
histogram histogram Y
Harita Harita N

ileri konular