summaryrefslogtreecommitdiffstats
path: root/usecaseui-portal/src/app/components/charts/bar/bar.component.ts
diff options
context:
space:
mode:
authorzhangab <zhanganbing@chinamobile.com>2019-01-09 16:30:41 +0800
committerzhangab <zhanganbing@chinamobile.com>2019-01-09 16:30:55 +0800
commitee500f6f43efc488033f7be223a08b0dbe087af6 (patch)
tree38e65d93bbe74ae8290ba6de8e822c71019e9947 /usecaseui-portal/src/app/components/charts/bar/bar.component.ts
parentbd4942df4f188a4ec273a5ec95c99acb1ce6bb75 (diff)
Support NS Package Query for VF-C
Change-Id: I0501df1d699baea97149a404708b55a65f15d95e Issue-ID: USECASEUI-159 Signed-off-by: zhangab <zhanganbing@chinamobile.com>
Diffstat (limited to 'usecaseui-portal/src/app/components/charts/bar/bar.component.ts')
-rw-r--r--usecaseui-portal/src/app/components/charts/bar/bar.component.ts46
1 files changed, 45 insertions, 1 deletions
diff --git a/usecaseui-portal/src/app/components/charts/bar/bar.component.ts b/usecaseui-portal/src/app/components/charts/bar/bar.component.ts
index fa9ecbbd..a7947f4e 100644
--- a/usecaseui-portal/src/app/components/charts/bar/bar.component.ts
+++ b/usecaseui-portal/src/app/components/charts/bar/bar.component.ts
@@ -1,4 +1,5 @@
-import { Component, OnInit } from '@angular/core';
+import { Component, OnInit, Input } from '@angular/core';
+import { SimpleChanges } from '@angular/core/src/metadata/lifecycle_hooks';
@Component({
selector: 'app-bar',
@@ -7,9 +8,52 @@ import { Component, OnInit } from '@angular/core';
})
export class BarComponent implements OnInit {
+ // 图形数据
+ @Input() chartData;
+ // 初始化数据
+ @Input() initData;
+
constructor() { }
ngOnInit() {
+ this.initOpts = {
+ renderer: 'canvas',
+ height: 40,
+ width: 160,
+
+ };
+ this.barOption = {
+ xAxis: this.initData.option.xAxis,
+ yAxis: {
+ type: 'category',
+ show: false,
+ axisTick: {
+ show: false
+ }
+ },
+ series: this.initData.option.series
+ }
+ }
+
+ ngOnChanges(changes: SimpleChanges) {
+ // 当有实例的时候再执行,相当于第一次不执行下面方法
+ if (this.chartIntance) {
+ this.chartDataChange()
+ }
+ }
+ // 初始化图形高度
+ initOpts: any;
+ // 折线图配置
+ barOption: any;
+ // 实例对象
+ chartIntance: any;
+ // 数据变化
+ updateOption: any;
+ chartDataChange() {
+ this.updateOption = this.chartData;
+ }
+ chartInit(chart) {
+ this.chartIntance = chart;
}
}