Z軸
Contents
[
Hide
]
考えられる使用シナリオ
3-D 縦棒グラフ、3-D 円錐形、または 3-D ピラミッドなどの一部の 3-D グラフでは、深さ (系列) 軸 (Z 軸とも呼ばれる) を変更できます。目盛りの間隔や軸ラベルなどの操作を指定できます。
Microsoft Excel のように第 1 軸と第 2 軸を処理する
新しい Excel ファイルを作成し、グラフの値を最初のワークシートに入れる次のサンプル コードを参照してください。次に、チャートを追加し、チャート タイプを Column3D に設定すると、深さ軸とも呼ばれる Z 軸が表示されます。
サンプルコード
This file contains 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
// Create an instance of Workbook | |
Workbook workbook = new Workbook(); | |
// Get the first worksheet | |
Worksheet worksheet = workbook.Worksheets[0]; | |
// Put values to cells for creating chart | |
worksheet.Cells["A1"].PutValue("A"); | |
worksheet.Cells["B1"].PutValue("B"); | |
worksheet.Cells["C1"].PutValue("C"); | |
worksheet.Cells["A2"].PutValue(2); | |
worksheet.Cells["A3"].PutValue(1); | |
worksheet.Cells["B2"].PutValue(2); | |
worksheet.Cells["B3"].PutValue(3); | |
worksheet.Cells["C2"].PutValue(2); | |
worksheet.Cells["C3"].PutValue(3); | |
// Add a chart to the worksheet | |
int chartIndex = worksheet.Charts.Add(Aspose.Cells.Charts.ChartType.Column3D, 9, 6, 25, 16); | |
// Access the instance of the newly added chart | |
Aspose.Cells.Charts.Chart chart = worksheet.Charts[chartIndex]; | |
// Calculate the hart | |
chart.Calculate(); | |
// Add SeriesCollection (chart data source) to the chart ranging from "A2" cell to "C3" | |
chart.SetChartDataRange("A2:C3", true); | |
// Hide the CategoryAxis axis | |
chart.CategoryAxis.IsVisible = false; | |
// Hide the ValueAxis axis | |
chart.ValueAxis.IsVisible = false; | |
// Save the file | |
workbook.Save("ZAxis.xlsx"); |