Gauge.tsx 567 Bytes
import { Gauge } from '@ant-design/charts';

const DemoGauge: React.FC = () => {
  const config = {
    title: {
      visible: false,
      text: '压力表',
    },
    width: 400,
    height: 400,
    value: 0.75,
    min: 0,
    max: 1.6,
    range: [0, 0.4, 0.8, 1.2, 1.6],
    statistic: {
      visible: true,
      text: '压力表',
      color: '#faad14',
    },
    color: ['#39B8FF', '#52619B', '#43E089', '#C0EDF3'],
    format: (v: number) => {
      return Number(v).toFixed(1);
    },
  };
  return <Gauge {...config} />;
};

export default DemoGauge;