---
title: "Configure Linear-gradient Gauge  "
language: "en"
canonical: "https://g2.antv.antgroup.com/en/examples/style/graphic/gauge/"
version: "5.4.8"
---

# Configure Linear-gradient Gauge

[Live example](https://g2.antv.antgroup.com/en/examples/style/graphic/gauge/)

[Resource index](/llms.txt)

Provide a DOM element with `id="container"`. The original example source follows.

## Source

```ts
import { Chart } from '@antv/g2';

const chart = new Chart({
  container: 'container',
  height: 350,
});

chart.options({
  type: 'gauge',
  data: {
    value: { target: 159, total: 400, name: 'score', thresholds: [200, 400] },
  },
  scale: {
    color: { range: ['l(0):0:#37b38e 1:#D9C652', 'l(0):0:#D9C652 1:#f96e3e'] },
  },
  style: {
    textContent: (target, total) => `得分：${target}
占比：${(target / total) * 100}%`,
  },
  legend: false,
});

chart.render();
```
