如何创建自定义压力表?

时间:2019-10-06 09:29:17

标签: html css angular

我正在使用Angular框架开发一个应用程序。我需要创建一个如下所示的量表,我已经尝试过ngx-chart,但是量表与需求大不相同。有什么想法吗?

custom gauge

2 个答案:

答案 0 :(得分:0)

第一次运行npm install angular-gauge-chart

//您的appmodule:

import { GaugeChartModule } from 'angular-gauge-chart'

imports: [
    GaugeChartModule,
]

//您的tmpl:

<rg-gauge-chart
    [canvasWidth]="canvasWidth"
    [needleValue]="needleValue"
    [centralLabel]="centralLabel"
    [options]="options"
    [name]="name"
    [bottomLabel]="bottomLabel">
</rg-gauge-chart>

答案 1 :(得分:0)

您可以使用angular-google-charts或angular-highcharts完成任务。 Angular Google图表是Angular 6+的Google图表库的包装。

如果要在角度中使用量规表,则必须安装软件包。之后将其导入到app.module.ts

npm install angular-google-charts

此“高级图表js”是基于SVG的图表库。 “ highcharts”比“ Gauge”图表功能丰富。这将有助于更自定义您的图表。因此,如果要使用“ highcharts”,则必须安装波纹管软件包。

npm install angular-highcharts@6.2.6
npm install highcharts@4.2.5

之后,将其导入到app.module.ts中。 通过参考下面的文章,您将对上述图表的工作方式有个很好的了解。 enter link description here