//create a new workbook 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, "S1", "S2", "S3"}, {"Product Item1", 10, 25, 25}, {"Product Item2", -51, -36, 27}, {"Product Item3", 52, -85, -30}, {"Product Item4", 22, 65, 65}, {"Product Item5", 23, 69, 69} }; worksheet.Range["A1:D6"].AutoFit(); // Create chart. shape.Chart.SeriesCollection.Add(worksheet.Range["A1:D6"], Drawing.RowCol.Columns, true, true); var categoryAxis = shape.Chart.Axes.Item(Drawing.AxisType.Category); // Set category axis label to be stacked, and the text reading order from right to left. categoryAxis.TickLabels.Direction = Drawing.TextDirection.StackedRtl; // Save to an excel file workbook.Save("SetChartTextDirection.xlsx");
' Create a new Workbook 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, "S1", "S2", "S3"}, {"Product Item1", 10, 25, 25}, {"Product Item2", -51, -36, 27}, {"Product Item3", 52, -85, -30}, {"Product Item4", 22, 65, 65}, {"Product Item5", 23, 69, 69} } worksheet.Range("A1:D6").AutoFit() 'create chart. shape.Chart.SeriesCollection.Add(worksheet.Range("A1:D6"), Drawing.RowCol.Columns, True, True) Dim categoryAxis As IAxis = shape.Chart.Axes.Item(Drawing.AxisType.Category) 'Set category axis label to be stacked, and the text reading order from right to left. categoryAxis.TickLabels.Direction = Drawing.TextDirection.StackedRtl ' save to an excel file workbook.Save("SetChartTextDirection.xlsx")