ngx-admin/src/app/pages/charts/echarts/echarts-radar.component.ts
2017-08-01 15:56:00 +03:00

72 lines
1.9 KiB
TypeScript

import { Component } from '@angular/core';
import { NgaThemeService } from '@akveo/nga-theme';
@Component({
selector: 'ngx-echarts-radar',
template: `
<div echarts [options]="options" class="echart"></div>
`,
})
export class EchartsRadarComponent {
options: any;
constructor(private theme: NgaThemeService) {
this.theme.getJsTheme().subscribe(config => {
const echarts: any = config.variables.echarts;
this.options = {
backgroundColor: echarts.bg,
color: echarts.radar.colors,
tooltip: {},
legend: {
data: ['Allocated Budget', 'Actual Spending'],
textStyle: {
color: echarts.legendTextColor,
},
},
radar: {
name: {
textStyle: {
color: echarts.radar.nameTextColor,
},
},
indicator: [
{ name: 'Sales', max: 6500 },
{ name: 'Administration', max: 16000 },
{ name: 'Information Techology', max: 30000 },
{ name: 'Customer Support', max: 38000 },
{ name: 'Development', max: 52000 },
{ name: 'Marketing', max: 25000 },
],
// axisLine: {
// lineStyle: {
// color: 'white',
// },
// },
splitArea: {
areaStyle: {
color: echarts.radar.splitAreaStyleColor,
},
},
},
series: [
{
name: 'Budget vs Spending',
type: 'radar',
data: [
{
value: [4300, 10000, 28000, 35000, 50000, 19000],
name: 'Allocated Budget',
},
{
value: [5000, 14000, 28000, 31000, 42000, 21000],
name: 'Actual Spending',
},
],
},
],
};
});
}
}