Loading...
Loading...
Compare original and translation side by side
@syncfusion/ej2-react-lineargauge@syncfusion/ej2-react-lineargauge@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 --saveimport 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><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><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} />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 | 用途 | 示例 |
|---|---|---|---|
| string | 仪表标题文本 | |
| "Horizontal" | "Vertical" | 布局方向(默认:Vertical) | |
| string | 仪表宽度 | |
| string | 仪表高度 | |
| Prop | Type | Purpose | Example |
|---|---|---|---|
| number | Start value of the axis range | |
| number | End value of the axis range | |
| object | Label customization (use | |
| Prop | Type | 用途 | 示例 |
|---|---|---|---|
| number | 轴范围起始值 | |
| number | 轴范围结束值 | |
| object | 标签自定义(使用 | |
{ format: '{value}' }{ format: '{value}°C' }{ format: '${value}K' }{ format: '{value}%' }majorTicksIntervalminorTicksIntervalaxisLineStyle{ 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 | |
| Prop | Type | 用途 | 示例 |
|---|---|---|---|
| number | 要显示的数值 | |
| string | 指针颜色(十六进制或命名色) | |
| "Bar" | "Marker" | 指针形状类型(默认:Bar) | |
| "Circle" | "Rectangle" | "Triangle" | "Diamond" | "Image" | "Text" | Marker指针的形状 | |
| number | 指针宽度(像素) | |
<PointerDirective value={140} color='blue' width={8} /><PointerDirective
value={75}
type='Marker'
markerType='Rectangle'
width={15}
color='#1976D2'
/><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 | |
| Prop | Type | 用途 | 示例 |
|---|---|---|---|
| number | 范围起始值 | |
| number | 范围结束值 | |
| string | 范围背景色 | |
| number | 范围起始端宽度 | |
| number | 范围结束端宽度 | |
<RangeDirective start={0} end={80} color='#4CAF50' startWidth={15} endWidth={15} /><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>
);
}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 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><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)loadloadedresizedvalueChangedragStartdragMovedragEndbeforePrinttooltipRenderanimationCompleteannotationRenderaxisLabelRendergaugeMouseDowngaugeMouseMovegaugeMouseUpgaugeMouseLeavedestroy()export(type, fileName, orientation?, allowDownload?)print(id?)setAnnotationValue(annotationIndex, content, axisValue?)setPointerValue(axisIndex, pointerIndex, value)loadloadedresizedvalueChangedragStartdragMovedragEndbeforePrinttooltipRenderanimationCompleteannotationRenderaxisLabelRendergaugeMouseDowngaugeMouseMovegaugeMouseUpgaugeMouseLeave