// 新規ワークブックの作成 var workbook = new GrapeCity.Documents.Excel.Workbook(); IWorksheet worksheet = workbook.Worksheets[0]; GrapeCity.Documents.Excel.Drawing.IShape shape = worksheet.Shapes.AddChart(GrapeCity.Documents.Excel.Drawing.ChartType.ColumnClustered, 250, 20, 360, 230); worksheet.Range["A1:B5"].Value = new object[,] { { null, "系列1" }, { "項目1", -20 }, { "項目2", 30 }, { "項目3", 50 }, { "項目4", 40 } }; shape.Chart.SeriesCollection.Add(worksheet.Range["A1:B5"], GrapeCity.Documents.Excel.Drawing.RowCol.Columns, true, true); GrapeCity.Documents.Excel.Drawing.ISeries series1 = shape.Chart.SeriesCollection[0]; series1.HasDataLabels = true; // series1 のすべてのデータラベルの角度を設定 series1.DataLabels.Orientation = 45; // series1 の特定のデータラベルの角度を設定 series1.DataLabels[2].Orientation = -45; // xlsx ファイルに保存 workbook.Save("ConfigDataLabelAngle.xlsx");
' 新規ワークブックの作成 Dim workbook As New Workbook Dim worksheet As IWorksheet = workbook.Worksheets(0) Dim shape As IShape = worksheet.Shapes.AddChart(ChartType.ColumnClustered, 250, 20, 360, 230) worksheet.Range("A1:B5").Value = New Object(,) { {Nothing, "系列1"}, {"項目1", -20}, {"項目2", 30}, {"項目3", 50}, {"項目4", 40} } shape.Chart.SeriesCollection.Add(worksheet.Range("A1:B5"), RowCol.Columns, True, True) Dim series1 As ISeries = shape.Chart.SeriesCollection(0) series1.HasDataLabels = True ' series1 のすべてのデータラベルの角度を設定 series1.DataLabels.Orientation = 45 ' series1 の特定のデータラベルの角度を設定 series1.DataLabels(2).Orientation = -45 ' xlsx ファイルに保存 workbook.Save("ConfigDataLabelAngle.xlsx")