uv-charts-dashboard
Version:
A dashboard for uvCharts examples
69 lines (60 loc) • 1.82 kB
text/typescript
import { Component, Input, OnInit } from '@angular/core';
import { CommonService } from '../../shared/common.service';
export class AreaChartComponent implements OnInit {
private uv: any;
private data: any;
private metaData: {};
compress: boolean;
constructor(private commonService: CommonService) {
this.uv = commonService.uv;
}
ngOnInit() {
this.commonService.getRealTimeData().subscribe((data) => { this.data = data; this.makeChart(this.data); });
}
makeChart(data: {}) {
this.metaData = {
graph: {
orientation: 'Vertical'
},
dimension: {
height: 200,
width: 400
},
meta: {
position: '#area-div',
caption: 'Production of Vegetables',
hlabel: 'Years',
vlabel: 'Production',
vsublabel: 'in tonnes'
}
};
if (this.compress) {
this.metaData = {
graph: {
orientation: 'Vertical'
},
margin: {
left: 10,
right: 10,
bottom: 10
},
dimension: {
height: 200,
width: 200
},
meta: {
position: '#area-div'
},
axis: {
showtext: false
}
};
}
this.uv.chart('area', data, this.metaData);
}
}