toggle-components-library 1.24.2 → 1.24.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "toggle-components-library",
3
- "version": "1.24.2",
3
+ "version": "1.24.3",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -1,6 +1,7 @@
1
1
  <template>
2
2
  <div>
3
3
  <h3 class="toggle-metric metric-label">{{label}}</h3>
4
+ {{checkWindowSize}}
4
5
  <apexchart type="bar" :height="height" :options="chartOptions" :series="values"></apexchart>
5
6
  </div>
6
7
 
@@ -57,11 +58,18 @@ export default {
57
58
  */
58
59
  chartOptions() {
59
60
  return {
61
+ tooltip: {
62
+ y: {
63
+ formatter: function(value, opts) {
64
+ let percent = opts.w.globals.seriesPercent[opts.seriesIndex][opts.dataPointIndex];
65
+ return percent.toFixed(0) + '%'
66
+ }
67
+ }
68
+ },
60
69
  plotOptions: {
61
70
  bar: {
62
71
  borderRadius: 5,
63
72
  columnWidth: '60%',
64
-
65
73
  }
66
74
 
67
75
  },
@@ -71,8 +79,7 @@ export default {
71
79
  },
72
80
  },
73
81
  grid: {
74
-
75
- show: false,
82
+ show: false
76
83
  },
77
84
  dataLabels: {
78
85
  enabled: false,
@@ -52,10 +52,11 @@ export default {
52
52
  labels: this.labels,
53
53
  plotOptions: {
54
54
  pie: {
55
- customScale: 0.7,
55
+ customScale: 1,
56
56
  dataLabels: {
57
- offset: 125
58
- }
57
+ offset: -50
58
+ }
59
+
59
60
  }
60
61
  },
61
62
  colors: this.colors ? this.colors : this.getDefaultColors(),
@@ -66,7 +67,8 @@ export default {
66
67
  },
67
68
  style: {
68
69
  colors: [this.getColor('black')],
69
- fontSize: '2rem',
70
+ fontSize: '1rem',
71
+ fontWeight: 300
70
72
  },
71
73
  background: {
72
74
  enabled: false,
@@ -73,6 +73,10 @@ export default {
73
73
  * @return String
74
74
  */
75
75
  metricValue() {
76
+ if (this.value == 0) {
77
+ return "-";
78
+ }
79
+
76
80
  switch (this.type) {
77
81
  case 'currency':
78
82
  return (this.value/this.currencyDenomination).toLocaleString(this.currencyLocale, {style: 'currency', currency: this.currencyCode});
@@ -135,7 +135,13 @@ export default {
135
135
  redrawOnWindowResize: true,
136
136
  },
137
137
  stroke: {
138
- width: 5
138
+ width: 5,
139
+ },
140
+ grid: {
141
+ padding: {
142
+ top: 5,
143
+ bottom: 5,
144
+ }
139
145
  },
140
146
  noData: {
141
147
  text: "No data found",
@@ -155,7 +161,6 @@ export default {
155
161
  this.updateTrend();
156
162
  },
157
163
  computed: {
158
-
159
164
  /**
160
165
  * Defines the badge class from the trending impact
161
166
  * @return String
@@ -163,16 +168,18 @@ export default {
163
168
  trendImpactClass() {
164
169
  return this.getTrendImpact() === 1 ? 'confirm'
165
170
  : this.getTrendImpact() === -1 ? 'abort'
166
- : 'warning'
171
+ : this.getTrendImpact() === 0 ? 'warning'
172
+ : 'empty';
167
173
  },
168
174
  /**
169
175
  * Defines the badge title from the trending impact
170
176
  * @return String
171
177
  */
172
178
  trendImpactLabel() {
173
- return this.getTrendImpact() === 1 ? 'Trending up'
174
- : this.getTrendImpact() === -1 ? 'Going down'
175
- : 'Keeping steady'
179
+ return this.getTrendImpact() === 1 ? 'Trending up'
180
+ : this.getTrendImpact() === -1 ? 'Going down'
181
+ : this.getTrendImpact() === 0 ? 'Keeping steady'
182
+ : 'No data';
176
183
  }
177
184
  },
178
185
  methods: {
@@ -182,12 +189,20 @@ export default {
182
189
  */
183
190
  getTrendImpact() {
184
191
 
185
- // if the value is an object, map to array
192
+ if (this.sparkLineVal[0].data.length > 0) {
193
+ // if the value is an object, map to array
194
+
195
+ const trendImpactVals = this.sparkLineVal[0].data[0].y ? this.sparkLineVal[0].data.map(data => data.y) : this.sparkLineVal[0].data;
186
196
 
187
- const trendImpactVals = this.sparkLineVal[0].data[0].y ? this.sparkLineVal[0].data.map(data => data.y) : this.sparkLineVal[0].data;
197
+ let result = this.calcTrendImpact(trendImpactVals, this.trend_impact_percentage);
198
+ if (this.inverse_trend_impact === true && result != false)
199
+ return result *-1;
200
+ else
201
+ return result;
188
202
 
189
- let result = this.calcTrendImpact(trendImpactVals, this.trend_impact_percentage);
190
- return this.inverse_trend_impact === true ? result = result *-1 : result;
203
+ } else {
204
+ return false;
205
+ }
191
206
  },
192
207
 
193
208
  /**
@@ -207,6 +222,9 @@ export default {
207
222
  case -1:
208
223
  this.updateChart([this.getColor('red')]);
209
224
  break;
225
+ case false:
226
+ this.updateChart([this.getColor('gray')]);
227
+ break;
210
228
  }
211
229
  },
212
230
 
@@ -124,6 +124,10 @@ export const charts = {
124
124
  */
125
125
  calcTrendImpact(values, percentageBase){
126
126
 
127
+ // If all values in the values array are 0 return 0;
128
+ if (values.every((val) => val === 0)){
129
+ return 0;
130
+ }
127
131
 
128
132
  let sum = 0
129
133
  values.forEach(val => {
@@ -152,7 +156,7 @@ export const charts = {
152
156
 
153
157
  //return an array of default colors
154
158
  getDefaultColors() {
155
- return this.$data.defcolors;
159
+ return this.$data.defcolors.sort(() => Math.random() - 0.5);
156
160
  },
157
161
 
158
162
  //return a specific color
@@ -28,4 +28,8 @@
28
28
  &.warning {
29
29
  background-color: $toggle-button-amber;
30
30
  }
31
+
32
+ &.empty {
33
+ background-color: $toggle-placeholder-grey;
34
+ }
31
35
  }
@@ -99,4 +99,11 @@
99
99
  .funnel-single-metric-container {
100
100
  margin-left: 40%;
101
101
  align-self: center;
102
+ }
103
+
104
+ @media (min-width: $toggle-breakpoint-large-desktop) {
105
+ .funnel-grid-svg {
106
+ min-height: 15rem;
107
+ background-size: 100%;
108
+ }
102
109
  }