Help us shape the 2021 DevExtreme Roadmap. Take our 5 minute survey.
Your search did not match any results.

# Logarithmic vs Linear Axes

The Chart UI component supports two numeric axis types: linear (or continuous) and logarithmic. This demo shows two charts that display the same data but use different axis types. The bottom chart uses a linear axis, which makes it hard to analyze smaller value changes. For the top chart, a logarithmic Y axis is used to increase data readability.

Logarithmic scales increment values not by adding a constant number, but by multiplying it by a specific factor - logarithmBase. On a base 10 scale, the visual range between 1 and 10 will be the same as range between 10 and 100. This makes it easier to analyze data that has high peaks, yet requires you to review changes for small argument values too.

Graphs in this demo display negative and zero values, and this scenario needs special consideration if you use logarithmic axes. The chart can build and unlimited number of tick marks that never reach 0 - 100, 10, 1, 0.1, 0.01, 0.001, and so on. To cut off this sequence, set the linearThreshold property. In this demo, it is set to -3, which means that between -10-3 and 10-3, or between -0.001 and 0.001, the chart uses linear data presentation.

### ASP.NET MVC

@(Html.DevExtreme().Chart() .ID("chart") .Title("Damped Sine Wave") .Panes(p => { p.Add().Name("top"); p.Add().Name("bottom"); }) .Series(s => { s.Add().Pane("top"); s.Add().Pane("bottom"); }) .DataSource(Enumerable.Range(0, 600).Select(x => { var argument = (Double)x / 100; return new { arg = argument, val = Math.Exp(-argument) * Math.Cos(2 * Math.PI * argument) }; })) .CommonAxisSettings(c => c.EndOnTick(false)) .ValueAxis(v => { v.Add() .Type(AxisScaleType.Logarithmic) .LinearThreshold(-3) .Title("Logarithmic Axis") .Pane("top"); v.Add() .Title("Linear Axis") .Pane("bottom"); }) .Legend(l=>l.Visible(false)) .Tooltip(t=>t .Enabled(true) .Format(Format.Exponential)) .Crosshair(c=>c .Enabled(true) .HorizontalLine(l=>l.Visible(false)) .Label(l=>l .Visible(true) .Format(f=>f .Type(Format.FixedPoint) .Precision(2) ) ) ) )
using DevExtreme.AspNet.Data; using DevExtreme.AspNet.Mvc; using DevExtreme.MVC.Demos.Models.SampleData; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; using System.Web.Mvc; namespace DevExtreme.MVC.Demos.Controllers { public class ChartsController : Controller { public ActionResult LogarithmicVsLinearAxes() { return View(); } } }
#chart { height: 450px; }