Loading...
Loading...
Implement Syncfusion React Linear Gauge for displaying measurements on a linear scale. Use this skill when users need temperature sensors, KPI indicators, progress gauges, or real-time monitoring dashboards. Covers axes configuration, pointer types, ranges, annotations, customization, animations, print/export, accessibility, and internationalization.
npx skill4agent add syncfusion/react-ui-components-skills syncfusion-react-linear-gauge@syncfusion/ej2-react-lineargauge@syncfusion/ej2-react-lineargaugeimport React from 'react';
import { LinearGaugeComponent, AxesDirective, AxisDirective,
PointersDirective, PointerDirective, RangesDirective, RangeDirective }
from '@syncfusion/ej2-react-lineargauge';
import '@syncfusion/ej2-lineargauge/styles/material.css';
export function App() {
return (
<div style={{ height: '400px', width: '100%' }}>
<LinearGaugeComponent
title="Temperature Monitor"
orientation="Horizontal"
>
<AxesDirective>
<AxisDirective
minimum={0}
maximum={100}
labelStyle={{ format: '{value}°C' }}
>
<RangesDirective>
<RangeDirective start={0} end={30} color='#1E90FF' />
<RangeDirective start={30} end={70} color='#FFA500' />
<RangeDirective start={70} end={100} color='#FF4500' />
</RangesDirective>
<PointersDirective>
<PointerDirective value={55} />
</PointersDirective>
</AxisDirective>
</AxesDirective>
</LinearGaugeComponent>
</div>
);
}npm install @syncfusion/ej2-react-lineargauge --save<LinearGaugeComponent title="Temperature">
<AxesDirective>
<AxisDirective minimum={-40} maximum={50} labelStyle={{ format: '{value}°C' }}>
<RangesDirective>
<RangeDirective start={-40} end={0} color='#4CAF50' />
<RangeDirective start={0} end={25} color='#8BC34A' />
<RangeDirective start={25} end={50} color='#FF5722' />
</RangesDirective>
<PointersDirective>
<PointerDirective value={20} />
</PointersDirective>
</AxisDirective>
</AxesDirective>
</LinearGaugeComponent><PointersDirective>
<PointerDirective
value={75}
type='Marker'
markerType='Rectangle'
width={20}
color='#007AFF'
/>
</PointersDirective>const [value, setValue] = useState(50);
useEffect(() => {
const timer = setInterval(() => {
setValue(prev => (prev + (Math.random() - 0.5) * 10) % 100);
}, 1000);
return () => clearInterval(timer);
}, []);
<PointerDirective value={value} />| Prop | Type | Purpose | Example |
|---|---|---|---|
| string | Gauge title text | |
| "Horizontal" | "Vertical" | Layout orientation (default: Vertical) | |
| string | Gauge width | |
| string | Gauge height | |
| Prop | Type | Purpose | Example |
|---|---|---|---|
| number | Start value of the axis range | |
| number | End value of the axis range | |
| object | Label customization (use | |
{ format: '{value}' }{ format: '{value}°C' }{ format: '${value}K' }{ format: '{value}%' }majorTicksIntervalminorTicksIntervalaxisLineStyle| Prop | Type | Purpose | Example |
|---|---|---|---|
| number | The value to display | |
| string | Pointer color (hex or named) | |
| "Bar" | "Marker" | Pointer shape type (default: Bar) | |
| "Circle" | "Rectangle" | "Triangle" | "Diamond" | "Image" | "Text" | Shape for marker pointers | |
| number | Pointer width in pixels | |
<PointerDirective value={140} color='blue' width={8} /><PointerDirective
value={75}
type='Marker'
markerType='Rectangle'
width={15}
color='#1976D2'
/>| Prop | Type | Purpose | Example |
|---|---|---|---|
| number | Start value of the range | |
| number | End value of the range | |
| string | Range background color | |
| number | Width of start edge | |
| number | Width of end edge | |
<RangeDirective start={0} end={80} color='#4CAF50' startWidth={15} endWidth={15} />import React from 'react';
import { LinearGaugeComponent, AxesDirective, AxisDirective,
PointersDirective, PointerDirective, RangesDirective, RangeDirective }
from '@syncfusion/ej2-react-lineargauge';
export function App() {
return (
<LinearGaugeComponent>
<AxesDirective>
<AxisDirective minimum={0} maximum={200} labelStyle={{ format: '{value}°C' }}>
<PointersDirective>
<PointerDirective value={140} color='green'></PointerDirective>
</PointersDirective>
<RangesDirective>
<RangeDirective start={0} end={80} startWidth={15} endWidth={15}></RangeDirective>
<RangeDirective start={80} end={120} startWidth={15} endWidth={15}></RangeDirective>
<RangeDirective start={120} end={140} startWidth={15} endWidth={15}></RangeDirective>
<RangeDirective start={140} end={200} startWidth={15} endWidth={15}></RangeDirective>
</RangesDirective>
</AxisDirective>
</AxesDirective>
</LinearGaugeComponent>
);
}<LinearGaugeComponent title="Project Status">
<AxesDirective>
<AxisDirective minimum={0} maximum={100} labelStyle={{ format: '{value}%' }}>
<RangesDirective>
<RangeDirective start={0} end={30} color='#EF5350' startWidth={15} endWidth={15}></RangeDirective>
<RangeDirective start={30} end={70} color='#FFCA28' startWidth={15} endWidth={15}></RangeDirective>
<RangeDirective start={70} end={100} color='#66BB6A' startWidth={15} endWidth={15}></RangeDirective>
</RangesDirective>
<PointersDirective>
<PointerDirective value={75} color='#1976D2' width={8}></PointerDirective>
</PointersDirective>
</AxisDirective>
</AxesDirective>
</LinearGaugeComponent><LinearGaugeComponent>
<AxesDirective>
<AxisDirective minimum={0} maximum={1000} labelStyle={{ format: '${value}K' }}>
<RangesDirective>
<RangeDirective start={0} end={400} color='#E53935' startWidth={15} endWidth={15}></RangeDirective>
<RangeDirective start={400} end={700} color='#FB8C00' startWidth={15} endWidth={15}></RangeDirective>
<RangeDirective start={700} end={1000} color='#43A047' startWidth={15} endWidth={15}></RangeDirective>
</RangesDirective>
<PointersDirective>
<PointerDirective value={650} color='#1976D2' width={6}></PointerDirective>
<PointerDirective value={850} type='Marker' markerType='Circle' width={10} color='#FF6F00'></PointerDirective>
</PointersDirective>
</AxisDirective>
</AxesDirective>
</LinearGaugeComponent>destroy()export(type, fileName, orientation?, allowDownload?)print(id?)setAnnotationValue(annotationIndex, content, axisValue?)setPointerValue(axisIndex, pointerIndex, value)loadloadedresizedvalueChangedragStartdragMovedragEndbeforePrinttooltipRenderanimationCompleteannotationRenderaxisLabelRendergaugeMouseDowngaugeMouseMovegaugeMouseUpgaugeMouseLeave