Your search did not match any results.
Gauges

Overview

DevExtreme JavaScript Gauges is a set of animated Knockout components for dashboards. Taking the best of the MVVM pattern, DevExtreme Gauges support two-way binding to view model properties. Gauges come in two geometric shapes: circular, or radial, and linear. This demo shows several highly customized gauges. See other demos in this section to explore gauge features in details.

Backend API
Copy to CodePen
Apply
Reset
window.onload = function () { const speedValue = ko.observable(40); const gaugeValue = ko.computed(() => (speedValue() / 2)); const viewModel = { speedValue, speedOptions: { geometry: { startAngle: 225, endAngle: 315, }, scale: { startValue: 20, endValue: 200, tickInterval: 20, minorTickInterval: 10, }, valueIndicator: { type: 'twoColorNeedle', color: 'none', secondFraction: 0.24, secondColor: '#f05b41', }, value: speedValue, size: { width: 260, }, }, coolantOptions: { geometry: { startAngle: 180, endAngle: 90, }, scale: { startValue: 0, endValue: 100, tickInterval: 10, }, valueIndicator: { color: '#f05b41', }, value: gaugeValue, size: { width: 90, height: 90, }, }, psiOptions: { scale: { startValue: 100, endValue: 0, tickInterval: 10, }, geometry: { startAngle: 90, endAngle: 0, }, valueIndicator: { color: '#f05b41', }, value: gaugeValue, size: { width: 90, height: 90, }, }, rpmOptions: { scale: { startValue: 100, endValue: 0, tickInterval: 10, }, geometry: { startAngle: -90, endAngle: -180, }, valueIndicator: { color: '#f05b41', }, value: gaugeValue, size: { width: 90, height: 90, }, }, instantFuelOptions: { scale: { startValue: 0, endValue: 100, tickInterval: 10, }, geometry: { startAngle: 0, endAngle: -90, }, valueIndicator: { color: '#f05b41', }, value: gaugeValue, size: { width: 90, height: 90, }, }, fuelOptions: { scale: { startValue: 0, endValue: 50, tickInterval: 25, minorTickInterval: 12.5, minorTick: { visible: true, }, label: { visible: false, }, }, valueIndicator: { color: '#f05b41', size: 8, offset: 7, }, value: ko.computed(() => (50 - speedValue() * 0.24)), size: { width: 90, height: 20, }, }, sliderOptions: { min: 0, max: 200, value: speedValue, width: 155, }, }; ko.applyBindings(viewModel, document.getElementById('gauge-demo')); };
<!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> <script src="https://cdnjs.cloudflare.com/ajax/libs/knockout/3.4.2/knockout-min.js"></script> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/21.2.3/css/dx.common.css" /> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/21.2.3/css/dx.light.css" /> <script src="https://cdn3.devexpress.com/jslib/21.2.3/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 id="gauge-demo"> <div id="gauge-container"> <div class="left-section"> <div data-bind="dxCircularGauge: coolantOptions"></div> <div data-bind="dxCircularGauge: rpmOptions"></div> </div> <div class="center-section"> <div id="speed-gauge" data-bind="dxCircularGauge: speedOptions"></div> <div class="speed-value"> <span data-bind="text: speedValue"></span> </div> <div id="fuel-gauge" data-bind="dxLinearGauge: fuelOptions"></div> </div> <div class="right-section"> <div data-bind="dxCircularGauge: psiOptions"></div> <div data-bind="dxCircularGauge: instantFuelOptions"></div> </div> </div> <div id="slider" data-bind="dxSlider: sliderOptions"></div> </div> </div> </body> </html>
#gauge-demo { height: 500px; } #gauge-container { text-align: center; margin: 20px auto; background-image: url('../../../../images/Gauges/mask.png'); background-repeat: no-repeat; width: 786px; height: 500px; } #gauge-container > div { display: inline-block; position: relative; } .left-section { top: -20px; left: -40px; } .center-section { top: 25px; } .right-section { top: -20px; right: -40px; } .speed-value { position: absolute; border: 2px solid #f05b41; border-radius: 50%; width: 110px; height: 110px; left: 28%; top: 36%; line-height: 100px; } .speed-value > span { font-size: 50px; font-weight: lighter; color: #f05b41; } #fuel-gauge { position: absolute; left: 34%; bottom: 5%; } #slider { position: relative; top: -105px; margin: 0 auto; } #slider .dx-slider-bar { background-color: #fff; } #slider .dx-slider-handle { background-color: #f05b41; width: 16px; height: 16px; margin-top: -8px; margin-right: -8px; border-radius: 50%; border: none; } #slider .dx-slider-handle .dx-inkripple-wave { background: none; } #slider .dx-slider-handle::after { background-color: #f05b41; } #slider .dx-slider-range.dx-slider-range-visible { border-color: #f05b41; background-color: #f05b41; }