@splunk/react-visualizations 23.5.0 → 24.3.0
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/.loki/reference/chrome_docker_FillerGauge_Orientation_horizontal_height_90_show_placeholder.png +0 -0
- package/.loki/reference/chrome_docker_FillerGauge_Too_Small_to_Render.png +0 -0
- package/.loki/reference/chrome_docker_MarkerGauge_Invalid_ranges_duplicate_entries_from.png +0 -0
- package/.loki/reference/chrome_docker_MarkerGauge_Invalid_ranges_duplicate_entries_to.png +0 -0
- package/.loki/reference/chrome_docker_MarkerGauge_Invalid_ranges_invalid_entries_discontinuous_ranges.png +0 -0
- package/.loki/reference/chrome_docker_MarkerGauge_Invalid_ranges_invalid_entries_from_equals_to_to.png +0 -0
- package/.loki/reference/chrome_docker_MarkerGauge_Invalid_ranges_invalid_entries_from_is_larger_than_to.png +0 -0
- package/.loki/reference/chrome_docker_MarkerGauge_Invalid_ranges_missing_entries.png +0 -0
- package/.loki/reference/chrome_docker_MarkerGauge_Orientation_horizontal_height_90_show_placeholder.png +0 -0
- package/.loki/reference/chrome_docker_MarkerGauge_Too_Small_to_Render.png +0 -0
- package/.loki/reference/chrome_docker_SvgChoroplethDynamic_SVG_prop_is_missing.png +0 -0
- package/Area.js +36 -27
- package/Area.js.map +1 -1
- package/Bar.js +35 -26
- package/Bar.js.map +1 -1
- package/Bubble.js +80 -93
- package/Bubble.js.map +1 -1
- package/Column.js +36 -27
- package/Column.js.map +1 -1
- package/FillerGauge.js +16 -16
- package/FillerGauge.js.map +1 -1
- package/GeoJsonChoropleth.js +201 -179
- package/GeoJsonChoropleth.js.map +1 -1
- package/Line.js +91 -113
- package/Line.js.map +1 -1
- package/MarkerGauge.js +16 -16
- package/MarkerGauge.js.map +1 -1
- package/Pie.js +30 -30
- package/Pie.js.map +1 -1
- package/Punchcard.js +21 -21
- package/Punchcard.js.map +1 -1
- package/Scatter.js +60 -60
- package/Scatter.js.map +1 -1
- package/SingleValue.js +23 -23
- package/SingleValue.js.map +1 -1
- package/SingleValueIcon.js +25 -25
- package/SingleValueIcon.js.map +1 -1
- package/SingleValueRadial.js +928 -72
- package/SingleValueRadial.js.map +1 -1
- package/SvgChoropleth.js +43 -52
- package/SvgChoropleth.js.map +1 -1
- package/SvgChoroplethDynamic.js +22 -22
- package/SvgChoroplethDynamic.js.map +1 -1
- package/package.json +14 -17
package/SingleValueRadial.js
CHANGED
|
@@ -87,25 +87,82 @@ module.exports =
|
|
|
87
87
|
/******/
|
|
88
88
|
/******/
|
|
89
89
|
/******/ // Load entry module and return exports
|
|
90
|
-
/******/ return __webpack_require__(__webpack_require__.s =
|
|
90
|
+
/******/ return __webpack_require__(__webpack_require__.s = 71);
|
|
91
91
|
/******/ })
|
|
92
92
|
/************************************************************************/
|
|
93
|
-
/******/ (
|
|
94
|
-
|
|
95
|
-
/***/ 0:
|
|
93
|
+
/******/ ([
|
|
94
|
+
/* 0 */
|
|
96
95
|
/***/ (function(module, exports) {
|
|
97
96
|
|
|
98
97
|
module.exports = require("prop-types");
|
|
99
98
|
|
|
100
99
|
/***/ }),
|
|
100
|
+
/* 1 */
|
|
101
|
+
/***/ (function(module, exports) {
|
|
102
|
+
|
|
103
|
+
module.exports = require("react");
|
|
104
|
+
|
|
105
|
+
/***/ }),
|
|
106
|
+
/* 2 */,
|
|
107
|
+
/* 3 */
|
|
108
|
+
/***/ (function(module, exports) {
|
|
109
|
+
|
|
110
|
+
module.exports = require("@splunk/visualizations-shared/SanitizeProps");
|
|
111
|
+
|
|
112
|
+
/***/ }),
|
|
113
|
+
/* 4 */
|
|
114
|
+
/***/ (function(module, exports) {
|
|
115
|
+
|
|
116
|
+
module.exports = require("@babel/runtime/helpers/extends");
|
|
117
|
+
|
|
118
|
+
/***/ }),
|
|
119
|
+
/* 5 */,
|
|
120
|
+
/* 6 */
|
|
121
|
+
/***/ (function(module, exports) {
|
|
122
|
+
|
|
123
|
+
module.exports = require("@babel/runtime/helpers/defineProperty");
|
|
124
|
+
|
|
125
|
+
/***/ }),
|
|
126
|
+
/* 7 */
|
|
127
|
+
/***/ (function(module, exports) {
|
|
128
|
+
|
|
129
|
+
module.exports = require("styled-components");
|
|
130
|
+
|
|
131
|
+
/***/ }),
|
|
132
|
+
/* 8 */
|
|
133
|
+
/***/ (function(module, exports) {
|
|
134
|
+
|
|
135
|
+
module.exports = require("lodash/omit");
|
|
136
|
+
|
|
137
|
+
/***/ }),
|
|
138
|
+
/* 9 */,
|
|
139
|
+
/* 10 */,
|
|
140
|
+
/* 11 */,
|
|
141
|
+
/* 12 */,
|
|
142
|
+
/* 13 */,
|
|
143
|
+
/* 14 */,
|
|
144
|
+
/* 15 */,
|
|
145
|
+
/* 16 */,
|
|
146
|
+
/* 17 */,
|
|
147
|
+
/* 18 */
|
|
148
|
+
/***/ (function(module, exports) {
|
|
149
|
+
|
|
150
|
+
module.exports = require("lodash/isEmpty");
|
|
151
|
+
|
|
152
|
+
/***/ }),
|
|
153
|
+
/* 19 */
|
|
154
|
+
/***/ (function(module, exports) {
|
|
155
|
+
|
|
156
|
+
module.exports = require("@splunk/visualizations/common/utils/singleValueUtils");
|
|
101
157
|
|
|
102
|
-
/***/
|
|
158
|
+
/***/ }),
|
|
159
|
+
/* 20 */
|
|
103
160
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
104
161
|
|
|
105
162
|
"use strict";
|
|
106
163
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return propsConvert; });
|
|
107
164
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return propsDeprecate; });
|
|
108
|
-
/* harmony import */ var lodash_omit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(
|
|
165
|
+
/* harmony import */ var lodash_omit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8);
|
|
109
166
|
/* harmony import */ var lodash_omit__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_omit__WEBPACK_IMPORTED_MODULE_0__);
|
|
110
167
|
|
|
111
168
|
/**
|
|
@@ -135,60 +192,407 @@ var propsDeprecate = function propsDeprecate(props, deprecatedProps) {
|
|
|
135
192
|
};
|
|
136
193
|
|
|
137
194
|
/***/ }),
|
|
138
|
-
|
|
139
|
-
|
|
195
|
+
/* 21 */,
|
|
196
|
+
/* 22 */
|
|
140
197
|
/***/ (function(module, exports) {
|
|
141
198
|
|
|
142
|
-
module.exports = require("
|
|
199
|
+
module.exports = require("@splunk/themes/variables");
|
|
143
200
|
|
|
144
201
|
/***/ }),
|
|
145
|
-
|
|
146
|
-
|
|
202
|
+
/* 23 */,
|
|
203
|
+
/* 24 */,
|
|
204
|
+
/* 25 */,
|
|
205
|
+
/* 26 */,
|
|
206
|
+
/* 27 */,
|
|
207
|
+
/* 28 */,
|
|
208
|
+
/* 29 */
|
|
147
209
|
/***/ (function(module, exports) {
|
|
148
210
|
|
|
149
|
-
module.exports = require("@splunk/
|
|
211
|
+
module.exports = require("@splunk/themes/pick");
|
|
150
212
|
|
|
151
213
|
/***/ }),
|
|
214
|
+
/* 30 */
|
|
215
|
+
/***/ (function(module, exports) {
|
|
152
216
|
|
|
153
|
-
|
|
217
|
+
module.exports = require("@splunk/visualizations-shared/colorConstants");
|
|
218
|
+
|
|
219
|
+
/***/ }),
|
|
220
|
+
/* 31 */,
|
|
221
|
+
/* 32 */
|
|
154
222
|
/***/ (function(module, exports) {
|
|
155
223
|
|
|
156
|
-
module.exports = require("@splunk/
|
|
224
|
+
module.exports = require("@splunk/ui-utils/i18n");
|
|
157
225
|
|
|
158
226
|
/***/ }),
|
|
227
|
+
/* 33 */
|
|
228
|
+
/***/ (function(module, exports) {
|
|
159
229
|
|
|
160
|
-
|
|
230
|
+
module.exports = require("@splunk/visualizations-shared/Message");
|
|
231
|
+
|
|
232
|
+
/***/ }),
|
|
233
|
+
/* 34 */,
|
|
234
|
+
/* 35 */
|
|
161
235
|
/***/ (function(module, exports) {
|
|
162
236
|
|
|
163
|
-
module.exports = require("@
|
|
237
|
+
module.exports = require("@splunk/visualizations/SingleValueBasic");
|
|
164
238
|
|
|
165
239
|
/***/ }),
|
|
240
|
+
/* 36 */,
|
|
241
|
+
/* 37 */,
|
|
242
|
+
/* 38 */,
|
|
243
|
+
/* 39 */,
|
|
244
|
+
/* 40 */,
|
|
245
|
+
/* 41 */,
|
|
246
|
+
/* 42 */,
|
|
247
|
+
/* 43 */
|
|
248
|
+
/***/ (function(module, exports) {
|
|
166
249
|
|
|
167
|
-
|
|
250
|
+
module.exports = require("lodash/pick");
|
|
251
|
+
|
|
252
|
+
/***/ }),
|
|
253
|
+
/* 44 */
|
|
168
254
|
/***/ (function(module, exports) {
|
|
169
255
|
|
|
170
|
-
module.exports = require("@
|
|
256
|
+
module.exports = require("@splunk/visualizations-shared/style");
|
|
171
257
|
|
|
172
258
|
/***/ }),
|
|
259
|
+
/* 45 */
|
|
260
|
+
/***/ (function(module, exports) {
|
|
173
261
|
|
|
174
|
-
|
|
262
|
+
module.exports = require("@splunk/visualizations-shared/SizeAwareWrapper");
|
|
263
|
+
|
|
264
|
+
/***/ }),
|
|
265
|
+
/* 46 */,
|
|
266
|
+
/* 47 */,
|
|
267
|
+
/* 48 */,
|
|
268
|
+
/* 49 */,
|
|
269
|
+
/* 50 */,
|
|
270
|
+
/* 51 */,
|
|
271
|
+
/* 52 */,
|
|
272
|
+
/* 53 */,
|
|
273
|
+
/* 54 */,
|
|
274
|
+
/* 55 */,
|
|
275
|
+
/* 56 */,
|
|
276
|
+
/* 57 */,
|
|
277
|
+
/* 58 */,
|
|
278
|
+
/* 59 */,
|
|
279
|
+
/* 60 */,
|
|
280
|
+
/* 61 */,
|
|
281
|
+
/* 62 */,
|
|
282
|
+
/* 63 */,
|
|
283
|
+
/* 64 */,
|
|
284
|
+
/* 65 */,
|
|
285
|
+
/* 66 */,
|
|
286
|
+
/* 67 */,
|
|
287
|
+
/* 68 */,
|
|
288
|
+
/* 69 */,
|
|
289
|
+
/* 70 */,
|
|
290
|
+
/* 71 */
|
|
175
291
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
176
292
|
|
|
177
293
|
"use strict";
|
|
294
|
+
// ESM COMPAT FLAG
|
|
178
295
|
__webpack_require__.r(__webpack_exports__);
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
296
|
+
|
|
297
|
+
// EXTERNAL MODULE: external "@babel/runtime/helpers/defineProperty"
|
|
298
|
+
var defineProperty_ = __webpack_require__(6);
|
|
299
|
+
var defineProperty_default = /*#__PURE__*/__webpack_require__.n(defineProperty_);
|
|
300
|
+
|
|
301
|
+
// EXTERNAL MODULE: external "@babel/runtime/helpers/extends"
|
|
302
|
+
var extends_ = __webpack_require__(4);
|
|
303
|
+
var extends_default = /*#__PURE__*/__webpack_require__.n(extends_);
|
|
304
|
+
|
|
305
|
+
// EXTERNAL MODULE: external "react"
|
|
306
|
+
var external_react_ = __webpack_require__(1);
|
|
307
|
+
var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_);
|
|
308
|
+
|
|
309
|
+
// EXTERNAL MODULE: external "prop-types"
|
|
310
|
+
var external_prop_types_ = __webpack_require__(0);
|
|
311
|
+
var external_prop_types_default = /*#__PURE__*/__webpack_require__.n(external_prop_types_);
|
|
312
|
+
|
|
313
|
+
// EXTERNAL MODULE: external "@splunk/visualizations-shared/SanitizeProps"
|
|
314
|
+
var SanitizeProps_ = __webpack_require__(3);
|
|
315
|
+
|
|
316
|
+
// EXTERNAL MODULE: external "@splunk/themes/pick"
|
|
317
|
+
var pick_ = __webpack_require__(29);
|
|
318
|
+
var pick_default = /*#__PURE__*/__webpack_require__.n(pick_);
|
|
319
|
+
|
|
320
|
+
// EXTERNAL MODULE: external "@splunk/themes/variables"
|
|
321
|
+
var variables_ = __webpack_require__(22);
|
|
322
|
+
var variables_default = /*#__PURE__*/__webpack_require__.n(variables_);
|
|
323
|
+
|
|
324
|
+
// EXTERNAL MODULE: external "styled-components"
|
|
325
|
+
var external_styled_components_ = __webpack_require__(7);
|
|
326
|
+
var external_styled_components_default = /*#__PURE__*/__webpack_require__.n(external_styled_components_);
|
|
327
|
+
|
|
328
|
+
// EXTERNAL MODULE: external "lodash/pick"
|
|
329
|
+
var external_lodash_pick_ = __webpack_require__(43);
|
|
330
|
+
var external_lodash_pick_default = /*#__PURE__*/__webpack_require__.n(external_lodash_pick_);
|
|
331
|
+
|
|
332
|
+
// EXTERNAL MODULE: external "lodash/isEmpty"
|
|
333
|
+
var isEmpty_ = __webpack_require__(18);
|
|
334
|
+
var isEmpty_default = /*#__PURE__*/__webpack_require__.n(isEmpty_);
|
|
335
|
+
|
|
336
|
+
// EXTERNAL MODULE: external "@splunk/ui-utils/i18n"
|
|
337
|
+
var i18n_ = __webpack_require__(32);
|
|
338
|
+
|
|
339
|
+
// EXTERNAL MODULE: external "@splunk/visualizations-shared/style"
|
|
340
|
+
var style_ = __webpack_require__(44);
|
|
341
|
+
|
|
342
|
+
// EXTERNAL MODULE: external "@splunk/visualizations-shared/SizeAwareWrapper"
|
|
343
|
+
var SizeAwareWrapper_ = __webpack_require__(45);
|
|
344
|
+
var SizeAwareWrapper_default = /*#__PURE__*/__webpack_require__.n(SizeAwareWrapper_);
|
|
345
|
+
|
|
346
|
+
// EXTERNAL MODULE: external "@splunk/visualizations-shared/Message"
|
|
347
|
+
var Message_ = __webpack_require__(33);
|
|
348
|
+
var Message_default = /*#__PURE__*/__webpack_require__.n(Message_);
|
|
349
|
+
|
|
350
|
+
// EXTERNAL MODULE: external "@splunk/visualizations/common/utils/singleValueUtils"
|
|
351
|
+
var singleValueUtils_ = __webpack_require__(19);
|
|
352
|
+
|
|
353
|
+
// EXTERNAL MODULE: external "@splunk/visualizations/SingleValueBasic"
|
|
354
|
+
var SingleValueBasic_ = __webpack_require__(35);
|
|
355
|
+
var SingleValueBasic_default = /*#__PURE__*/__webpack_require__.n(SingleValueBasic_);
|
|
356
|
+
|
|
357
|
+
// EXTERNAL MODULE: external "@splunk/visualizations-shared/colorConstants"
|
|
358
|
+
var colorConstants_ = __webpack_require__(30);
|
|
359
|
+
|
|
360
|
+
// CONCATENATED MODULE: ./src/visualizations/SingleValueRadial/src/components/RadialGraph.jsx
|
|
361
|
+
// this is a copy of RadialGraph.jsx @ 23.5.0 before the design changes to PureSingleValueRadial were rolled out
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
var RadialGraph_RadialGraph = function RadialGraph(_ref) {
|
|
367
|
+
var progress = _ref.progress,
|
|
368
|
+
_ref$size = _ref.size,
|
|
369
|
+
size = _ref$size === void 0 ? 200 : _ref$size,
|
|
370
|
+
strokeWidth = _ref.strokeWidth,
|
|
371
|
+
_ref$backgroundColor = _ref.backgroundColor,
|
|
372
|
+
backgroundColor = _ref$backgroundColor === void 0 ? colorConstants_["RADIAL_BACKGROUND_COLOR"] : _ref$backgroundColor,
|
|
373
|
+
_ref$progressColor = _ref.progressColor,
|
|
374
|
+
progressColor = _ref$progressColor === void 0 ? colorConstants_["RADIAL_STROKE_COLOR"] : _ref$progressColor;
|
|
375
|
+
var normalizedSize = size / 2;
|
|
376
|
+
var normalizedRadius = normalizedSize - strokeWidth * 2;
|
|
377
|
+
var circumference = normalizedRadius * 2 * Math.PI;
|
|
378
|
+
var bgCircleOffset = 0.8 * circumference;
|
|
379
|
+
var progress80 = progress / 100 * 80;
|
|
380
|
+
var progressWidth = progress80 / 100 * circumference; // Offset the start of the circle to a position that makes the arc look evenly spaced
|
|
381
|
+
// with the opening at the bottom
|
|
382
|
+
// We use 80% of a circle (288deg), half on each side of "0" (144deg)
|
|
383
|
+
// SVG starts drawing (0deg) at the 3 o'clock position, so add another 90 to offset this (234deg)
|
|
384
|
+
// This means the arc length that we offset is 2 * PI * r * 234/360 or ...
|
|
385
|
+
|
|
386
|
+
var strokeDashoffset = circumference * 0.65;
|
|
387
|
+
return /*#__PURE__*/external_react_default.a.createElement("svg", {
|
|
388
|
+
height: normalizedSize * 2,
|
|
389
|
+
width: normalizedSize * 2
|
|
390
|
+
}, /*#__PURE__*/external_react_default.a.createElement("g", null, /*#__PURE__*/external_react_default.a.createElement("circle", {
|
|
391
|
+
"data-test": "background-radial",
|
|
392
|
+
stroke: backgroundColor,
|
|
393
|
+
fill: "transparent",
|
|
394
|
+
strokeWidth: strokeWidth,
|
|
395
|
+
strokeDasharray: "".concat(bgCircleOffset, " ").concat(circumference - bgCircleOffset),
|
|
396
|
+
style: {
|
|
397
|
+
strokeDashoffset: strokeDashoffset
|
|
398
|
+
},
|
|
399
|
+
r: normalizedRadius,
|
|
400
|
+
cx: normalizedSize,
|
|
401
|
+
cy: normalizedSize
|
|
402
|
+
}), /*#__PURE__*/external_react_default.a.createElement("circle", {
|
|
403
|
+
"data-test": "progress-radial",
|
|
404
|
+
stroke: progressColor,
|
|
405
|
+
fill: "transparent",
|
|
406
|
+
strokeWidth: strokeWidth,
|
|
407
|
+
strokeDasharray: "".concat(progressWidth, " ").concat(circumference - progressWidth),
|
|
408
|
+
style: {
|
|
409
|
+
strokeDashoffset: strokeDashoffset
|
|
410
|
+
},
|
|
411
|
+
r: normalizedRadius,
|
|
412
|
+
cx: normalizedSize,
|
|
413
|
+
cy: normalizedSize
|
|
414
|
+
})));
|
|
415
|
+
};
|
|
416
|
+
|
|
417
|
+
RadialGraph_RadialGraph.propTypes = {
|
|
418
|
+
progress: external_prop_types_default.a.number,
|
|
419
|
+
size: external_prop_types_default.a.number,
|
|
420
|
+
strokeWidth: external_prop_types_default.a.number,
|
|
421
|
+
backgroundColor: external_prop_types_default.a.string,
|
|
422
|
+
progressColor: external_prop_types_default.a.string
|
|
423
|
+
};
|
|
424
|
+
RadialGraph_RadialGraph.defaultProps = {
|
|
425
|
+
progress: 0,
|
|
426
|
+
strokeWidth: 12
|
|
427
|
+
};
|
|
428
|
+
/* harmony default export */ var components_RadialGraph = (RadialGraph_RadialGraph);
|
|
429
|
+
// CONCATENATED MODULE: ./src/visualizations/SingleValueRadial/src/utils/displayUtils.js
|
|
430
|
+
// this is a copy of displayUtils.js @ 23.5.0 before the design changes to PureSingleValueRadial were rolled out
|
|
431
|
+
|
|
432
|
+
|
|
433
|
+
var VALID_TREND_POSITIONS = ['standard', 'below', 'outside'];
|
|
434
|
+
var MAJOR_FONT_THRESHOLD = 25;
|
|
435
|
+
var TREND_FONT_THRESHOLD = 12;
|
|
436
|
+
var DEFAULT_RADIAL_STROKE_WIDTH = 12;
|
|
437
|
+
var SMALL_RADIAL_STROKE_WIDTH = 6;
|
|
438
|
+
/**
|
|
439
|
+
* Get the colors for a radial graph based on severity
|
|
440
|
+
* @method getRadialColors
|
|
441
|
+
* @param {Object} props
|
|
442
|
+
* @param {Bool} props.backgroundEnabled
|
|
443
|
+
* @param {String} props.backgroundColor
|
|
444
|
+
* @returns {Object} { background, stroke } colors
|
|
445
|
+
*/
|
|
446
|
+
|
|
447
|
+
var displayUtils_getRadialColors = function getRadialColors(_ref) {
|
|
448
|
+
var backgroundEnabled = _ref.backgroundEnabled,
|
|
449
|
+
backgroundColor = _ref.backgroundColor;
|
|
450
|
+
return Object(singleValueUtils_["getGraphColors"])({
|
|
451
|
+
backgroundEnabled: backgroundEnabled,
|
|
452
|
+
backgroundColor: backgroundColor,
|
|
453
|
+
defaultColors: colorConstants_["RADIAL_SEVERITY_COLORS"],
|
|
454
|
+
customColorFormatter: function customColorFormatter(color) {
|
|
455
|
+
return {
|
|
456
|
+
background: Object(singleValueUtils_["lighten"])(color),
|
|
457
|
+
stroke: Object(singleValueUtils_["darken"])(color)
|
|
458
|
+
};
|
|
459
|
+
}
|
|
460
|
+
});
|
|
461
|
+
};
|
|
462
|
+
/**
|
|
463
|
+
* Figure out the diameter of the graph
|
|
464
|
+
* @method getGraphSize
|
|
465
|
+
* @param {Object} props
|
|
466
|
+
* @param {Number} props.width // Width of the container
|
|
467
|
+
* @param {Number} props.height // Height of the container
|
|
468
|
+
* @param {Number} props.underLabel // Underlabel if present
|
|
469
|
+
* @returns {Number} diameter of the graph
|
|
470
|
+
*/
|
|
471
|
+
|
|
472
|
+
var displayUtils_getGraphSize = function getGraphSize(_ref2) {
|
|
473
|
+
var width = _ref2.width,
|
|
474
|
+
height = _ref2.height,
|
|
475
|
+
underLabel = _ref2.underLabel;
|
|
476
|
+
var size = Math.min(width, height);
|
|
477
|
+
|
|
478
|
+
if (underLabel) {
|
|
479
|
+
size -= singleValueUtils_["DEFAULT_FONT"];
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
return size;
|
|
483
|
+
};
|
|
484
|
+
/**
|
|
485
|
+
* Get the maximum size of the container that holds the graph text
|
|
486
|
+
* @method getValueContentSize
|
|
487
|
+
* @param {Object} props
|
|
488
|
+
* @param {Number} props.graphSize
|
|
489
|
+
* @param {Number} props.radialStrokeWidth // Stroke width of the graph
|
|
490
|
+
* @returns {Number} content size for showing major and trend values in radial graph
|
|
491
|
+
*/
|
|
492
|
+
|
|
493
|
+
var getValueContentSize = function getValueContentSize(_ref3) {
|
|
494
|
+
var graphSize = _ref3.graphSize,
|
|
495
|
+
radialStrokeWidth = _ref3.radialStrokeWidth; // Account for the graph's stroke width
|
|
496
|
+
|
|
497
|
+
var diameter = graphSize - radialStrokeWidth; // Use pythagoreum theorum with circle diameter
|
|
498
|
+
// to calculate the size of the sides of the square inside the circle
|
|
499
|
+
|
|
500
|
+
return Math.floor(Math.sqrt(Math.pow(diameter, 2) / 2));
|
|
501
|
+
};
|
|
502
|
+
/*
|
|
503
|
+
* @method getRadialStrokeWidth
|
|
504
|
+
* @param {Number} graphSize
|
|
505
|
+
* @returns {Number} radial stroke width
|
|
506
|
+
*/
|
|
507
|
+
|
|
508
|
+
var getRadialStrokeWidth = function getRadialStrokeWidth(graphSize) {
|
|
509
|
+
return graphSize >= 90 ? DEFAULT_RADIAL_STROKE_WIDTH : SMALL_RADIAL_STROKE_WIDTH;
|
|
510
|
+
};
|
|
511
|
+
/*
|
|
512
|
+
* @method isValidPosition
|
|
513
|
+
* @param {String} position
|
|
514
|
+
* @returns {Bool}
|
|
515
|
+
*/
|
|
516
|
+
|
|
517
|
+
var isValidPosition = function isValidPosition(position) {
|
|
518
|
+
return VALID_TREND_POSITIONS.indexOf(position) > -1;
|
|
519
|
+
};
|
|
520
|
+
/**
|
|
521
|
+
* Compute the trend indicator position based on font size of major and trend value
|
|
522
|
+
* @method computeTrendIndicatorPosition
|
|
523
|
+
* @param {Object} props
|
|
524
|
+
* @param {String} props.trendIndicatorPosition
|
|
525
|
+
* @param {Number} props.majorTextFontSize
|
|
526
|
+
* @param {Number} props.trendTextFontSize
|
|
527
|
+
* @returns {String} trend indicator position in radial graph
|
|
528
|
+
*/
|
|
529
|
+
|
|
530
|
+
var computeTrendIndicatorPosition = function computeTrendIndicatorPosition(_ref4) {
|
|
531
|
+
var trendIndicatorPosition = _ref4.trendIndicatorPosition,
|
|
532
|
+
majorTextFontSize = _ref4.majorTextFontSize,
|
|
533
|
+
trendTextFontSize = _ref4.trendTextFontSize;
|
|
534
|
+
var position = trendIndicatorPosition;
|
|
535
|
+
|
|
536
|
+
if (!isValidPosition(position)) {
|
|
537
|
+
position = 'standard';
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
if (position !== 'outside' && (trendTextFontSize < TREND_FONT_THRESHOLD || majorTextFontSize < MAJOR_FONT_THRESHOLD)) {
|
|
541
|
+
position = 'below';
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
return position;
|
|
545
|
+
};
|
|
546
|
+
/*
|
|
547
|
+
* @method showTrendPositionStandard
|
|
548
|
+
* @param {Object} props
|
|
549
|
+
* @param {Bool} props.showTrendIndicator
|
|
550
|
+
* @param {String} props.position
|
|
551
|
+
* @returns {Bool}
|
|
552
|
+
*/
|
|
553
|
+
|
|
554
|
+
var showTrendPositionStandard = function showTrendPositionStandard(_ref5) {
|
|
555
|
+
var showTrendIndicator = _ref5.showTrendIndicator,
|
|
556
|
+
position = _ref5.position;
|
|
557
|
+
return showTrendIndicator && position === 'standard';
|
|
558
|
+
};
|
|
559
|
+
/*
|
|
560
|
+
* @method showTrendPositionBelow
|
|
561
|
+
* @param {Object} props
|
|
562
|
+
* @param {Bool} props.showTrendIndicator
|
|
563
|
+
* @param {String} props.position
|
|
564
|
+
* @returns {Bool}
|
|
565
|
+
*/
|
|
566
|
+
|
|
567
|
+
var showTrendPositionBelow = function showTrendPositionBelow(_ref6) {
|
|
568
|
+
var showTrendIndicator = _ref6.showTrendIndicator,
|
|
569
|
+
position = _ref6.position;
|
|
570
|
+
return showTrendIndicator && position === 'below';
|
|
571
|
+
};
|
|
572
|
+
/*
|
|
573
|
+
* @method showTrendPositionOutside
|
|
574
|
+
* @param {Object} props
|
|
575
|
+
* @param {Bool} props.showTrendIndicator
|
|
576
|
+
* @param {String} props.position
|
|
577
|
+
* @returns {Bool}
|
|
578
|
+
*/
|
|
579
|
+
|
|
580
|
+
var showTrendPositionOutside = function showTrendPositionOutside(_ref7) {
|
|
581
|
+
var showTrendIndicator = _ref7.showTrendIndicator,
|
|
582
|
+
position = _ref7.position;
|
|
583
|
+
return showTrendIndicator && position === 'outside';
|
|
584
|
+
};
|
|
585
|
+
/*
|
|
586
|
+
* todo: need handle max and min
|
|
587
|
+
* @method getRadialProgress
|
|
588
|
+
* @param {Number} majorValue
|
|
589
|
+
* @returns {Number} progress bar in radial graph
|
|
590
|
+
*/
|
|
591
|
+
|
|
592
|
+
var getRadialProgress = function getRadialProgress(majorValue) {
|
|
593
|
+
return Number.isNaN(Number(majorValue)) ? 0 : majorValue / Math.max(majorValue, 100) * 100;
|
|
594
|
+
};
|
|
595
|
+
// CONCATENATED MODULE: ./src/visualizations/SingleValueRadial/src/components/RadialLayout.jsx
|
|
192
596
|
|
|
193
597
|
|
|
194
598
|
|
|
@@ -212,7 +616,7 @@ function _objectSpread(target) {
|
|
|
212
616
|
|
|
213
617
|
if (i % 2) {
|
|
214
618
|
ownKeys(Object(source), true).forEach(function (key) {
|
|
215
|
-
|
|
619
|
+
defineProperty_default()(target, key, source[key]);
|
|
216
620
|
});
|
|
217
621
|
} else if (Object.getOwnPropertyDescriptors) {
|
|
218
622
|
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
@@ -223,6 +627,466 @@ function _objectSpread(target) {
|
|
|
223
627
|
}
|
|
224
628
|
}
|
|
225
629
|
|
|
630
|
+
return target;
|
|
631
|
+
} // this is a copy of RadialLayout.jsx @ 23.5.0 before the design changes to PureSingleValueRadial were rolled out
|
|
632
|
+
|
|
633
|
+
|
|
634
|
+
|
|
635
|
+
|
|
636
|
+
|
|
637
|
+
|
|
638
|
+
|
|
639
|
+
|
|
640
|
+
|
|
641
|
+
var PositionDiv = external_styled_components_default.a.div.withConfig({
|
|
642
|
+
displayName: "RadialLayout__PositionDiv",
|
|
643
|
+
componentId: "sc-1vd28ez-0"
|
|
644
|
+
})(["position:absolute;", ";bottom:", "px;left:0;width:100%;height:100%;display:flex;align-items:", ";justify-content:center;"], function (props) {
|
|
645
|
+
return props.bottom ? '' : 'top: 0';
|
|
646
|
+
}, function (props) {
|
|
647
|
+
return props.bottom || 0;
|
|
648
|
+
}, function (props) {
|
|
649
|
+
return props.align || 'center';
|
|
650
|
+
});
|
|
651
|
+
var Column = external_styled_components_default.a.div.withConfig({
|
|
652
|
+
displayName: "RadialLayout__Column",
|
|
653
|
+
componentId: "sc-1vd28ez-1"
|
|
654
|
+
})(["display:flex;flex-direction:column;align-items:", ";justify-content:", ";"], function (props) {
|
|
655
|
+
return props.align || 'center';
|
|
656
|
+
}, function (props) {
|
|
657
|
+
return props.align || 'center';
|
|
658
|
+
});
|
|
659
|
+
var Row = external_styled_components_default.a.div.withConfig({
|
|
660
|
+
displayName: "RadialLayout__Row",
|
|
661
|
+
componentId: "sc-1vd28ez-2"
|
|
662
|
+
})(["display:flex;flex-direction:row;align-items:center;justify-content:center;"]);
|
|
663
|
+
var Square = external_styled_components_default.a.div.withConfig({
|
|
664
|
+
displayName: "RadialLayout__Square",
|
|
665
|
+
componentId: "sc-1vd28ez-3"
|
|
666
|
+
})(["position:relative;margin:0 auto;width:", "px;height:", "px;"], function (props) {
|
|
667
|
+
return props.size;
|
|
668
|
+
}, function (props) {
|
|
669
|
+
return props.size;
|
|
670
|
+
});
|
|
671
|
+
var UnderLabelContainer = external_styled_components_default.a.div.withConfig({
|
|
672
|
+
displayName: "RadialLayout__UnderLabelContainer",
|
|
673
|
+
componentId: "sc-1vd28ez-4"
|
|
674
|
+
})(["color:", ";margin-top:", ";font-size:", "px;"], function (props) {
|
|
675
|
+
return props.color;
|
|
676
|
+
}, function (props) {
|
|
677
|
+
return props.size && "-".concat(props.size * 0.1, "px") || 0;
|
|
678
|
+
}, function (props) {
|
|
679
|
+
return props.size || 12;
|
|
680
|
+
});
|
|
681
|
+
/**
|
|
682
|
+
* Render the trend indicator
|
|
683
|
+
* @method renderTrendValue
|
|
684
|
+
* @returns {Object}
|
|
685
|
+
* @private
|
|
686
|
+
*/
|
|
687
|
+
|
|
688
|
+
var RadialLayout_renderIsolateTrend = function renderIsolateTrend(_ref) {
|
|
689
|
+
var trendText = _ref.trendText,
|
|
690
|
+
trendColor = _ref.trendColor,
|
|
691
|
+
contentSize = _ref.contentSize;
|
|
692
|
+
var trendTextFontSize = Object(singleValueUtils_["getTrendFontSize"])({
|
|
693
|
+
width: contentSize / 2,
|
|
694
|
+
height: contentSize / 4,
|
|
695
|
+
trendText: trendText,
|
|
696
|
+
spaceRatio: 1
|
|
697
|
+
});
|
|
698
|
+
return /*#__PURE__*/external_react_default.a.createElement(SingleValueBasic_["SingleValueTrendValue"], {
|
|
699
|
+
fontSize: trendTextFontSize,
|
|
700
|
+
color: trendColor,
|
|
701
|
+
value: trendText,
|
|
702
|
+
text: trendText
|
|
703
|
+
});
|
|
704
|
+
};
|
|
705
|
+
|
|
706
|
+
RadialLayout_renderIsolateTrend.propTypes = {
|
|
707
|
+
trendText: external_prop_types_default.a.string,
|
|
708
|
+
trendColor: external_prop_types_default.a.string,
|
|
709
|
+
contentSize: external_prop_types_default.a.number
|
|
710
|
+
};
|
|
711
|
+
|
|
712
|
+
var RadialLayout_RadialContent = function RadialContent(_ref2) {
|
|
713
|
+
var props = extends_default()({}, _ref2);
|
|
714
|
+
|
|
715
|
+
var majorColor = props.majorColor,
|
|
716
|
+
majorText = props.majorText,
|
|
717
|
+
majorTextFontSize = props.majorTextFontSize,
|
|
718
|
+
majorValueTitle = props.majorValueTitle,
|
|
719
|
+
trendColor = props.trendColor,
|
|
720
|
+
trendText = props.trendText,
|
|
721
|
+
trendTextFontSize = props.trendTextFontSize,
|
|
722
|
+
showTrendIndicator = props.showTrendIndicator,
|
|
723
|
+
trendPosition = props.trendPosition,
|
|
724
|
+
unit = props.unit,
|
|
725
|
+
unitPosition = props.unitPosition,
|
|
726
|
+
underLabelColor = props.underLabelColor,
|
|
727
|
+
underLabelFontSize = props.underLabelFontSize,
|
|
728
|
+
underLabel = props.underLabel,
|
|
729
|
+
onValueClick = props.onValueClick,
|
|
730
|
+
contentSize = props.contentSize,
|
|
731
|
+
showRadialGraph = props.showRadialGraph,
|
|
732
|
+
graphSize = props.graphSize,
|
|
733
|
+
progress = props.progress,
|
|
734
|
+
radialBackgroundColor = props.radialBackgroundColor,
|
|
735
|
+
radialStrokeColor = props.radialStrokeColor,
|
|
736
|
+
radialStrokeWidth = props.radialStrokeWidth; // for trend position below and outside
|
|
737
|
+
|
|
738
|
+
var trendComponent = RadialLayout_renderIsolateTrend({
|
|
739
|
+
trendText: trendText,
|
|
740
|
+
trendColor: trendColor,
|
|
741
|
+
contentSize: contentSize
|
|
742
|
+
});
|
|
743
|
+
var basicSingleValues = /*#__PURE__*/external_react_default.a.createElement(SingleValueBasic_default.a, {
|
|
744
|
+
majorColor: majorColor,
|
|
745
|
+
majorText: majorText,
|
|
746
|
+
majorTextFontSize: majorTextFontSize,
|
|
747
|
+
majorValueTitle: majorValueTitle,
|
|
748
|
+
trendColor: trendColor,
|
|
749
|
+
trendText: trendText,
|
|
750
|
+
trendTextFontSize: trendTextFontSize,
|
|
751
|
+
showTrendIndicator: showTrendPositionStandard({
|
|
752
|
+
showTrendIndicator: showTrendIndicator,
|
|
753
|
+
position: trendPosition
|
|
754
|
+
}),
|
|
755
|
+
unit: unit,
|
|
756
|
+
unitPosition: unitPosition,
|
|
757
|
+
onValueClick: onValueClick
|
|
758
|
+
});
|
|
759
|
+
var radialGraph = showRadialGraph ? /*#__PURE__*/external_react_default.a.createElement(components_RadialGraph, {
|
|
760
|
+
size: graphSize,
|
|
761
|
+
progress: progress,
|
|
762
|
+
backgroundColor: radialBackgroundColor,
|
|
763
|
+
progressColor: radialStrokeColor,
|
|
764
|
+
strokeWidth: radialStrokeWidth
|
|
765
|
+
}) : null;
|
|
766
|
+
var underLabelComponent = underLabel ? /*#__PURE__*/external_react_default.a.createElement(UnderLabelContainer, {
|
|
767
|
+
"data-test": "underLabel",
|
|
768
|
+
color: underLabelColor,
|
|
769
|
+
size: underLabelFontSize
|
|
770
|
+
}, underLabel) : null;
|
|
771
|
+
var outsideComponent = showTrendPositionOutside({
|
|
772
|
+
showTrendIndicator: showTrendIndicator,
|
|
773
|
+
position: trendPosition
|
|
774
|
+
}) ? /*#__PURE__*/external_react_default.a.createElement(Column, {
|
|
775
|
+
align: "end",
|
|
776
|
+
"data-test": "trend-position-outside"
|
|
777
|
+
}, trendComponent, underLabelComponent) : null;
|
|
778
|
+
var belowTrendComponent = showTrendPositionBelow({
|
|
779
|
+
showTrendIndicator: showTrendIndicator,
|
|
780
|
+
position: trendPosition
|
|
781
|
+
}) ? /*#__PURE__*/external_react_default.a.createElement(PositionDiv, {
|
|
782
|
+
"data-test": "trend-position-below",
|
|
783
|
+
align: "flex-end",
|
|
784
|
+
bottom: graphSize * 0.1,
|
|
785
|
+
style: {
|
|
786
|
+
textAlign: 'center'
|
|
787
|
+
}
|
|
788
|
+
}, trendComponent) : null;
|
|
789
|
+
return /*#__PURE__*/external_react_default.a.createElement(Row, null, /*#__PURE__*/external_react_default.a.createElement(Column, null, /*#__PURE__*/external_react_default.a.createElement(Square, {
|
|
790
|
+
size: graphSize
|
|
791
|
+
}, radialGraph, belowTrendComponent, /*#__PURE__*/external_react_default.a.createElement(PositionDiv, null, basicSingleValues)), trendPosition !== 'outside' && underLabelComponent), outsideComponent);
|
|
792
|
+
};
|
|
793
|
+
|
|
794
|
+
RadialLayout_RadialContent.propTypes = _objectSpread(_objectSpread({}, SingleValueBasic_default.a.propTypes), {}, {
|
|
795
|
+
trendPosition: external_prop_types_default.a.string,
|
|
796
|
+
contentSize: external_prop_types_default.a.number,
|
|
797
|
+
showRadialGraph: external_prop_types_default.a.bool,
|
|
798
|
+
graphSize: external_prop_types_default.a.number,
|
|
799
|
+
progress: external_prop_types_default.a.number,
|
|
800
|
+
radialBackgroundColor: external_prop_types_default.a.string,
|
|
801
|
+
radialStrokeColor: external_prop_types_default.a.string,
|
|
802
|
+
radialStrokeWidth: external_prop_types_default.a.number
|
|
803
|
+
});
|
|
804
|
+
/* harmony default export */ var RadialLayout = (RadialLayout_RadialContent);
|
|
805
|
+
// CONCATENATED MODULE: ./src/visualizations/SingleValueRadial/src/components/SingleValueRadial.jsx
|
|
806
|
+
// this is a copy of SingleValueRadial.jsx @ 23.5.0 before the design changes to PureSingleValueRadial were rolled out
|
|
807
|
+
|
|
808
|
+
|
|
809
|
+
|
|
810
|
+
|
|
811
|
+
|
|
812
|
+
|
|
813
|
+
|
|
814
|
+
|
|
815
|
+
|
|
816
|
+
|
|
817
|
+
|
|
818
|
+
|
|
819
|
+
|
|
820
|
+
|
|
821
|
+
|
|
822
|
+
var Container = external_styled_components_default.a.div.withConfig({
|
|
823
|
+
displayName: "SingleValueRadial__Container",
|
|
824
|
+
componentId: "sc-172kh88-0"
|
|
825
|
+
})(["overflow:hidden;", ";"], function (props) {
|
|
826
|
+
return Object(style_["toDimension"])(external_lodash_pick_default()(props, ['width', 'height']));
|
|
827
|
+
});
|
|
828
|
+
var VizStyleWrapper = external_styled_components_default.a.div.attrs(function (_ref) {
|
|
829
|
+
var dataTestKey = _ref.dataTestKey;
|
|
830
|
+
return {
|
|
831
|
+
'data-test': dataTestKey
|
|
832
|
+
};
|
|
833
|
+
}).withConfig({
|
|
834
|
+
displayName: "SingleValueRadial__VizStyleWrapper",
|
|
835
|
+
componentId: "sc-172kh88-1"
|
|
836
|
+
})(["display:flex;justify-content:center;flex-direction:column;width:100%;height:100%;background-color:", ";"], function (props) {
|
|
837
|
+
return props.backgroundColor;
|
|
838
|
+
});
|
|
839
|
+
VizStyleWrapper.displayName = 'VizStyleWrapper';
|
|
840
|
+
|
|
841
|
+
var SingleValueRadial_SingleValueRadial = function SingleValueRadial(_ref2) {
|
|
842
|
+
var props = extends_default()({}, _ref2);
|
|
843
|
+
|
|
844
|
+
var width = props.width,
|
|
845
|
+
_props$height = props.height,
|
|
846
|
+
height = _props$height === void 0 ? 250 : _props$height,
|
|
847
|
+
style = props.style,
|
|
848
|
+
majorFontSize = props.majorFontSize,
|
|
849
|
+
majorValue = props.majorValue,
|
|
850
|
+
majorValueField = props.majorValueField,
|
|
851
|
+
trendValue = props.trendValue,
|
|
852
|
+
trendFontSize = props.trendFontSize,
|
|
853
|
+
unitPosition = props.unitPosition,
|
|
854
|
+
numberPrecision = props.numberPrecision,
|
|
855
|
+
shouldUseThousandSeparators = props.shouldUseThousandSeparators,
|
|
856
|
+
shouldAbbreviateTrendValue = props.shouldAbbreviateTrendValue,
|
|
857
|
+
_props$trendIndicator = props.trendIndicatorPosition,
|
|
858
|
+
trendIndicatorPosition = _props$trendIndicator === void 0 ? 'standard' : _props$trendIndicator,
|
|
859
|
+
onValueClick = props.onValueClick; // calculate colors
|
|
860
|
+
|
|
861
|
+
var defaultColors = {
|
|
862
|
+
defaultFontColor: pick_default()({
|
|
863
|
+
enterprise: {
|
|
864
|
+
dark: variables_default.a.textColor(props),
|
|
865
|
+
light: variables_default.a.gray20(props)
|
|
866
|
+
},
|
|
867
|
+
prisma: variables_default.a.contentColorActive(props)
|
|
868
|
+
})(props),
|
|
869
|
+
defaultBlockFontColor: pick_default()({
|
|
870
|
+
enterprise: variables_default.a.white(props),
|
|
871
|
+
prisma: variables_default.a.contentColorActive(props)
|
|
872
|
+
})(props)
|
|
873
|
+
};
|
|
874
|
+
|
|
875
|
+
var _computeColors = Object(singleValueUtils_["computeColors"])(props, defaultColors),
|
|
876
|
+
backgroundEnabled = _computeColors.backgroundEnabled,
|
|
877
|
+
backgroundColor = _computeColors.backgroundColor,
|
|
878
|
+
majorColor = _computeColors.majorColor,
|
|
879
|
+
trendColor = _computeColors.trendColor,
|
|
880
|
+
underLabelColor = _computeColors.underLabelColor;
|
|
881
|
+
|
|
882
|
+
var radialColors = displayUtils_getRadialColors({
|
|
883
|
+
backgroundEnabled: backgroundEnabled,
|
|
884
|
+
backgroundColor: backgroundColor
|
|
885
|
+
});
|
|
886
|
+
var radialBackgroundColor = props.radialBackgroundColor || radialColors.background;
|
|
887
|
+
var radialStrokeColor = props.radialStrokeColor || radialColors.stroke;
|
|
888
|
+
var handleValueClick = Object(external_react_["useCallback"])(function (ev) {
|
|
889
|
+
return Object(singleValueUtils_["handleValueClickCallback"])(ev, majorValue, majorValueField, trendValue, onValueClick);
|
|
890
|
+
}, [onValueClick, majorValue, majorValueField, trendValue]);
|
|
891
|
+
|
|
892
|
+
var renderVisualization = function renderVisualization(_ref3) {
|
|
893
|
+
var containerWidth = _ref3.width,
|
|
894
|
+
containerHeight = _ref3.height;
|
|
895
|
+
|
|
896
|
+
if (containerWidth < 35 || containerHeight < 35) {
|
|
897
|
+
return /*#__PURE__*/external_react_default.a.createElement(Message_default.a, {
|
|
898
|
+
width: containerWidth,
|
|
899
|
+
height: containerHeight,
|
|
900
|
+
message: Object(i18n_["_"])('Too small to render content'),
|
|
901
|
+
level: "info"
|
|
902
|
+
});
|
|
903
|
+
} // will update later based on text size
|
|
904
|
+
|
|
905
|
+
|
|
906
|
+
var trendDisplay = props.trendDisplay,
|
|
907
|
+
unit = props.unit,
|
|
908
|
+
underLabel = props.underLabel;
|
|
909
|
+
var showRadialGraph = true; // calculate radial graph, major and trend content, and underlabel size
|
|
910
|
+
|
|
911
|
+
var graphSize = displayUtils_getGraphSize({
|
|
912
|
+
width: containerWidth,
|
|
913
|
+
height: containerHeight,
|
|
914
|
+
underLabel: underLabel
|
|
915
|
+
});
|
|
916
|
+
var radialStrokeWidth = getRadialStrokeWidth(graphSize);
|
|
917
|
+
var valueContentSize = getValueContentSize({
|
|
918
|
+
graphSize: graphSize,
|
|
919
|
+
radialStrokeWidth: radialStrokeWidth
|
|
920
|
+
});
|
|
921
|
+
var underLabelFontSize = Object(singleValueUtils_["getUnderLabelHeight"])(graphSize * 0.1); // calculate major and trend text
|
|
922
|
+
|
|
923
|
+
var toRemoveList = [{
|
|
924
|
+
key: 'underLabel',
|
|
925
|
+
value: ''
|
|
926
|
+
}, {
|
|
927
|
+
key: 'showRadialGraph',
|
|
928
|
+
value: false
|
|
929
|
+
}, {
|
|
930
|
+
key: 'trendDisplay',
|
|
931
|
+
value: 'off'
|
|
932
|
+
}, {
|
|
933
|
+
key: 'unit',
|
|
934
|
+
value: ''
|
|
935
|
+
}];
|
|
936
|
+
|
|
937
|
+
var _computeSingleValueCo = Object(singleValueUtils_["computeSingleValueContent"])({
|
|
938
|
+
majorValue: majorValue,
|
|
939
|
+
trendValue: trendValue,
|
|
940
|
+
majorFontSize: majorFontSize,
|
|
941
|
+
trendFontSize: trendFontSize,
|
|
942
|
+
trendDisplay: trendDisplay,
|
|
943
|
+
contentWidth: valueContentSize,
|
|
944
|
+
contentHeight: valueContentSize,
|
|
945
|
+
containerWidth: containerWidth,
|
|
946
|
+
containerHeight: containerHeight,
|
|
947
|
+
unit: unit,
|
|
948
|
+
numberPrecision: numberPrecision,
|
|
949
|
+
shouldUseThousandSeparators: shouldUseThousandSeparators,
|
|
950
|
+
shouldAbbreviateTrendValue: shouldAbbreviateTrendValue,
|
|
951
|
+
toRemoveList: toRemoveList
|
|
952
|
+
}),
|
|
953
|
+
majorText = _computeSingleValueCo.majorText,
|
|
954
|
+
trendText = _computeSingleValueCo.trendText,
|
|
955
|
+
majorTextFontSize = _computeSingleValueCo.majorTextFontSize,
|
|
956
|
+
trendTextFontSize = _computeSingleValueCo.trendTextFontSize,
|
|
957
|
+
majorValueTitle = _computeSingleValueCo.majorValueTitle,
|
|
958
|
+
smallVizProps = _computeSingleValueCo.smallVizProps;
|
|
959
|
+
|
|
960
|
+
if (!isEmpty_default()(smallVizProps)) {
|
|
961
|
+
underLabel = smallVizProps.underLabel;
|
|
962
|
+
showRadialGraph = smallVizProps.showRadialGraph;
|
|
963
|
+
trendDisplay = smallVizProps.trendDisplay;
|
|
964
|
+
unit = smallVizProps.unit;
|
|
965
|
+
} // calculate trend position
|
|
966
|
+
|
|
967
|
+
|
|
968
|
+
var position = computeTrendIndicatorPosition({
|
|
969
|
+
trendIndicatorPosition: trendIndicatorPosition,
|
|
970
|
+
majorTextFontSize: majorTextFontSize,
|
|
971
|
+
trendTextFontSize: trendTextFontSize
|
|
972
|
+
}); // calculate radial
|
|
973
|
+
|
|
974
|
+
var progress = getRadialProgress(majorValue);
|
|
975
|
+
return /*#__PURE__*/external_react_default.a.createElement(VizStyleWrapper, {
|
|
976
|
+
backgroundColor: backgroundColor,
|
|
977
|
+
style: style,
|
|
978
|
+
dataTestKey: "SingleValueRadialWrapper"
|
|
979
|
+
}, /*#__PURE__*/external_react_default.a.createElement(RadialLayout, {
|
|
980
|
+
"data-test": "RadialLayout",
|
|
981
|
+
majorColor: majorColor,
|
|
982
|
+
majorText: majorText,
|
|
983
|
+
majorTextFontSize: majorTextFontSize,
|
|
984
|
+
majorValueTitle: majorValueTitle,
|
|
985
|
+
trendColor: trendColor,
|
|
986
|
+
trendText: trendText,
|
|
987
|
+
trendTextFontSize: trendTextFontSize,
|
|
988
|
+
showTrendIndicator: Object(singleValueUtils_["shouldShowTrend"])(trendDisplay),
|
|
989
|
+
trendPosition: position,
|
|
990
|
+
unit: unit,
|
|
991
|
+
unitPosition: unitPosition,
|
|
992
|
+
underLabelColor: underLabelColor,
|
|
993
|
+
underLabelFontSize: underLabelFontSize,
|
|
994
|
+
underLabel: underLabel,
|
|
995
|
+
onValueClick: handleValueClick,
|
|
996
|
+
contentSize: valueContentSize * 0.7,
|
|
997
|
+
showRadialGraph: showRadialGraph,
|
|
998
|
+
graphSize: graphSize,
|
|
999
|
+
progress: progress,
|
|
1000
|
+
radialBackgroundColor: radialBackgroundColor,
|
|
1001
|
+
radialStrokeColor: radialStrokeColor,
|
|
1002
|
+
radialStrokeWidth: radialStrokeWidth
|
|
1003
|
+
}));
|
|
1004
|
+
};
|
|
1005
|
+
|
|
1006
|
+
return /*#__PURE__*/external_react_default.a.createElement(Container, {
|
|
1007
|
+
width: width,
|
|
1008
|
+
height: height
|
|
1009
|
+
}, /*#__PURE__*/external_react_default.a.createElement(SizeAwareWrapper_default.a, null, function (containerDimension) {
|
|
1010
|
+
return renderVisualization(containerDimension);
|
|
1011
|
+
}));
|
|
1012
|
+
};
|
|
1013
|
+
|
|
1014
|
+
SingleValueRadial_SingleValueRadial.propTypes = {
|
|
1015
|
+
width: external_prop_types_default.a.oneOfType([external_prop_types_default.a.string, external_prop_types_default.a.number]),
|
|
1016
|
+
height: external_prop_types_default.a.oneOfType([external_prop_types_default.a.string, external_prop_types_default.a.number]),
|
|
1017
|
+
style: external_prop_types_default.a.object,
|
|
1018
|
+
majorValue: external_prop_types_default.a.oneOfType([external_prop_types_default.a.string, external_prop_types_default.a.number]),
|
|
1019
|
+
majorValueField: external_prop_types_default.a.string,
|
|
1020
|
+
majorColor: external_prop_types_default.a.string,
|
|
1021
|
+
majorFontSize: external_prop_types_default.a.number,
|
|
1022
|
+
trendValue: external_prop_types_default.a.oneOfType([external_prop_types_default.a.string, external_prop_types_default.a.number]),
|
|
1023
|
+
trendColor: external_prop_types_default.a.string,
|
|
1024
|
+
trendFontSize: external_prop_types_default.a.number,
|
|
1025
|
+
trendDisplay: external_prop_types_default.a.string,
|
|
1026
|
+
trendIndicatorPosition: external_prop_types_default.a.oneOf(['standard', 'below', 'outside']),
|
|
1027
|
+
shouldAbbreviateTrendValue: external_prop_types_default.a.bool,
|
|
1028
|
+
backgroundColor: external_prop_types_default.a.string,
|
|
1029
|
+
unit: external_prop_types_default.a.string,
|
|
1030
|
+
unitPosition: external_prop_types_default.a.string,
|
|
1031
|
+
underLabel: external_prop_types_default.a.string,
|
|
1032
|
+
numberPrecision: external_prop_types_default.a.number,
|
|
1033
|
+
shouldUseThousandSeparators: external_prop_types_default.a.bool,
|
|
1034
|
+
radialBackgroundColor: external_prop_types_default.a.string,
|
|
1035
|
+
radialStrokeColor: external_prop_types_default.a.string,
|
|
1036
|
+
onValueClick: external_prop_types_default.a.func
|
|
1037
|
+
};
|
|
1038
|
+
SingleValueRadial_SingleValueRadial.defaultProps = {
|
|
1039
|
+
width: '100%',
|
|
1040
|
+
height: 250,
|
|
1041
|
+
majorValue: 'N/A',
|
|
1042
|
+
majorValueField: '',
|
|
1043
|
+
trendDisplay: 'absolute',
|
|
1044
|
+
trendIndicatorPosition: 'standard',
|
|
1045
|
+
shouldAbbreviateTrendValue: false,
|
|
1046
|
+
unitPosition: 'after',
|
|
1047
|
+
numberPrecision: 0,
|
|
1048
|
+
shouldUseThousandSeparators: true,
|
|
1049
|
+
onValueClick: function onValueClick() {}
|
|
1050
|
+
};
|
|
1051
|
+
/* harmony default export */ var components_SingleValueRadial = (Object(external_styled_components_["withTheme"])(SingleValueRadial_SingleValueRadial));
|
|
1052
|
+
// EXTERNAL MODULE: ./src/utils/propUtils.js
|
|
1053
|
+
var propUtils = __webpack_require__(20);
|
|
1054
|
+
|
|
1055
|
+
// CONCATENATED MODULE: ./src/visualizations/SingleValueRadial/SingleValueRadial.jsx
|
|
1056
|
+
|
|
1057
|
+
|
|
1058
|
+
|
|
1059
|
+
function SingleValueRadial_ownKeys(object, enumerableOnly) {
|
|
1060
|
+
var keys = Object.keys(object);
|
|
1061
|
+
|
|
1062
|
+
if (Object.getOwnPropertySymbols) {
|
|
1063
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
1064
|
+
if (enumerableOnly) symbols = symbols.filter(function (sym) {
|
|
1065
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
1066
|
+
});
|
|
1067
|
+
keys.push.apply(keys, symbols);
|
|
1068
|
+
}
|
|
1069
|
+
|
|
1070
|
+
return keys;
|
|
1071
|
+
}
|
|
1072
|
+
|
|
1073
|
+
function SingleValueRadial_objectSpread(target) {
|
|
1074
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
1075
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
1076
|
+
|
|
1077
|
+
if (i % 2) {
|
|
1078
|
+
SingleValueRadial_ownKeys(Object(source), true).forEach(function (key) {
|
|
1079
|
+
defineProperty_default()(target, key, source[key]);
|
|
1080
|
+
});
|
|
1081
|
+
} else if (Object.getOwnPropertyDescriptors) {
|
|
1082
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
1083
|
+
} else {
|
|
1084
|
+
SingleValueRadial_ownKeys(Object(source)).forEach(function (key) {
|
|
1085
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
1086
|
+
});
|
|
1087
|
+
}
|
|
1088
|
+
}
|
|
1089
|
+
|
|
226
1090
|
return target;
|
|
227
1091
|
}
|
|
228
1092
|
|
|
@@ -242,43 +1106,43 @@ var propsMapping = {
|
|
|
242
1106
|
};
|
|
243
1107
|
var deprecatedProps = ['showTrendIndicator', 'trendDisplayMode'];
|
|
244
1108
|
|
|
245
|
-
var
|
|
246
|
-
var props =
|
|
1109
|
+
var SingleValueRadial_ReactSingleValueRadial = function ReactSingleValueRadial(_ref) {
|
|
1110
|
+
var props = extends_default()({}, _ref);
|
|
247
1111
|
|
|
248
|
-
var newProps = Object(
|
|
1112
|
+
var newProps = Object(propUtils["a" /* propsConvert */])(props, propsMapping); // change props
|
|
249
1113
|
|
|
250
1114
|
var trendDisplay = newProps.showTrendIndicator ? newProps.trendDisplayMode : 'off';
|
|
251
|
-
newProps =
|
|
1115
|
+
newProps = SingleValueRadial_objectSpread(SingleValueRadial_objectSpread({}, Object(propUtils["b" /* propsDeprecate */])(newProps, deprecatedProps)), {}, {
|
|
252
1116
|
trendDisplay: trendDisplay
|
|
253
1117
|
});
|
|
254
|
-
return /*#__PURE__*/
|
|
1118
|
+
return /*#__PURE__*/external_react_default.a.createElement(components_SingleValueRadial, newProps);
|
|
255
1119
|
};
|
|
256
1120
|
|
|
257
|
-
|
|
258
|
-
width:
|
|
259
|
-
height:
|
|
260
|
-
style:
|
|
261
|
-
value:
|
|
262
|
-
majorColor:
|
|
263
|
-
majorFontSize:
|
|
264
|
-
deltaValue:
|
|
265
|
-
deltaColor:
|
|
266
|
-
deltaFontSize:
|
|
267
|
-
trendDisplayMode:
|
|
268
|
-
trendIndicatorPosition:
|
|
269
|
-
useTrendUnits:
|
|
270
|
-
showTrendIndicator:
|
|
271
|
-
backgroundColor:
|
|
272
|
-
unit:
|
|
273
|
-
unitPosition:
|
|
274
|
-
underLabel:
|
|
275
|
-
numberPrecision:
|
|
276
|
-
useThousandSeparators:
|
|
277
|
-
radialBackgroundColor:
|
|
278
|
-
radialStrokeColor:
|
|
279
|
-
onValueClick:
|
|
1121
|
+
SingleValueRadial_ReactSingleValueRadial.propTypes = {
|
|
1122
|
+
width: external_prop_types_default.a.oneOfType([external_prop_types_default.a.string, external_prop_types_default.a.number]),
|
|
1123
|
+
height: external_prop_types_default.a.oneOfType([external_prop_types_default.a.string, external_prop_types_default.a.number]),
|
|
1124
|
+
style: external_prop_types_default.a.object,
|
|
1125
|
+
value: external_prop_types_default.a.oneOfType([external_prop_types_default.a.string, external_prop_types_default.a.number]),
|
|
1126
|
+
majorColor: external_prop_types_default.a.string,
|
|
1127
|
+
majorFontSize: external_prop_types_default.a.number,
|
|
1128
|
+
deltaValue: external_prop_types_default.a.oneOfType([external_prop_types_default.a.string, external_prop_types_default.a.number]),
|
|
1129
|
+
deltaColor: external_prop_types_default.a.string,
|
|
1130
|
+
deltaFontSize: external_prop_types_default.a.number,
|
|
1131
|
+
trendDisplayMode: external_prop_types_default.a.string,
|
|
1132
|
+
trendIndicatorPosition: external_prop_types_default.a.oneOf(['standard', 'below', 'outside']),
|
|
1133
|
+
useTrendUnits: external_prop_types_default.a.bool,
|
|
1134
|
+
showTrendIndicator: external_prop_types_default.a.bool,
|
|
1135
|
+
backgroundColor: external_prop_types_default.a.string,
|
|
1136
|
+
unit: external_prop_types_default.a.string,
|
|
1137
|
+
unitPosition: external_prop_types_default.a.string,
|
|
1138
|
+
underLabel: external_prop_types_default.a.string,
|
|
1139
|
+
numberPrecision: external_prop_types_default.a.number,
|
|
1140
|
+
useThousandSeparators: external_prop_types_default.a.bool,
|
|
1141
|
+
radialBackgroundColor: external_prop_types_default.a.string,
|
|
1142
|
+
radialStrokeColor: external_prop_types_default.a.string,
|
|
1143
|
+
onValueClick: external_prop_types_default.a.func
|
|
280
1144
|
};
|
|
281
|
-
|
|
1145
|
+
SingleValueRadial_ReactSingleValueRadial.defaultProps = {
|
|
282
1146
|
width: '100%',
|
|
283
1147
|
height: 250,
|
|
284
1148
|
trendDisplayMode: 'absolute',
|
|
@@ -290,16 +1154,8 @@ ReactSingleValueRadial.defaultProps = {
|
|
|
290
1154
|
useThousandSeparators: true,
|
|
291
1155
|
onValueClick: function onValueClick() {}
|
|
292
1156
|
};
|
|
293
|
-
/* harmony default export */ __webpack_exports__["default"] = (Object(
|
|
294
|
-
|
|
295
|
-
/***/ }),
|
|
296
|
-
|
|
297
|
-
/***/ 7:
|
|
298
|
-
/***/ (function(module, exports) {
|
|
299
|
-
|
|
300
|
-
module.exports = require("lodash/omit");
|
|
1157
|
+
/* harmony default export */ var visualizations_SingleValueRadial_SingleValueRadial = __webpack_exports__["default"] = (Object(SanitizeProps_["withSanitizedProps"])(SingleValueRadial_ReactSingleValueRadial));
|
|
301
1158
|
|
|
302
1159
|
/***/ })
|
|
303
|
-
|
|
304
|
-
/******/ });
|
|
1160
|
+
/******/ ]);
|
|
305
1161
|
//# sourceMappingURL=SingleValueRadial.js.map
|