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 - Scale Label Formatting

This demo shows how to format the text of the scale labels using the customizeText property.

Backend API
import React from 'react'; import { CircularGauge, Scale, Label, RangeContainer, Range, Export, Title, Font, } from 'devextreme-react/circular-gauge'; function customizeText({ valueText }: { valueText: string }): string { return `${valueText} %`; } function App() { return ( <CircularGauge id="gauge" value={45} > <Scale startValue={0} endValue={100} tickInterval={10}> <Label customizeText={customizeText} /> </Scale> <RangeContainer> <Range startValue={0} endValue={20} color="#CE2029" /> <Range startValue={20} endValue={50} color="#FFD700" /> <Range startValue={50} endValue={100} color="#228B22" /> </RangeContainer> <Export enabled={true} /> <Title text="Battery Charge"> <Font size={28} /> </Title> </CircularGauge> ); } export default App;
import React from 'react'; import { CircularGauge, Scale, Label, RangeContainer, Range, Export, Title, Font, } from 'devextreme-react/circular-gauge'; function customizeText({ valueText }) { return `${valueText} %`; } function App() { return ( <CircularGauge id="gauge" value={45} > <Scale startValue={0} endValue={100} tickInterval={10} > <Label customizeText={customizeText} /> </Scale> <RangeContainer> <Range startValue={0} endValue={20} color="#CE2029" /> <Range startValue={20} endValue={50} color="#FFD700" /> <Range startValue={50} endValue={100} color="#228B22" /> </RangeContainer> <Export enabled={true} /> <Title text="Battery Charge"> <Font size={28} /> </Title> </CircularGauge> ); } 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%; }