我想在高角图中以6号角创建一个实心的guage图表。我尝试了其他图表的工作正常,但guage图表却无法正常工作。图表类型。以下是下面的代码,我也在此链接https://stackblitz.com/edit/angular-yw3xwa?file=src%2Fapp%2Fapp.module.ts中创建了一个演示。
<div #referenceKeyName (click)="onClickMe(referenceKeyName)" id="chart2"></div>
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 { }
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
}
}]
});
}
}
答案 0 :(得分:0)
您做了一个简单的错字。固体规格系列称为solidgauge
,而不是solidGauge
。
chart: {
'type': 'solidgauge'
}
演示: