DevExtreme v26.1 is now available.

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

Your search did not match any results.

React Gauges - Custom Layout

This demo shows how to adjust a relative position of the LinerGauge elements. The range container, value and subvalue indicators include the offset property that specifies a shift from the scale for this element. When this property is assigned to a positive value, the corresponding element moves down from its initial position. Otherwise, it moves up.

Backend API
import React from 'react'; import { LinearGauge, Scale, Tick, Label, RangeContainer, Range, ValueIndicator, SubvalueIndicator, Export, Title, Font, } from 'devextreme-react/linear-gauge'; const subValues = [5, 25]; function App() { return ( <LinearGauge id="gauge" value={17} subvalues={subValues} > <Scale startValue={0} endValue={30} tickInterval={5}> <Tick color="#536878" /> <Label indentFromTick={-3} /> </Scale> <RangeContainer offset={10}> <Range startValue={0} endValue={5} color="#92000A" /> <Range startValue={5} endValue={20} color="#E6E200" /> <Range startValue={20} endValue={30} color="#77DD77" /> </RangeContainer> <ValueIndicator offset={20} /> <SubvalueIndicator offset={-15} /> <Export enabled={true} /> <Title text="Issues Closed (with Min and Max Expected)"> <Font size={28} /> </Title> </LinearGauge> ); } export default App;
import React from 'react'; import { LinearGauge, Scale, Tick, Label, RangeContainer, Range, ValueIndicator, SubvalueIndicator, Export, Title, Font, } from 'devextreme-react/linear-gauge'; const subValues = [5, 25]; function App() { return ( <LinearGauge id="gauge" value={17} subvalues={subValues} > <Scale startValue={0} endValue={30} tickInterval={5} > <Tick color="#536878" /> <Label indentFromTick={-3} /> </Scale> <RangeContainer offset={10}> <Range startValue={0} endValue={5} color="#92000A" /> <Range startValue={5} endValue={20} color="#E6E200" /> <Range startValue={20} endValue={30} color="#77DD77" /> </RangeContainer> <ValueIndicator offset={20} /> <SubvalueIndicator offset={-15} /> <Export enabled={true} /> <Title text="Issues Closed (with Min and Max Expected)"> <Font size={28} /> </Title> </LinearGauge> ); } export default App;
import React from 'react'; import ReactDOM from 'react-dom'; import App from './App.tsx'; ReactDOM.render( <App />, document.getElementById('app'), );
import React from 'react'; import ReactDOM from 'react-dom'; import App from './App.js'; ReactDOM.render(<App />, document.getElementById('app'));
<!DOCTYPE html> <html lang="en"> <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=5.0" /> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/26.1.5/css/dx.light.css" /> <link rel="stylesheet" type="text/css" href="./bundle.css" /> </head> <body class="dx-viewport"> <div class="demo-container"> <div id="app"></div> </div> <script src="bundles/vendor/react.vendor.js"></script> <script src="./bundle.js"></script> </body> </html>
#gauge { height: 440px; width: 100%; }