Get Started
Documentation

ApiChart

new ApiChart()

Class representing a chart.

Methods

Name Description
ApplyChartStyle

Apply set of visual settings for chart

GetClassType

Get the type of this class.

SetHorAxisLablesFontSize

Specifies font size for labels of horizontal axis

SetHorAxisMajorTickMark

Specifies major tick mark for horizontal axis

SetHorAxisMinorTickMark

Specifies minor tick mark for horizontal axis

SetHorAxisOrientation

Specifies the direction of the data displayed on the horizontal axis.

SetHorAxisTickLabelPosition

Set the possible values for the position of the chart tick labels in relation to the main horizontal label or the values of the chart data.

SetHorAxisTitle

Specify the chart horizontal axis title.

SetLegendFontSize

Specifies a legend position

SetLegendPos

Specify the chart legend position.

SetMajorHorizontalGridlines

Specifies major horizontal gridline's visual properties

SetMajorVerticalGridlines

Specifies major vertical gridline's visual properties

SetMinorHorizontalGridlines

Specifies minor vertical gridline's visual properties

SetMinorVerticalGridlines

Specifies minor vertical gridline's visual properties

SetShowDataLabels

Specifies which chart data labels are shown for the chart.

SetShowPointDataLabel

Spicifies a show options for data labels

SetTitle

Specify the chart title.

SetVerAxisOrientation

Specifies the direction of the data displayed on the vertical axis.

SetVerAxisTitle

Specify the chart vertical axis title.

SetVertAxisLablesFontSize

Specifies font size for labels of vertical axis

SetVertAxisMajorTickMark

Specifies major tick mark for vertical axis

SetVertAxisMinorTickMark

Specifies minor tick mark for vertical axis

SetVertAxisTickLabelPosition

Set the possible values for the position of the chart tick labels in relation to the main vertical label or the values of the chart data.

Example

Copy code
builder.CreateFile("xlsx");
var oWorksheet = Api.GetActiveSheet();
oWorksheet.SetName("sheet 1");
oWorksheet.GetRange("B1").SetValue("Row 1");
oWorksheet.GetRange("C1").SetValue("Row 2");
oWorksheet.GetRange("D1").SetValue("Row 3");
oWorksheet.GetRange("A2").SetValue("Category 1");
oWorksheet.GetRange("A3").SetValue("Category 2");
oWorksheet.GetRange("A4").SetValue("Category 3");
oWorksheet.GetRange("A5").SetValue("Category 4");
oWorksheet.GetRange("B2").SetValue("4.3");
oWorksheet.GetRange("B3").SetValue("2.5");
oWorksheet.GetRange("B4").SetValue("3.5");
oWorksheet.GetRange("B5").SetValue("4.5");
oWorksheet.GetRange("C2").SetValue("2.4");
oWorksheet.GetRange("C3").SetValue("4.4");
oWorksheet.GetRange("C4").SetValue("1.8");
oWorksheet.GetRange("C5").SetValue("2.8");
oWorksheet.GetRange("D2").SetValue("2");
oWorksheet.GetRange("D3").SetValue("2");
oWorksheet.GetRange("D4").SetValue("3");
oWorksheet.GetRange("D5").SetValue("5");
var oChart = oWorksheet.AddChart("'sheet 1'!$A$1:$D$5", true, "bar", 2, 100 * 36000, 70 * 36000, 5, 2 * 36000, 1, 3 * 36000);
oChart.SetVerAxisTitle("Vertical Title", 10);
oChart.SetHorAxisTitle("Horizontal Title", 11);
oChart.SetLegendPos("right");
oChart.SetShowDataLabels(false, false, true, false);
oChart.SetTitle("Main Chart Title", 13);
builder.SaveFile("xlsx", "ApiChart.xlsx");
builder.CloseFile();

Resulting document