//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, 20, 200, 360, 230); worksheet.Range["A1:D6"].Value = new object[,] { {null, "S1", "S2", "S3"}, {1, -25, 25, 25}, {2, 51, 36, 27}, {3, 52, 80, 30}, {4, 22, -20, 65}, {5, 23, 69, 69} }; shape.Chart.SeriesCollection.Add(worksheet.Range["A1:D6"], GrapeCity.Documents.Excel.Drawing.RowCol.Columns, true, true); GrapeCity.Documents.Excel.Drawing.IAxis category_axis = shape.Chart.Axes.Item(GrapeCity.Documents.Excel.Drawing.AxisType.Category); GrapeCity.Documents.Excel.Drawing.IAxis value_axis = shape.Chart.Axes.Item(GrapeCity.Documents.Excel.Drawing.AxisType.Value); //config tick label's format category_axis.TickLabelPosition = GrapeCity.Documents.Excel.Drawing.TickLabelPosition.NextToAxis; category_axis.TickLabelSpacing = 2; category_axis.TickLabels.Font.Color.RGB = System.Drawing.Color.DarkOrange; category_axis.TickLabels.Font.Size = 12; category_axis.TickLabels.NumberFormat = "#,##0.00"; value_axis.TickLabels.NumberFormat = "#,##0;[Red]#,##0"; // Save to a pdf file workbook.Save("AxisLabelNumberformatPdf.pdf");
' 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, 20, 200, 360, 230) worksheet.Range("A1:D6").Value = New Object(,) { {Nothing, "S1", "S2", "S3"}, {1, -25, 25, 25}, {2, 51, 36, 27}, {3, 52, 80, 30}, {4, 22, -20, 65}, {5, 23, 69, 69} } shape.Chart.SeriesCollection.Add(worksheet.Range("A1:D6"), RowCol.Columns, True, True) With shape.Chart.Axes.Item(AxisType.Category) 'config tick label's format .TickLabelPosition = TickLabelPosition.NextToAxis .TickLabelSpacing = 2 .TickLabels.Font.Color.RGB = Color.DarkOrange .TickLabels.Font.Size = 12 .TickLabels.NumberFormat = "#,##0.00" End With Dim value_axis As IAxis = shape.Chart.Axes.Item(AxisType.Value) value_axis.TickLabels.NumberFormat = "#,##0;[Red]#,##0" ' save to a pdf file workbook.Save("AxisLabelNumberformatPdf.pdf")