From a5dcec98423c9a8e4abf04104aec152f93d1ab49 Mon Sep 17 00:00:00 2001 From: cyuamber Date: Tue, 10 Dec 2019 08:36:04 +0800 Subject: feat:add pie echarts of monitor 5g page Change-Id: I2ac95e493d891ae67a44478dce596eda27680df9 Issue-ID: USECASEUI-370 Signed-off-by: cyuamber --- .../fcaps/monitor-5g/monitor-5g.component.html | 13 +++++++ .../fcaps/monitor-5g/monitor-5g.component.less | 15 ++++++++ .../views/fcaps/monitor-5g/monitor-5g.component.ts | 43 ++++++++++++++++++++-- .../views/fcaps/monitor-5g/monitorEchartsConfig.ts | 36 ++++++++++++++++++ 4 files changed, 103 insertions(+), 4 deletions(-) create mode 100644 usecaseui-portal/src/app/views/fcaps/monitor-5g/monitorEchartsConfig.ts (limited to 'usecaseui-portal/src/app/views/fcaps/monitor-5g') diff --git a/usecaseui-portal/src/app/views/fcaps/monitor-5g/monitor-5g.component.html b/usecaseui-portal/src/app/views/fcaps/monitor-5g/monitor-5g.component.html index 74a88dc7..baf43f43 100644 --- a/usecaseui-portal/src/app/views/fcaps/monitor-5g/monitor-5g.component.html +++ b/usecaseui-portal/src/app/views/fcaps/monitor-5g/monitor-5g.component.html @@ -3,6 +3,7 @@
+
+
+

Slicing Use Traffic

+ +
+
+ col-9 +
+
+ col-9 +
+
{ if (!this.listOfData.length) { return false; } + if(this.selectDate !==0){ + time = this.selectDate + } const service_list = []; this.listOfData.forEach(item => { service_list.push({service_id: item.service_instance_id}); @@ -66,8 +78,31 @@ export class Monitor5gComponent implements OnInit { fetchTrafficData(service_list, time){ this.myhttp.getFetchTraffic(service_list,time).subscribe (res => { const { result_header: { result_code }, result_body: { slicing_usage_traffic_list } } = res; - if (+result_code === 200) { - this.trafficData = slicing_usage_traffic_list; + if (+result_code === 200 && slicing_usage_traffic_list.length >0) { + console.log(this.trafficChartInit,"----trafficChartInit") + slicing_usage_traffic_list.forEach((item)=>{ + this.trafficData.push({ + name:item.service_id, + value:item.traffic_data + }); + this.trafficLegend.push(item.service_id) + }); + this.trafficChartData = { + legend:{ + orient: 'vertical', + left: '0px', + bottom: '0px', + itemWidth: 10, + itemHeight: 10, + textStyle: { + color: "#3C4F8C" + }, + data: this.trafficLegend + }, + series: [{ + data: this.trafficData + }] + }; } }) } diff --git a/usecaseui-portal/src/app/views/fcaps/monitor-5g/monitorEchartsConfig.ts b/usecaseui-portal/src/app/views/fcaps/monitor-5g/monitorEchartsConfig.ts new file mode 100644 index 00000000..59ed7f25 --- /dev/null +++ b/usecaseui-portal/src/app/views/fcaps/monitor-5g/monitorEchartsConfig.ts @@ -0,0 +1,36 @@ +export const pieChartconfig = { + height: 320, + option: { + tooltip: { + trigger: 'item', + formatter: '{b}\n{c},{d}%' + }, + legend: { + orient: 'vertical', + left: '0px', + bottom: '0px', + itemWidth: 10, + itemHeight: 10, + textStyle: { + color: "#3C4F8C" + }, + data: [] + }, + color: ["#7AC0EF", "#FB7788","#6A86D8","#A6BFE4","#748CDC", "#7277D4", "#7067CE", "#B9B0F7", "#7DCFF5"], + series: [{ + name: "", + radius: '55%', + center: ['50%', '45%'], + label: { + normal: { + show: false, + }, + emphasis: { + show: false, + formatter: '{b}\n{c},{d}%', + color: "#3C4F8C" + } + } + }] + } +}; \ No newline at end of file -- cgit 1.2.3-korg