// 新規ワークブックの作成 var workbook = new GrapeCity.Documents.Excel.Workbook(); IWorksheet worksheet = workbook.Worksheets[0]; var shape = worksheet.Shapes.AddChart(Drawing.ChartType.ColumnClustered, 300, 10, 300, 300); worksheet.Range["A1:D6"].Value = new object[,] { {null, "系列1", "系列2", "系列3"}, {"項目1", 10, 25, 25}, {"項目2", -51, -36, 27}, {"項目3", 52, -85, -30}, {"項目4", 22, 65, 65}, {"項目5", 23, 69, 69} }; // チャートを作成 shape.Chart.SeriesCollection.Add(worksheet.Range["A1:D6"], Drawing.RowCol.Columns, true, true); var categoryAxis = shape.Chart.Axes.Item(Drawing.AxisType.Category); shape.Chart.HasTitle = false; // 横軸ラベルのテキストの方向を縦書き(半角文字含む)かつ並びを右から左に設定 categoryAxis.TickLabels.Direction = Drawing.TextDirection.StackedRtl; // xlsx ファイルに保存 workbook.Save("SetChartTextDirection.xlsx");
' 新規ワークブックの作成 Dim workbook As New Workbook Dim worksheet As IWorksheet = workbook.Worksheets(0) Dim shape As IShape = worksheet.Shapes.AddChart(ChartType.ColumnClustered, 300, 10, 300, 300) worksheet.Range("A1:D6").Value = New Object(,) { {Nothing, "系列1", "系列2", "系列3"}, {"項目1", 10, 25, 25}, {"項目2", -51, -36, 27}, {"項目3", 52, -85, -30}, {"項目4", 22, 65, 65}, {"項目5", 23, 69, 69} } ' チャートを作成 shape.Chart.SeriesCollection.Add(worksheet.Range("A1:D6"), Drawing.RowCol.Columns, True, True) Dim categoryAxis As IAxis = shape.Chart.Axes.Item(Drawing.AxisType.Category) shape.Chart.HasTitle = False ' 横軸ラベルのテキストの方向を縦書き(半角文字含む)かつ並びを右から左に設定 categoryAxis.TickLabels.Direction = Drawing.TextDirection.StackedRtl ' xlsx ファイルに保存 workbook.Save("SetChartTextDirection.xlsx")