g2-gauge 仪表盘 - 图1 This article has not been translated, hope that your can PR to translated it. Help us!g2-gauge 仪表盘 - 图2

g2-gauge 仪表盘

一种进度展示方式,可以更直观的展示当前的进展情况,通常也可表示占比。

  1. import { G2GaugeModule } from '@delon/chart/gauge';

代码演示

g2-gauge 仪表盘 - 图3

基础

基础用法。

  1. import { Component } from '@angular/core';
  2. @Component({
  3. selector: 'chart-gauge-basic',
  4. template: ` <g2-gauge [title]="'核销率'" height="164" [percent]="percent" [color]="color"></g2-gauge> `,
  5. })
  6. export class ChartGaugeBasicComponent {
  7. percent = 36;
  8. color = '#2f9cff';
  9. constructor() {
  10. setInterval(() => {
  11. this.percent = parseInt((Math.random() * 100).toString(), 10);
  12. this.color = this.percent > 50 ? '#f50' : '#2f9cff';
  13. }, 1000);
  14. }
  15. }

API

g2-gauge

参数说明类型默认值
[delay]延迟渲染,单位:毫秒number0
[title]图表标题string-
[height]图表高度number-
[color]图表颜色string#2F9CFF
[bgColor]图表背景色string#F0F2F5
[percent]进度比例number-
[padding]内边距Array<number | string>[10, 10, 30, 10]
[format]坐标轴格式(text: string, item: {}, index: number) => string-
[theme]定制图表主题string | LooseObject-