<div nz-col nzSpan="12" class="monitorDate">
<nz-date-picker
nzShowTime
+ [nzShowToday]="false"
nzFormat="yyyy-MM-dd HH:mm:ss"
nzPlaceHolder="Select Time"
ngModel
></nz-date-picker>
</div>
</div>
+ <div nz-row nzType="flex" nzGutter="16" class="charts">
+ <div nz-col nzSpan="6" class="gutter-row col-boxshadow">
+ <h4>Slicing Use Traffic</h4>
+ <app-pie [initData]="trafficChartInit" [chartData]="trafficChartData"></app-pie>
+ </div>
+ <div nz-col nzSpan="9" class="gutter-row col-boxshadow">
+ col-9
+ </div>
+ <div nz-col nzSpan="9" class="gutter-row col-boxshadow">
+ col-9
+ </div>
+ </div>
<div class="slicing-resource-table">
<div class="slicing-resource-table-list">
<nz-table
import { Component, OnInit } from '@angular/core';
import {SlicingTaskServices} from '.././../../core/services/slicingTaskServices';
+import {pieChartconfig} from './monitorEchartsConfig';
@Component({
selector: 'app-monitor-5g',
templateUrl: './monitor-5g.component.html',
total: number = 0;
loading = false;
trafficData: any[] =[];
+ trafficLegend: any[] =[];
onlineusersData: any[] =[];
bandwidthData: any[] =[];
- selectDate: Date = null;
+ selectDate: number = 0;
+ trafficChartInit :Object = pieChartconfig;
+ trafficChartData :Object;
ngOnInit() {
this.getBusinessList()
}
}
onDateChange(result: Date): void {
console.log('Selected Time: ', result);
+ if(result === null){
+ this.selectDate = 0;
+ this.getChartsData()
+ }
}
onDateOk(result: Date): void {
console.log('onOk', result);
- this.selectDate = result;
+ this.selectDate = result.valueOf();
+ this.getChartsData();
}
getChartsData = (time = new Date().getTime()) => {
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});
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
+ }]
+ };
}
})
}
--- /dev/null
+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