angular - 在角度 6 中的 Highcharts 的 guagechart 中出现一些错误
问题描述
我在 highchaarts 中有一个 guage 图表,工作正常。但是当我使用命令编译时,它显示了很多错误。这是我在下面附加的错误。此代码在此处实现https://stackblitz.com/edit/ angular-elp56k?file=src/app/app.component.ts .Here它工作正常但是当我下载代码并在我的系统上运行时出现错误。任何人都可以请帮助我。
app.component.ts
declare var require: any;
import { Component } from '@angular/core';
import * as Highcharts from 'highcharts';
const HighchartsMore = require("highcharts/highcharts-more.src");
HighchartsMore(Highcharts);
const HC_solid_gauge = require("highcharts/modules/solid-gauge.src");
HC_solid_gauge(Highcharts);
import * as Exporting from 'highcharts/modules/exporting';
@Component({
selector: 'my-app',
templateUrl: './app.component.html',
styleUrls: [ './app.component.css' ]
})
export class AppComponent {
clickMessage = '';
name = 'Angular';
onClickMe(referenceKeyName) {
alert(referenceKeyName.id);
}
ngOnInit(){
this.chartFunc('chart2');
}
chartFunc(chartId){
Highcharts.chart(chartId,{
chart: {
'type': 'solidgauge'
},
title: {
text: "Monthly Average Temperature"
},
'pane': {
'center': ['50%', '50%'],
'size': '300px',
'startAngle': 0,
'endAngle': 360,
'background': {
'backgroundColor': '#EEE',
'innerRadius': '90%',
'outerRadius': '100%',
'borderWidth': 0
}
},
'yAxis': {
'min': 0,
'max': 100,
'labels': {
'enabled': false
},
'lineWidth': 0,
'minorTickInterval': null,
'tickPixelInterval': 400,
'tickWidth': 0
},
'plotOptions': {
'solidgauge': {
'innerRadius': '90%'
}
},
'series': [{
'name': 'Speed',
'data': [50],
'dataLabels': {
'enabled': false
}
}]
});
}
}
app.component.html
<hello name="{{ name }}"></hello>
<div id="chart2"></div>
app.module.ts
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
import { AppComponent } from './app.component';
import { HelloComponent } from './hello.component';
import { HighchartsChartModule } from "highcharts-angular";
@NgModule({
imports: [ BrowserModule, FormsModule,HighchartsChartModule
],
declarations: [ AppComponent, HelloComponent ],
bootstrap: [ AppComponent ]
})
export class AppModule { }
解决方案
我在这里修复了这个问题,我添加了 'type' : undefined, in series replace pane with pane: { center: ['50%', '50%'], startAngle: 0, size: '80px', endAngle: -360,背景:[{ outerRadius: '92%' }, { innerRadius: '100%' }, {borderWidth: 0 } ] },并且改变了样式,这里是链接https://stackblitz.com/edit/角-dlyq3b
推荐阅读
- php - 如何替换 file_get_contents 中的变量以使用 PHP 生成 css 文件?
- python - 在 Pandas 中计算牛市/熊市
- postgresql - 如何从 PL/lpgSQL 函数内部获取记录(行)的 jsonb 数组的键和值
- php - Laravel 水平队列作业因 MaxAttemptsExceededException 而失败
- c# - 如何将 Bouncy Castle X509Crl C# 中的 CRL 编号解析为 BigInteger
- hl7-fhir - 如何在不同元素之间使用“或”运算符?
- javascript - 我正在发出抢劫命令,但我不知道如何让它在失败时激活超时或从人身上减去硬币
- matrix - 正交 procrustes 的奇怪行为
- python - 如何使用不同数量的列制作 matplotlib 堆栈子图?
- javascript - Node.js:如何检查生成的进程是否被成功杀死