53 lines
1.1 KiB
TypeScript
53 lines
1.1 KiB
TypeScript
import { Component, Input, OnInit } from '@angular/core';
|
|
import { NgxChartsModule, LegendPosition } from '@swimlane/ngx-charts';
|
|
|
|
@Component({
|
|
selector: 'app-vertical-bar-chart',
|
|
templateUrl: './vertical-bar-chart.component.html',
|
|
styleUrls: ['./vertical-bar-chart.component.scss'],
|
|
standalone: true,
|
|
imports: [NgxChartsModule]
|
|
})
|
|
export class VerticalBarChartComponent implements OnInit {
|
|
|
|
// options
|
|
showXAxis = true;
|
|
showYAxis = true;
|
|
gradient = false;
|
|
showLegend = true;
|
|
showXAxisLabel = true;
|
|
xAxisLabel = 'Country';
|
|
showYAxisLabel = true;
|
|
yAxisLabel = 'Population';
|
|
@Input() view: any;
|
|
@Input() legendPosition = LegendPosition.Below;
|
|
colorScheme: any = {
|
|
domain: ['#5AA454', '#A10A28', '#C7B42C', '#AAAAAA']
|
|
};
|
|
single: any[] = [];
|
|
|
|
constructor() { }
|
|
|
|
ngOnInit() {
|
|
this.single = [
|
|
{
|
|
"name": "Germany",
|
|
"value": 8940000
|
|
},
|
|
{
|
|
"name": "USA",
|
|
"value": 5000000
|
|
},
|
|
{
|
|
"name": "France",
|
|
"value": 7200000
|
|
}
|
|
];
|
|
}
|
|
|
|
onSelect(event: any) {
|
|
console.log(event);
|
|
}
|
|
|
|
}
|