2 * Copyright 2016 Alexandre Terrasa <alexandre@moz-code.org>.
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.
19 .module('metrics', [])
21 .factory('Metrics', [ '$http', function($http
) {
23 loadStructuralMetrics
: function(id
, cb
, cbErr
) {
24 $http
.get('/api/metrics/structural/' + id
)
31 .directive('metricsList', function() {
38 listMetricsNames
: '=',
39 listMetricsDefault
: '='
41 templateUrl
: '/directives/metrics/metrics_list.html'
45 .directive('chartModuleDefinitionsKind', function() {
52 templateUrl
: '/directives/metrics/chart_properties.html',
53 link
: function ($scope
, element
, attrs
) {
54 $scope
.loadChart
= function() {
55 if($scope
.chart
) { return; }
56 $scope
.chart
= new d3pie($scope
.chartId
, {
67 "titleSubtitlePadding": 9
72 "pieOuterRadius": "80%"
75 "sortOrder": "value-asc",
78 "label": "Concrete classes",
79 "value": $scope
.chartMetrics
.mnbcc?
80 $scope
.chartMetrics
.mnbcc
.avg
: 0,
84 "label": "Abstract classes",
85 "value": $scope
.chartMetrics
.mnbac?
86 $scope
.chartMetrics
.mnbac
.avg
: 0,
90 "label": "Interfaces",
91 "value": $scope
.chartMetrics
.mnbic?
92 $scope
.chartMetrics
.mnbic
.avg
: 0,
99 "format": "label-value2",
103 "hideWhenLessThanPercentage": 3
127 $scope
.$
watch('chartMetrics', function(nv
, ov
) {
129 setTimeout($scope
.loadChart
, 100);
136 .directive('chartModuleDefinitionsInh', function() {
143 templateUrl
: '/directives/metrics/chart_properties.html',
144 link
: function ($scope
, element
, attrs
) {
145 $scope
.loadChart
= function() {
146 if($scope
.chart
) { return; }
147 $scope
.chart
= new d3pie($scope
.chartId
, {
158 "titleSubtitlePadding": 9
163 "pieOuterRadius": "80%"
166 "sortOrder": "value-asc",
169 "label": "Inherited",
170 "value": $scope
.chartMetrics
.mnbd
.avg
- $scope
.chartMetrics
.mnbr
.avg
- $scope
.chartMetrics
.mnbi
.avg
,
174 "label": "Introduced",
175 "value": $scope
.chartMetrics
.mnbi
.avg
,
179 "label": "Redefined",
180 "value": $scope
.chartMetrics
.mnbr
.avg
,
187 "format": "label-value2",
191 "hideWhenLessThanPercentage": 3
215 $scope
.$
watch('chartMetrics', function(nv
, ov
) {
217 setTimeout($scope
.loadChart
, 100);
224 .directive('chartClassPropertiesInh', function() {
231 templateUrl
: '/directives/metrics/chart_properties.html',
232 link
: function ($scope
, element
, attrs
) {
233 $scope
.loadChart
= function() {
234 if($scope
.chart
) { return; }
235 $scope
.chart
= new d3pie($scope
.chartId
, {
246 "titleSubtitlePadding": 9
251 "pieOuterRadius": "80%"
254 "sortOrder": "value-asc",
257 "label": "Inherited",
258 "value": $scope
.chartMetrics
.cnbhp
.avg
- $scope
.chartMetrics
.cnbrp
.avg
,
262 "label": "Introduced",
263 "value": $scope
.chartMetrics
.cnbip
.avg
,
267 "label": "Redefined",
268 "value": $scope
.chartMetrics
.cnbrp
.avg
,
275 "format": "label-value2",
279 "hideWhenLessThanPercentage": 3
303 $scope
.$
watch('chartMetrics', function(nv
, ov
) {
305 setTimeout($scope
.loadChart
, 100);
312 .directive('chartClassPropertiesKind', function() {
319 templateUrl
: '/directives/metrics/chart_properties.html',
320 link
: function ($scope
, element
, attrs
) {
321 $scope
.loadChart
= function() {
322 if($scope
.chart
) { return; }
323 $scope
.chart
= new d3pie($scope
.chartId
, {
334 "titleSubtitlePadding": 9
339 "pieOuterRadius": "80%"
342 "sortOrder": "value-asc",
345 "label": "Attributes",
346 "value": $scope
.chartMetrics
.cnba
.avg
,
351 "value": $scope
.chartMetrics
.cnbm
.avg
- $scope
.chartMetrics
.cnbi
.avg
,
355 "label": "Constructors",
356 "value": $scope
.chartMetrics
.cnbi
.avg
,
360 "label": "Virtual Types",
361 "value": $scope
.chartMetrics
.cnbv
.avg
,
368 "format": "label-value2",
372 "hideWhenLessThanPercentage": 3
396 $scope
.$
watch('chartMetrics', function(nv
, ov
) {
398 setTimeout($scope
.loadChart
, 100);
405 .directive('chartClassInheritanceKind', function() {
412 templateUrl
: '/directives/metrics/chart_properties.html',
413 link
: function ($scope
, element
, attrs
) {
414 $scope
.loadChart
= function() {
415 if($scope
.chart
) { return; }
416 $scope
.chart
= new d3pie($scope
.chartId
, {
427 "titleSubtitlePadding": 9
432 "pieOuterRadius": "80%"
435 "sortOrder": "value-asc",
438 "label": "Interfaces",
439 "value": $scope
.chartMetrics
.cnoai
.avg
,
443 "label": "Abstract classes",
444 "value": $scope
.chartMetrics
.cnoaa
.avg
,
448 "label": "Concrete classes",
449 "value": $scope
.chartMetrics
.cnoac
.avg
- $scope
.chartMetrics
.cnoaa
.avg
,
456 "format": "label-value2",
460 "hideWhenLessThanPercentage": 3
484 $scope
.$
watch('chartMetrics', function(nv
, ov
) {
486 setTimeout($scope
.loadChart
, 100);