ngx-admin/src/app/pages/charts/d3/d3-area-stack.component.ts

85 lines
1.6 KiB
TypeScript
Raw Normal View History

import { Component } from '@angular/core';
import { NbThemeService } from '@nebular/theme';
@Component({
selector: 'ngx-d3-area-stack',
2017-07-27 12:06:50 +03:00
template: `
<ngx-charts-area-chart
[view]="view"
[scheme]="colorScheme"
[results]="multi"
[xAxis]="showXAxis"
[yAxis]="showYAxis"
[legend]="showLegend"
[showXAxisLabel]="showXAxisLabel"
[showYAxisLabel]="showYAxisLabel"
[xAxisLabel]="xAxisLabel"
[yAxisLabel]="yAxisLabel"
[autoScale]="autoScale">
</ngx-charts-area-chart>
`,
})
export class D3AreaStackComponent {
2017-07-27 12:06:50 +03:00
multi = [
{
name: 'Germany',
series: [
{
name: '2010',
value: 7300000,
},
{
name: '2011',
value: 8940000,
},
],
},
{
name: 'USA',
series: [
{
name: '2010',
value: 7870000,
},
{
name: '2011',
value: 8270000,
},
],
},
{
name: 'France',
series: [
{
name: '2010',
value: 5000002,
},
{
name: '2011',
value: 5800000,
},
],
},
];
view: any[] = [700, 400];
showLegend = true;
autoScale = true;
showXAxis = true;
showYAxis = true;
showXAxisLabel = true;
showYAxisLabel = true;
xAxisLabel = 'Country';
yAxisLabel = 'Population';
colorScheme: any;
constructor(private theme: NbThemeService) {
this.theme.getJsTheme().subscribe(config => {
this.colorScheme = {
2017-08-01 15:42:06 +03:00
domain: (<any>config.variables.d3).areaStack,
};
});
}
}