DevExtreme v23.2 is now available.

Explore our newest features/capabilities and share your thoughts with us.

Your search did not match any results.

Logarithmic Scale

Documentation

In this demo, a logarithmic axis is used to select a range within a set of rapidly-growing values.

Backend API
$(() => { const dataSource = []; const max = 100; for (let i = 0; i < max; i += 1) { dataSource.push({ arg: 10 ** i * 0.1, val: Math.log(i + 1) / Math.log(0.5) + (Math.random() - 0.5) * (100 / (i + 1)) + 10, }); } $('#zoomed-chart').dxChart({ dataSource, resizePanesOnZoom: true, argumentAxis: { valueMarginsEnabled: false, type: 'logarithmic', label: { format: 'exponential' }, grid: { visible: true, }, minorGrid: { visible: true, }, minorTickCount: 10, }, legend: { visible: false, }, series: {}, }); $('#range-selector').dxRangeSelector({ dataSource, chart: { series: {}, }, scale: { type: 'logarithmic', label: { format: 'exponential' }, minRange: 1, minorTickCount: 10, }, sliderMarker: { format: 'exponential', }, behavior: { valueChangeMode: 'onHandleMove', snapToTicks: false, }, onValueChanged(e) { const zoomedChart = $('#zoomed-chart').dxChart('instance'); zoomedChart.getArgumentAxis().visualRange(e.value); }, }); });
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>DevExtreme Demo</title> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" /> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <script>window.jQuery || document.write(decodeURIComponent('%3Cscript src="js/jquery.min.js"%3E%3C/script%3E'))</script> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/23.2.5/css/dx.light.css" /> <script src="js/dx.all.js"></script> <link rel="stylesheet" type="text/css" href="styles.css" /> <script src="index.js"></script> </head> <body class="dx-viewport"> <div class="demo-container"> <div> <div id="zoomed-chart"></div> <div id="range-selector"></div> </div> </div> </body> </html>
#zoomed-chart { height: 335px; margin: 0 0 15px; } #range-selector { height: 120px; }