AxisBase.LogarithmicBase Property
Gets or sets a value specifying a logarithmic base when the AxisBase.Logarithmic property is enabled.
Namespace: DevExpress.XtraCharts
Assembly: DevExpress.XtraCharts.v22.2.dll
NuGet Package: DevExpress.Charts
Declaration
[XtraChartsLocalizableCategory(XtraChartsCategory.Behavior)]
public virtual double LogarithmicBase { get; set; }
Property Value
Type | Description |
---|---|
Double | A Double value which specifies the logarithmic base. |
Remarks
If a chart’s series have their SeriesBase.ArgumentScaleType or SeriesBase.ValueScaleType properties set to ScaleType.Numerical, you can use the AxisBase.Logarithmic property to specify whether the logarithmic scale should be used to display axis values. When it is set to true, you can also define a logarithmic base value via the LogarithmicBase property.
Via the LogarithmicBase property, you can define a base value to a logarithm, which will be used to calculate the axis values.
The following images demonstrate how the LogarithmicBase property works.
LogarithmicBase = 10 | LogarithmicBase = 20 |
---|---|
![]() |
![]() |
Example
This example demonstrates how to use a logarithmic scale in XtraCharts, which is disabled by default.
Note
The logarithmic scale is only compatible with the numerical scale type.
To enable it, simply set the AxisBase.Logarithmic property to true, and set the AxisBase.LogarithmicBase
property to the value required in your scenario.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/how-to-show-numerical-data-using-a-logarithmic-scale-e941
using System;
using System.Windows.Forms;
using DevExpress.XtraCharts;
namespace LogarithmicScale {
public partial class Form1 : Form {
public Form1() {
InitializeComponent();
}
private void btnLogarithm10_Click(object sender, EventArgs e) {
AxisY axis = ((XYDiagram)chartControl1.Diagram).AxisY;
axis.Logarithmic = true;
axis.LogarithmicBase = 10;
axis.WholeRange.AlwaysShowZeroLevel = false;
}
private void btnLogarithm100_Click(object sender, EventArgs e) {
AxisY axis = ((XYDiagram)chartControl1.Diagram).AxisY;
axis.Logarithmic = true;
axis.LogarithmicBase = 100;
axis.WholeRange.AlwaysShowZeroLevel = false;
}
private void btnDisableLogarithm_Click(object sender, EventArgs e) {
AxisY axis = ((XYDiagram)chartControl1.Diagram).AxisY;
axis.Logarithmic = false;
axis.WholeRange.AlwaysShowZeroLevel = true;
}
}
}
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the LogarithmicBase 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.