Back to Devexpress

AxisScaling.LogScale Property

officefileapi-devexpress-dot-spreadsheet-dot-charts-dot-axisscaling-5a02a719.md

latest6.9 KB
Original Source

AxisScaling.LogScale Property

Gets or sets a value indicating whether the value axis should display its numerical values using a logarithmic scale.

Namespace : DevExpress.Spreadsheet.Charts

Assembly : DevExpress.Spreadsheet.v25.2.Core.dll

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
bool LogScale { get; set; }
vb
Property LogScale As Boolean

Property Value

TypeDescription
Boolean

true , to use the logarithmic axis; otherwise, false.

|

Remarks

Set the LogScale property to true to enable the logarithmic display of axis values. In this case, you can define the logarithm base using the AxisScaling.LogBase property.

Usually, the LogScale property is used when the data range of a chart’s series has significant disparity. By enabling this property, the chart’s numerical axis displays all values using logarithmic equivalents. In short, if the logarithmic base is 10 , only 5 uniform axis steps will exist between 10 and 1,000,000.

The following table illustrates how the LogScale property works.

|

LogScale = false

|

LogScale = true

LogBase = 10

| | --- | --- | |

|

|

Example

The example below demonstrates how to create a simple line chart and change the value axis to logarithmic using the AxisScaling.LogScale property. The logarithmic base, defined by the AxisScaling.LogBase property, is set to 10.

View Example

csharp
Worksheet worksheet = workbook.Worksheets["chartTask5"];
workbook.Worksheets.ActiveWorksheet = worksheet;

// Create a chart and specify its location.
Chart chart = worksheet.Charts.Add(ChartType.Line, worksheet["B2:D8"]);
chart.TopLeftCell = worksheet.Cells["F2"];
chart.BottomRightCell = worksheet.Cells["L15"];

// Set the logarithmic(Log10) type of scale.
chart.PrimaryAxes[1].Scaling.LogScale = true;
chart.PrimaryAxes[1].Scaling.LogBase = 10;

// Set the position of the legend on the chart.
chart.Legend.Position = LegendPosition.Bottom;
vb
Dim worksheet As Worksheet = workbook.Worksheets("chartTask5")
workbook.Worksheets.ActiveWorksheet = worksheet

' Create a chart and specify its location.
Dim chart As Chart = worksheet.Charts.Add(ChartType.Line, worksheet("B2:D8"))
chart.TopLeftCell = worksheet.Cells("F2")
chart.BottomRightCell = worksheet.Cells("L15")

' Set the logarithmic(Log10) type of scale.
chart.PrimaryAxes(1).Scaling.LogScale = True
chart.PrimaryAxes(1).Scaling.LogBase = 10

' Set the position of the legend on the chart.
chart.Legend.Position = LegendPosition.Bottom

The following code snippets (auto-collected from DevExpress Examples) contain references to the LogScale property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

wpf-spreadsheet-chart-api/CS/SpreadsheetWPFChartAPISamples/CodeExamples/AxesActions.cs#L187

csharp
// Set the logarithmic(Log10) type of scale.
chart.PrimaryAxes[1].Scaling.LogScale = true;
chart.PrimaryAxes[1].Scaling.LogBase = 10;

winforms-spreadsheet-chart-api/CS/SpreadsheetChartAPISamples/CodeExamples/AxesActions.cs#L187

csharp
// Set the logarithmic(Log10) type of scale.
chart.PrimaryAxes[1].Scaling.LogScale = true;
chart.PrimaryAxes[1].Scaling.LogBase = 10;

spreadsheet-document-api-chart-examples/CS/SpreadsheetDocServerChartAPISamples/CodeExamples/AxesActions.cs#L197

csharp
// Set the logarithmic(Log10) type of scale.
chart.PrimaryAxes[1].Scaling.LogScale = true;
chart.PrimaryAxes[1].Scaling.LogBase = 10;

wpf-spreadsheet-chart-api/VB/SpreadsheetWPFChartAPISamples/CodeExamples/AxesActions.vb#L191

vb
' Set the logarithmic(Log10) type of scale.
chart.PrimaryAxes(1).Scaling.LogScale = True
chart.PrimaryAxes(1).Scaling.LogBase = 10

winforms-spreadsheet-chart-api/VB/SpreadsheetChartAPISamples/CodeExamples/AxesActions.vb#L190

vb
' Set the logarithmic(Log10) type of scale.
chart.PrimaryAxes(1).Scaling.LogScale = True
chart.PrimaryAxes(1).Scaling.LogBase = 10

spreadsheet-document-api-chart-examples/VB/SpreadsheetDocServerChartAPISamples/CodeExamples/AxesActions.vb#L200

vb
' Set the logarithmic(Log10) type of scale.
chart.PrimaryAxes(1).Scaling.LogScale = True
chart.PrimaryAxes(1).Scaling.LogBase = 10

See Also

LogBase

AxisScaling Interface

AxisScaling Members

DevExpress.Spreadsheet.Charts Namespace