//create a new workbook 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, "S1"}, {"Item1", -20}, {"Item2", 30}, {"Item3", 50 }, {"Item3", 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; // Set series1's all data labels' angle. series1.DataLabels.Orientation = 45; // Set series1's specific data label's angle. series1.DataLabels[2].Orientation = -45; // Save to an excel file workbook.Save("ConfigDataLabelAngle.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, 250, 20, 360, 230) worksheet.Range("A1:B5").Value = New Object(,) { {Nothing, "S1"}, {"Item1", -20}, {"Item2", 30}, {"Item3", 50}, {"Item3", 40} } shape.Chart.SeriesCollection.Add(worksheet.Range("A1:B5"), RowCol.Columns, True, True) Dim series1 As ISeries = shape.Chart.SeriesCollection(0) series1.HasDataLabels = True ' set series1's all data labels' angle. series1.DataLabels.Orientation = 45 ' set series1's specific data label's angle. series1.DataLabels(2).Orientation = -45 ' save to an excel file workbook.Save("ConfigDataLabelAngle.xlsx")