toggle-components-library 1.24.13 → 1.24.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/toggle-components-library.common.js +71 -41
- package/dist/toggle-components-library.common.js.map +1 -1
- package/dist/toggle-components-library.css +1 -1
- package/dist/toggle-components-library.umd.js +71 -41
- package/dist/toggle-components-library.umd.js.map +1 -1
- package/dist/toggle-components-library.umd.min.js +1 -1
- package/dist/toggle-components-library.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/components/metrics/ToggleMetricBarChart.vue +2 -2
- package/src/components/metrics/ToggleMetricPieChart.vue +14 -7
- package/src/components/metrics/ToggleMetricSparkLine.vue +4 -3
- package/src/components/mixins/mixins.js +39 -21
- package/src/sass/includes/_as_inputs.scss +1 -1
- package/src/sass/includes/_as_navs.scss +4 -3
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
3
|
<h3 class="toggle-metric metric-label">{{label}}</h3>
|
|
4
|
-
<apexchart type="pie" :options="chartOptions" :series="values"></apexchart>
|
|
4
|
+
<apexchart type="pie" :height="height" :options="chartOptions" :series="values"></apexchart>
|
|
5
5
|
</div>
|
|
6
6
|
|
|
7
7
|
</template>
|
|
@@ -27,6 +27,13 @@ export default {
|
|
|
27
27
|
type: Array,
|
|
28
28
|
required: true
|
|
29
29
|
},
|
|
30
|
+
/*
|
|
31
|
+
* Component's height
|
|
32
|
+
*/
|
|
33
|
+
height: {
|
|
34
|
+
type: String,
|
|
35
|
+
default: ""
|
|
36
|
+
},
|
|
30
37
|
/**
|
|
31
38
|
* Component's main label
|
|
32
39
|
*/
|
|
@@ -52,14 +59,14 @@ export default {
|
|
|
52
59
|
labels: this.labels,
|
|
53
60
|
plotOptions: {
|
|
54
61
|
pie: {
|
|
55
|
-
|
|
62
|
+
distributed : false,
|
|
63
|
+
customScale: 0.7,
|
|
56
64
|
dataLabels: {
|
|
57
|
-
offset:
|
|
58
|
-
}
|
|
59
|
-
|
|
65
|
+
offset: 100
|
|
66
|
+
}
|
|
60
67
|
}
|
|
61
68
|
},
|
|
62
|
-
|
|
69
|
+
colors: this.colors ? this.colors : this.getDefaultColors(),
|
|
63
70
|
dataLabels: {
|
|
64
71
|
enabledOnSeries: true,
|
|
65
72
|
formatter: function (val, {seriesIndex, w}) {
|
|
@@ -67,7 +74,7 @@ export default {
|
|
|
67
74
|
},
|
|
68
75
|
style: {
|
|
69
76
|
colors: [this.getColor('black')],
|
|
70
|
-
fontSize: '1rem',
|
|
77
|
+
fontSize: '1.1rem',
|
|
71
78
|
fontWeight: 'bold'
|
|
72
79
|
},
|
|
73
80
|
background: {
|
|
@@ -102,7 +102,7 @@ export default {
|
|
|
102
102
|
/**
|
|
103
103
|
* Percentage base used to calculate the trend impact
|
|
104
104
|
*/
|
|
105
|
-
|
|
105
|
+
trend_impact_base :{
|
|
106
106
|
type: Number,
|
|
107
107
|
default: 5
|
|
108
108
|
},
|
|
@@ -193,9 +193,10 @@ export default {
|
|
|
193
193
|
if (this.sparkLineVal[0].data.length > 0) {
|
|
194
194
|
// if the value is an object, map to array
|
|
195
195
|
|
|
196
|
-
const trendImpactVals = this.sparkLineVal[0].data[0].y ? this.sparkLineVal[0].data.map(data => data.y) : this.sparkLineVal[0].data;
|
|
196
|
+
const trendImpactVals = this.sparkLineVal[0].data[0].y || this.sparkLineVal[0].data[0].y === 0 ? this.sparkLineVal[0].data.map(data => data.y) : this.sparkLineVal[0].data;
|
|
197
|
+
|
|
198
|
+
let result = this.calcTrendImpact(trendImpactVals, this.trend_impact_base);
|
|
197
199
|
|
|
198
|
-
let result = this.calcTrendImpact(trendImpactVals, this.trend_impact_percentage);
|
|
199
200
|
if (this.inverse_trend_impact === true && result != false)
|
|
200
201
|
return result *-1;
|
|
201
202
|
else
|
|
@@ -108,7 +108,7 @@ export const charts = {
|
|
|
108
108
|
return {
|
|
109
109
|
|
|
110
110
|
defcolors: [
|
|
111
|
-
|
|
111
|
+
'#85B4FF', '#81F4FF', '#A898FF'
|
|
112
112
|
]
|
|
113
113
|
}
|
|
114
114
|
},
|
|
@@ -122,41 +122,59 @@ export const charts = {
|
|
|
122
122
|
*
|
|
123
123
|
* @return { {Integer} 1, 0,-1 }
|
|
124
124
|
*/
|
|
125
|
-
calcTrendImpact(values,
|
|
125
|
+
calcTrendImpact(values, trend_impact_base){
|
|
126
126
|
|
|
127
127
|
// If all values in the values array are 0 return 0;
|
|
128
128
|
if (values.every((val) => val === 0)){
|
|
129
129
|
return false;
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
let
|
|
133
|
-
values.forEach(val => {
|
|
134
|
-
sum = sum + val;
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
let average = sum/values.length;
|
|
132
|
+
let regressionCalc = this.calculateLinearRegression(values);
|
|
138
133
|
|
|
139
|
-
|
|
140
|
-
|
|
134
|
+
if (regressionCalc >= trend_impact_base){
|
|
135
|
+
return 1;
|
|
136
|
+
} else if (regressionCalc < -trend_impact_base) {
|
|
137
|
+
return -1;
|
|
138
|
+
} else {
|
|
139
|
+
return 0;
|
|
140
|
+
}
|
|
141
|
+
},
|
|
141
142
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
143
|
+
/*
|
|
144
|
+
* Calculates the linear regression for the trend impact
|
|
145
|
+
*
|
|
146
|
+
* @param {Array} [nums] [the array of values to be calculated]
|
|
147
|
+
* @return {Integer}
|
|
148
|
+
*/
|
|
149
|
+
calculateLinearRegression(nums) {
|
|
150
|
+
let summed_nums = 0;
|
|
151
|
+
nums.forEach(val => {
|
|
152
|
+
summed_nums = summed_nums + val;
|
|
153
|
+
});
|
|
146
154
|
|
|
147
|
-
let
|
|
155
|
+
let multiplied_data = 0;
|
|
156
|
+
let summed_index = 0;
|
|
157
|
+
let squared_index = 0;
|
|
148
158
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
159
|
+
nums.forEach((num, index) => {
|
|
160
|
+
index += 1;
|
|
161
|
+
multiplied_data += index * num;
|
|
162
|
+
summed_index += index;
|
|
163
|
+
squared_index += index**2;
|
|
164
|
+
});
|
|
154
165
|
|
|
166
|
+
let numerator = ( (nums.length) * multiplied_data) - (summed_nums * summed_index);
|
|
167
|
+
let denominator = ( (nums.length) * squared_index) - summed_index**2;
|
|
168
|
+
|
|
169
|
+
if (denominator != 0)
|
|
170
|
+
return numerator/denominator;
|
|
171
|
+
else
|
|
172
|
+
return 0;
|
|
155
173
|
},
|
|
156
174
|
|
|
157
175
|
//return an array of default colors
|
|
158
176
|
getDefaultColors() {
|
|
159
|
-
return this.$data.defcolors
|
|
177
|
+
return this.$data.defcolors;
|
|
160
178
|
},
|
|
161
179
|
|
|
162
180
|
//return a specific color
|
|
@@ -140,8 +140,8 @@
|
|
|
140
140
|
min-height: 100vh;
|
|
141
141
|
|
|
142
142
|
.toggle-multi-tier-sidenav-logo {
|
|
143
|
-
max-width:
|
|
144
|
-
margin: 1rem 0
|
|
143
|
+
max-width: 7rem;
|
|
144
|
+
margin: 1rem 0 2rem 0.6rem;
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
.toggle-multi-tier-sidenav-user-icon {
|
|
@@ -215,6 +215,7 @@
|
|
|
215
215
|
}
|
|
216
216
|
|
|
217
217
|
.toggle-multi-tier-sidenav-title {
|
|
218
|
+
font-size: 0.9rem;
|
|
218
219
|
margin: 2rem 0 0 .6rem;
|
|
219
220
|
}
|
|
220
221
|
|
|
@@ -272,7 +273,7 @@
|
|
|
272
273
|
.toggle-multi-tier-sidenav-item {
|
|
273
274
|
list-style: none;
|
|
274
275
|
font-family: $toggle-font-family;
|
|
275
|
-
font-size:
|
|
276
|
+
font-size: 1rem;
|
|
276
277
|
font-weight: bold !important;
|
|
277
278
|
padding-bottom: 0.25rem;
|
|
278
279
|
|