2 Copyright (C) 2017 CMCC, Inc. and others. All rights reserved.
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
8 http://www.apache.org/licenses/LICENSE-2.0
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
16 app.controller('pertabCtrl', ['$scope', '$http', '$routeParams', function ($scope, $http, $routeParams) {
23 $scope.barChart = function (unit) {
24 $http.get(global_url + '/performance/diagram/' + unit + '/' + permanceId, {
26 'Access-Control-Allow-Origin': "*",
27 "Content-Type": "application/json"
30 .success(function (data) {
31 if (unit === "hour") {
35 {"x": '15min', "y": 4}, {"x": '30min', "y": 4}, {"x": '45min', "y": 12},
36 {"x": '60min', "y": 3.27}
41 angular.forEach(data, function (obj) {
42 for (var j = 0; j < obj.length; j++, i++) {
47 $scope.valuess[v][i].y = obj[j];
50 console.info($scope.valuess);
51 for (var i = 0; i < 5; i++) {
52 window.setTimeout(function () {
53 redraw("", $scope.valuess);
61 { "x":'1h' , "y":4}, { "x":'2h' , "y":4}, { "x":'3h' , "y":12},
62 { "x":'4h' , "y":3.27}, { "x":'5h' , "y":34}, { "x":'6h' , "y":34}, { "x":'7h' , "y":34},
63 { "x":'8h' , "y":34}, { "x":'9h' , "y":34}, { "x":'10h' , "y":34}, { "x":'11h' , "y":34},
64 { "x":'12h' , "y":56}, { "x":'13h' , "y":34}, { "x":'14h' , "y":34}, { "x":'15h' , "y":34},
65 { "x":'16h' , "y":12}, { "x":'17h' , "y":34}, { "x":'18h' , "y":50}, { "x":'19h' , "y":34},
66 { "x":'20h' , "y":34}, { "x":'21h' , "y":54}, { "x":'22h' , "y":34}, { "x":'23h' , "y":34},
72 angular.forEach(data, function (obj) {
73 for (var j = 0; j < obj.length; j++, i++) {
78 $scope.valuess[v][i].y = obj[j];
81 console.info($scope.valuess);
82 for (var i = 0; i < 5; i++) {
83 window.setTimeout(function () {
84 redraw("1", $scope.valuess);
88 if (unit === "month") {
92 { "x":'1d' , "y":4}, { "x":'2d' , "y":4}, { "x":'3d' , "y":12},
93 { "x":'4d' , "y":3.27}, { "x":'5d' , "y":34},{ "x":'6d' , "y":4}, { "x":'7d' , "y":4}, { "x":'8d' , "y":12},
94 { "x":'9d' , "y":3.27}, { "x":'10d' , "y":34}, { "x":'11d' , "y":34}, { "x":'12d' , "y":34}, { "x":'13d' , "y":4}, { "x":'14d' , "y":4}, { "x":'15' , "y":12},
95 { "x":'16d' , "y":3.27}, { "x":'17d' , "y":34},{ "x":'18d' , "y":4}, { "x":'19d' , "y":4}, { "x":'20d' , "y":12},
96 { "x":'21d' , "y":3.27}, { "x":'22d' , "y":34}, { "x":'23d' , "y":34}, { "x":'24d' , "y":34}, { "x":'25d' , "y":4}, { "x":'26d' , "y":12},
97 { "x":'27d' , "y":3.27}, { "x":'28d' , "y":34}, { "x":'29d' , "y":34}, { "x":'30d' , "y":34}, { "x":'31d' , "y":34}
102 angular.forEach(data, function (obj) {
103 for (var j = 0; j < obj.length; j++, i++) {
108 $scope.valuess[v][i].y = obj[j];
111 console.info($scope.valuess);
112 for (var i = 0; i < 5; i++) {
113 window.setTimeout(function () {
114 redraw("2", $scope.valuess);
118 if (unit === "year") {
120 for(var i=0;i<12;i++){
121 $scope.valuess[i] = [
122 {"x": 'Jan', "y": 4}, {"x": 'Feb', "y": 4}, {"x": 'Mar', "y": 12},
123 {"x": 'Apr', "y": 3.27}, {"x": 'May', "y": 4}, {"x": 'June', "y": 4}, {"x": 'July', "y": 12},
124 {"x": 'Aug', "y": 3.27}, {"x": 'Sept', "y": 4}, {"x": 'Oct', "y": 4}, {"x": 'Nov', "y": 12},
125 {"x": 'Jan', "y": 3.27}
130 angular.forEach(data, function (obj) {
131 for (var j = 0; j < obj.length; j++, i++) {
136 $scope.valuess[v][i].y = obj[j];
139 console.info($scope.valuess);
140 for (var i = 0; i < 5; i++) {
141 window.setTimeout(function () {
142 redraw("3", $scope.valuess);
148 $scope.oneHour = function () {
150 $scope.barChart('hour');
154 $scope.oneDay = function () {
156 $scope.barChart('day');
158 $scope.oneMonth = function () {
160 $scope.barChart('month');
163 $scope.oneYear = function () {
165 $scope.barChart('year');