Interface IChartValueAxis
Represents the chart value axis.
Inherited Members
Namespace: Syncfusion.XlsIO
Assembly: Syncfusion.XlsIO.Base.dll
Syntax
public interface IChartValueAxis : IChartAxis
Properties
CrossesAt
Represents the point on the axis another axis crosses it.
Declaration
double CrossesAt { get; set; }
Property Value
Type |
---|
System.Double |
Examples
The following code illustrates how to set CrossesAt for charts.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create worksheet
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
//Add data
sheet.Range["A1"].Text = "Jan";
sheet.Range["B1"].Text = "Feb";
sheet.Range["C1"].Text = "Mar";
sheet.Range["A2"].Value = "10";
sheet.Range["B2"].Value = "20";
sheet.Range["C2"].Value = "30";
//Create chart
IChart chart = sheet.Charts.Add();
//Set range
chart.DataRange = sheet.Range["A1:C2"];
//Set chart value axis
IChartValueAxis valueAxis = chart.PrimaryValueAxis;
//Set cross at
valueAxis.CrossesAt = 15;
//Save and Dispose
workbook.SaveAs("Chart.xlsx");
workbook.Close();
}
CrossValue
Represents the point on the axis another axis crosses it.
Declaration
double CrossValue { get; set; }
Property Value
Type |
---|
System.Double |
Remarks
This property is obsolete. Please use CrossesAt instead of it
DisplayUnit
Returns or sets the unit label for the specified axis.
Declaration
ExcelChartDisplayUnit DisplayUnit { get; set; }
Property Value
Type |
---|
ExcelChartDisplayUnit |
Examples
By default the value axis displays no unit labels since DisplayUnitLabel is set to None by default. Here for example, we set Hundreds to DisplayUnitLabel.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create worksheet
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
//Add data
sheet.Range["A1"].Text = "Jan";
sheet.Range["B1"].Text = "Feb";
sheet.Range["C1"].Text = "Mar";
sheet.Range["A2"].Value = "10000";
sheet.Range["B2"].Value = "20000";
sheet.Range["C2"].Value = "30000";
//Create chart
IChart chart = sheet.Charts.Add();
//Set range
chart.DataRange = sheet.Range["A1:C2"];
//Set chart value axis
IChartValueAxis valueAxis = chart.PrimaryValueAxis;
//Set display unit
valueAxis.DisplayUnit = ExcelChartDisplayUnit.Hundreds;
//Save and Dispose
workbook.SaveAs("Chart.xlsx");
workbook.Close();
}
DisplayUnitCustom
Represents custom unit to display.
Declaration
double DisplayUnitCustom { get; set; }
Property Value
Type |
---|
System.Double |
Examples
The following code illustrates how to set custom units for charts.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create worksheet
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
//Add data
sheet.Range["A1"].Text = "Jan";
sheet.Range["B1"].Text = "Feb";
sheet.Range["C1"].Text = "Mar";
sheet.Range["A2"].Value = "10";
sheet.Range["B2"].Value = "20";
sheet.Range["C2"].Value = "30";
//Create chart
IChart chart = sheet.Charts.Add();
//Set range
chart.DataRange = sheet.Range["A1:C2"];
//Set chart value axis
IChartValueAxis valueAxis = chart.PrimaryValueAxis;
//Set display unit
valueAxis.DisplayUnit = ExcelChartDisplayUnit.Custom;
//Set display unit
valueAxis.DisplayUnitCustom = 5;
//Save and Dispose
workbook.SaveAs("Chart.xlsx");
workbook.Close();
}
DisplayUnitLabel
Returns the DisplayUnitLabel object for the specified axis. Returns Null if the HasDisplayUnitLabel property is set to False. Read-only.
Declaration
IChartTextArea DisplayUnitLabel { get; }
Property Value
Type |
---|
IChartTextArea |
Examples
The following code illustrates how to set fill foreground color to DisplayUnitLabel.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create worksheet
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
//Add data
sheet.Range["A1"].Text = "Jan";
sheet.Range["B1"].Text = "Feb";
sheet.Range["C1"].Text = "Mar";
sheet.Range["A2"].Value = "10000";
sheet.Range["B2"].Value = "20000";
sheet.Range["C2"].Value = "30000";
//Create chart
IChart chart = sheet.Charts.Add();
//Set range
chart.DataRange = sheet.Range["A1:C2"];
//Set chart value axis
IChartValueAxis valueAxis = chart.PrimaryValueAxis;
//Set display unit
valueAxis.DisplayUnit = ExcelChartDisplayUnit.Hundreds;
//Set Display unit label
IChartTextArea unitLabel = valueAxis.DisplayUnitLabel;
//Set label color
unitLabel.FrameFormat.Fill.ForeColorIndex = ExcelKnownColors.Pale_blue;
//Save and Dispose
workbook.SaveAs("Chart.xlsx");
workbook.Close();
}
HasDisplayUnitLabel
True if the label is displayed on the specified axis.
Declaration
bool HasDisplayUnitLabel { get; set; }
Property Value
Type |
---|
System.Boolean |
Examples
By default DisplayUnitLabel is set to None so display unit label will not be shown. Here for example, we set Hundreds to DisplayUnitLabel property so the display unit label will be visible.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create worksheet
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
//Add data
sheet.Range["A1"].Text = "Jan";
sheet.Range["B1"].Text = "Feb";
sheet.Range["C1"].Text = "Mar";
sheet.Range["A2"].Value = "10000";
sheet.Range["B2"].Value = "20000";
sheet.Range["C2"].Value = "30000";
//Create chart
IChart chart = sheet.Charts.Add();
//Set range
chart.DataRange = sheet.Range["A1:C2"];
//Set chart value axis
IChartValueAxis valueAxis = chart.PrimaryValueAxis;
//Set display unit
valueAxis.DisplayUnit = ExcelChartDisplayUnit.Hundreds;
//Check display unit label
Console.Write(valueAxis.HasDisplayUnitLabel);
//Save and Dispose
workbook.SaveAs("Chart.xlsx");
workbook.Close();
Console.ReadKey();
}
//Output will be
//True
IsAutoCross
Automatic category crossing point selected.
Declaration
bool IsAutoCross { get; set; }
Property Value
Type |
---|
System.Boolean |
Examples
The following code illustrates how to access IsAutoCross.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create worksheet
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
//Add data
sheet.Range["A1"].Text = "Jan";
sheet.Range["B1"].Text = "Feb";
sheet.Range["C1"].Text = "Mar";
sheet.Range["A2"].Value = "10";
sheet.Range["B2"].Value = "20";
sheet.Range["C2"].Value = "30";
//Create chart
IChart chart = sheet.Charts.Add();
//Set range
chart.DataRange = sheet.Range["A1:C2"];
//Set chart value axis
IChartValueAxis valueAxis = chart.PrimaryValueAxis;
//Set cross at
valueAxis.CrossesAt = 15;
//Check auto cross
Console.Write(valueAxis.IsAutoCross);
//Save and Dispose
workbook.SaveAs("Chart.xlsx");
workbook.Close();
Console.ReadKey();
}
//Output will be
//False
IsAutoMajor
Automatic major selected.
Declaration
bool IsAutoMajor { get; set; }
Property Value
Type |
---|
System.Boolean |
Examples
The following code illustrates how to access IsAutoMajor.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create worksheet
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
//Add data
sheet.Range["A1"].Text = "Jan";
sheet.Range["B1"].Text = "Feb";
sheet.Range["C1"].Text = "Mar";
sheet.Range["A2"].Value = "10";
sheet.Range["B2"].Value = "20";
sheet.Range["C2"].Value = "30";
//Create chart
IChart chart = sheet.Charts.Add();
//Set range
chart.DataRange = sheet.Range["A1:C2"];
//Set chart value axis
IChartValueAxis valueAxis = chart.PrimaryValueAxis;
//Check auto major and minor
Console.WriteLine(valueAxis.IsAutoMajor);
Console.WriteLine(valueAxis.IsAutoMinor);
//Save and Dispose
workbook.SaveAs("Chart.xlsx");
workbook.Close();
Console.ReadKey();
}
//Output will be
//True
//True
IsAutoMax
Automatic maximum selected.
Declaration
bool IsAutoMax { get; set; }
Property Value
Type |
---|
System.Boolean |
Examples
The following code illustrates how to access IsAutoMax.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create worksheet
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
//Add data
sheet.Range["A1"].Text = "Jan";
sheet.Range["B1"].Text = "Feb";
sheet.Range["C1"].Text = "Mar";
sheet.Range["A2"].Value = "10";
sheet.Range["B2"].Value = "20";
sheet.Range["C2"].Value = "30";
//Create chart
IChart chart = sheet.Charts.Add();
//Set range
chart.DataRange = sheet.Range["A1:C2"];
//Set chart value axis
IChartValueAxis valueAxis = chart.PrimaryValueAxis;
//Check auto max
Console.Write(valueAxis.IsAutoMax);
//Save and Dispose
workbook.SaveAs("Chart.xlsx");
workbook.Close();
Console.ReadKey();
}
//Output will be
//True
IsAutoMin
Automatic minimum selected.
Declaration
bool IsAutoMin { get; set; }
Property Value
Type |
---|
System.Boolean |
Examples
The following code illustrates how to access IsAutoMin.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create worksheet
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
//Add data
sheet.Range["A1"].Text = "Jan";
sheet.Range["B1"].Text = "Feb";
sheet.Range["C1"].Text = "Mar";
sheet.Range["A2"].Value = "10";
sheet.Range["B2"].Value = "20";
sheet.Range["C2"].Value = "30";
//Create chart
IChart chart = sheet.Charts.Add();
//Set range
chart.DataRange = sheet.Range["A1:C2"];
//Set chart value axis
IChartValueAxis valueAxis = chart.PrimaryValueAxis;
//Check auto min
Console.Write(valueAxis.IsAutoMin);
//Save and Dispose
workbook.SaveAs("Chart.xlsx");
workbook.Close();
Console.ReadKey();
}
//Output will be
//True
IsAutoMinor
Automatic minor selected.
Declaration
bool IsAutoMinor { get; set; }
Property Value
Type |
---|
System.Boolean |
Examples
The following code illustrates how to access IsAutoMinor.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create worksheet
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
//Add data
sheet.Range["A1"].Text = "Jan";
sheet.Range["B1"].Text = "Feb";
sheet.Range["C1"].Text = "Mar";
sheet.Range["A2"].Value = "10";
sheet.Range["B2"].Value = "20";
sheet.Range["C2"].Value = "30";
//Create chart
IChart chart = sheet.Charts.Add();
//Set range
chart.DataRange = sheet.Range["A1:C2"];
//Set chart value axis
IChartValueAxis valueAxis = chart.PrimaryValueAxis;
//Check auto major and minor
Console.WriteLine(valueAxis.IsAutoMajor);
Console.WriteLine(valueAxis.IsAutoMinor);
//Save and Dispose
workbook.SaveAs("Chart.xlsx");
workbook.Close();
Console.ReadKey();
}
//Output will be
//True
//True
IsLogScale
Logarithmic scale.
Declaration
bool IsLogScale { get; set; }
Property Value
Type |
---|
System.Boolean |
Examples
The following code illustrates how to set IsLogScale for charts.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create worksheet
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
//Add data
sheet.Range["A1"].Text = "Jan";
sheet.Range["B1"].Text = "Feb";
sheet.Range["C1"].Text = "Mar";
sheet.Range["A2"].Value = "10";
sheet.Range["B2"].Value = "20";
sheet.Range["C2"].Value = "30";
//Create chart
IChart chart = sheet.Charts.Add();
//Set range
chart.DataRange = sheet.Range["A1:C2"];
//Set chart value axis
IChartValueAxis valueAxis = chart.PrimaryValueAxis;
//Set IsLogScale
valueAxis.IsLogScale = true;
//Save and Dispose
workbook.SaveAs("Chart.xlsx");
workbook.Close();
}
IsMaxCross
Category axis to cross at maximum value.
Declaration
bool IsMaxCross { get; set; }
Property Value
Type |
---|
System.Boolean |
Examples
The following code illustrates how to access IsMaxCross.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create worksheet
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
//Add data
sheet.Range["A1"].Text = "Jan";
sheet.Range["B1"].Text = "Feb";
sheet.Range["C1"].Text = "Mar";
sheet.Range["A2"].Value = "10";
sheet.Range["B2"].Value = "20";
sheet.Range["C2"].Value = "30";
//Create chart
IChart chart = sheet.Charts.Add();
//Set range
chart.DataRange = sheet.Range["A1:C2"];
//Set chart value axis
IChartValueAxis valueAxis = chart.PrimaryValueAxis;
//Set IsMaxCross
valueAxis.IsMaxCross = true;
//Save and Dispose
workbook.SaveAs("Chart.xlsx");
workbook.Close();
}
LogBase
Returns or sets the base of the logarithm when you are using log scales. The default value is 10.
Declaration
double LogBase { get; set; }
Property Value
Type |
---|
System.Double |
Examples
The following code illustrates how to set LogBase for charts.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create worksheet
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
//Add data
sheet.Range["A1"].Text = "Jan";
sheet.Range["B1"].Text = "Feb";
sheet.Range["C1"].Text = "Mar";
sheet.Range["A2"].Value = "10";
sheet.Range["B2"].Value = "20";
sheet.Range["C2"].Value = "30";
//Create chart
IChart chart = sheet.Charts.Add();
//Set range
chart.DataRange = sheet.Range["A1:C2"];
//Set chart value axis
IChartValueAxis valueAxis = chart.PrimaryValueAxis;
//Set IsLogScale and log base
valueAxis.IsLogScale = true;
valueAxis.LogBase = 2;
//Save and Dispose
workbook.SaveAs("Chart.xlsx");
workbook.Close();
}
MajorUnit
Value of major increment.
Declaration
double MajorUnit { get; set; }
Property Value
Type |
---|
System.Double |
Examples
The following code illustrates how to set major axis increment unit for charts.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create worksheet
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
//Add data
sheet.Range["A1"].Text = "Jan";
sheet.Range["B1"].Text = "Feb";
sheet.Range["C1"].Text = "Mar";
sheet.Range["A2"].Value = "10";
sheet.Range["B2"].Value = "20";
sheet.Range["C2"].Value = "30";
//Create chart
IChart chart = sheet.Charts.Add();
//Set range
chart.DataRange = sheet.Range["A1:C2"];
//Set chart value axis
IChartValueAxis valueAxis = chart.PrimaryValueAxis;
//Set major unit
valueAxis.MajorUnit = 20;
//Save and Dispose
workbook.SaveAs("Chart.xlsx");
workbook.Close();
}
MaximumValue
Maximum value on axis.
Declaration
double MaximumValue { get; set; }
Property Value
Type |
---|
System.Double |
Examples
The following code illustrates how to set MinimumValue and MaximumValue for charts.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create worksheet
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
//Add data
sheet.Range["A1"].Text = "Jan";
sheet.Range["B1"].Text = "Feb";
sheet.Range["C1"].Text = "Mar";
sheet.Range["A2"].Value = "10";
sheet.Range["B2"].Value = "20";
sheet.Range["C2"].Value = "30";
//Create chart
IChart chart = sheet.Charts.Add();
//Set range
chart.DataRange = sheet.Range["A1:C2"];
//Set chart value axis
IChartValueAxis valueAxis = chart.PrimaryValueAxis;
//Set minimum and maximum value
valueAxis.MinimumValue = -20;
valueAxis.MaximumValue = 60;
//Save and Dispose
workbook.SaveAs("Chart.xlsx");
workbook.Close();
}
MinimumValue
Minimum value on axis.
Declaration
double MinimumValue { get; set; }
Property Value
Type |
---|
System.Double |
Examples
The following code illustrates how to set MinimumValue and MaximumValue for charts.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create worksheet
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
//Add data
sheet.Range["A1"].Text = "Jan";
sheet.Range["B1"].Text = "Feb";
sheet.Range["C1"].Text = "Mar";
sheet.Range["A2"].Value = "10";
sheet.Range["B2"].Value = "20";
sheet.Range["C2"].Value = "30";
//Create chart
IChart chart = sheet.Charts.Add();
//Set range
chart.DataRange = sheet.Range["A1:C2"];
//Set chart value axis
IChartValueAxis valueAxis = chart.PrimaryValueAxis;
//Set minimum and maximum value
valueAxis.MinimumValue = -20;
valueAxis.MaximumValue = 60;
//Save and Dispose
workbook.SaveAs("Chart.xlsx");
workbook.Close();
}
MinorUnit
Value of minor increment.
Declaration
double MinorUnit { get; set; }
Property Value
Type |
---|
System.Double |
Examples
The following code illustrates how to set minor axis increment unit for charts.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create worksheet
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
//Add data
sheet.Range["A1"].Text = "Jan";
sheet.Range["B1"].Text = "Feb";
sheet.Range["C1"].Text = "Mar";
sheet.Range["A2"].Value = "10";
sheet.Range["B2"].Value = "20";
sheet.Range["C2"].Value = "30";
//Create chart
IChart chart = sheet.Charts.Add();
//Set range
chart.DataRange = sheet.Range["A1:C2"];
//Set chart value axis
IChartValueAxis valueAxis = chart.PrimaryValueAxis;
//Set minor unit
valueAxis.MinorUnit = 8;
//Save and Dispose
workbook.SaveAs("Chart.xlsx");
workbook.Close();
}