@splunk/react-visualizations 25.7.2 → 25.8.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/Area.js +30 -56
- package/Area.js.map +1 -1
- package/Bar.js +26 -52
- package/Bar.js.map +1 -1
- package/Bubble.js +28 -54
- package/Bubble.js.map +1 -1
- package/Column.js +35 -62
- package/Column.js.map +1 -1
- package/FillerGauge.js +0 -2
- package/FillerGauge.js.map +1 -1
- package/GeoJsonChoropleth.js +89 -451
- package/GeoJsonChoropleth.js.map +1 -1
- package/Line.js +30 -56
- package/Line.js.map +1 -1
- package/MarkerGauge.js +0 -2
- package/MarkerGauge.js.map +1 -1
- package/Pie.js +23 -43
- package/Pie.js.map +1 -1
- package/Punchcard.js +3 -6
- package/Punchcard.js.map +1 -1
- package/Scatter.js +26 -52
- package/Scatter.js.map +1 -1
- package/SingleValue.js +13 -29
- package/SingleValue.js.map +1 -1
- package/SingleValueIcon.js +13 -30
- package/SingleValueIcon.js.map +1 -1
- package/SingleValueRadial.js +134 -182
- package/SingleValueRadial.js.map +1 -1
- package/SvgChoropleth.js +21 -69
- package/SvgChoropleth.js.map +1 -1
- package/SvgChoroplethDynamic.js +2 -11
- package/SvgChoroplethDynamic.js.map +1 -1
- package/common/Charting.js +36 -118
- package/common/Charting.js.map +1 -1
- package/common/ChartingApi.js +5 -15
- package/common/ChartingApi.js.map +1 -1
- package/common/EventsDoc.js +20 -61
- package/common/EventsDoc.js.map +1 -1
- package/common/OptionsDoc.js +5 -11
- package/common/OptionsDoc.js.map +1 -1
- package/common/props.js +0 -3
- package/common/props.js.map +1 -1
- package/package.json +9 -9
- package/utils/numberUtils.js +4 -4
- package/utils/numberUtils.js.map +1 -1
- package/utils/propUtils.js +2 -2
- package/utils/propUtils.js.map +1 -1
- package/utils/seriesUtils.js +0 -1
- package/utils/seriesUtils.js.map +1 -1
package/SingleValueRadial.js
CHANGED
|
@@ -165,13 +165,13 @@ module.exports = require("@splunk/visualizations/common/utils/singleValueUtils")
|
|
|
165
165
|
/* harmony import */ var lodash_omit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8);
|
|
166
166
|
/* harmony import */ var lodash_omit__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_omit__WEBPACK_IMPORTED_MODULE_0__);
|
|
167
167
|
|
|
168
|
+
|
|
168
169
|
/**
|
|
169
170
|
* convert the old props to new props for pure visualization based on propsMapping
|
|
170
171
|
* @param {Object} oldProps props used by react visualizations
|
|
171
172
|
* @param {Object} propsMapping
|
|
172
173
|
* @return {Object} newprops props used by pure visualizations
|
|
173
174
|
*/
|
|
174
|
-
|
|
175
175
|
var propsConvert = function propsConvert(oldProps, propsMapping) {
|
|
176
176
|
var newProps = {};
|
|
177
177
|
Object.keys(oldProps).forEach(function (propKey) {
|
|
@@ -180,13 +180,13 @@ var propsConvert = function propsConvert(oldProps, propsMapping) {
|
|
|
180
180
|
});
|
|
181
181
|
return newProps;
|
|
182
182
|
};
|
|
183
|
+
|
|
183
184
|
/**
|
|
184
185
|
* omit the deprecated props for pure visualization
|
|
185
186
|
* @param {Object} props props used by react visualizations
|
|
186
187
|
* @param {Array} deprecatedProps
|
|
187
188
|
* @return {Object} newprops props used by pure visualizations
|
|
188
189
|
*/
|
|
189
|
-
|
|
190
190
|
var propsDeprecate = function propsDeprecate(props, deprecatedProps) {
|
|
191
191
|
return lodash_omit__WEBPACK_IMPORTED_MODULE_0___default()(props, deprecatedProps);
|
|
192
192
|
};
|
|
@@ -362,27 +362,27 @@ var colorConstants_ = __webpack_require__(30);
|
|
|
362
362
|
|
|
363
363
|
|
|
364
364
|
|
|
365
|
-
|
|
366
365
|
var RadialGraph_RadialGraph = function RadialGraph(_ref) {
|
|
367
366
|
var progress = _ref.progress,
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
367
|
+
_ref$size = _ref.size,
|
|
368
|
+
size = _ref$size === void 0 ? 200 : _ref$size,
|
|
369
|
+
strokeWidth = _ref.strokeWidth,
|
|
370
|
+
_ref$backgroundColor = _ref.backgroundColor,
|
|
371
|
+
backgroundColor = _ref$backgroundColor === void 0 ? colorConstants_["RADIAL_BACKGROUND_COLOR"] : _ref$backgroundColor,
|
|
372
|
+
_ref$progressColor = _ref.progressColor,
|
|
373
|
+
progressColor = _ref$progressColor === void 0 ? colorConstants_["RADIAL_STROKE_COLOR"] : _ref$progressColor;
|
|
375
374
|
var normalizedSize = size / 2;
|
|
376
375
|
var normalizedRadius = normalizedSize - strokeWidth * 2;
|
|
377
376
|
var circumference = normalizedRadius * 2 * Math.PI;
|
|
378
377
|
var bgCircleOffset = 0.8 * circumference;
|
|
379
378
|
var progress80 = progress / 100 * 80;
|
|
380
|
-
var progressWidth = progress80 / 100 * circumference;
|
|
379
|
+
var progressWidth = progress80 / 100 * circumference;
|
|
380
|
+
|
|
381
|
+
// Offset the start of the circle to a position that makes the arc look evenly spaced
|
|
381
382
|
// with the opening at the bottom
|
|
382
383
|
// We use 80% of a circle (288deg), half on each side of "0" (144deg)
|
|
383
384
|
// SVG starts drawing (0deg) at the 3 o'clock position, so add another 90 to offset this (234deg)
|
|
384
385
|
// This means the arc length that we offset is 2 * PI * r * 234/360 or ...
|
|
385
|
-
|
|
386
386
|
var strokeDashoffset = circumference * 0.65;
|
|
387
387
|
return /*#__PURE__*/external_react_default.a.createElement("svg", {
|
|
388
388
|
height: normalizedSize * 2,
|
|
@@ -413,7 +413,6 @@ var RadialGraph_RadialGraph = function RadialGraph(_ref) {
|
|
|
413
413
|
cy: normalizedSize
|
|
414
414
|
})));
|
|
415
415
|
};
|
|
416
|
-
|
|
417
416
|
RadialGraph_RadialGraph.propTypes = {
|
|
418
417
|
progress: external_prop_types_default.a.number,
|
|
419
418
|
size: external_prop_types_default.a.number,
|
|
@@ -435,6 +434,7 @@ var MAJOR_FONT_THRESHOLD = 25;
|
|
|
435
434
|
var TREND_FONT_THRESHOLD = 12;
|
|
436
435
|
var DEFAULT_RADIAL_STROKE_WIDTH = 12;
|
|
437
436
|
var SMALL_RADIAL_STROKE_WIDTH = 6;
|
|
437
|
+
|
|
438
438
|
/**
|
|
439
439
|
* Get the colors for a radial graph based on severity
|
|
440
440
|
* @method getRadialColors
|
|
@@ -443,10 +443,9 @@ var SMALL_RADIAL_STROKE_WIDTH = 6;
|
|
|
443
443
|
* @param {String} props.backgroundColor
|
|
444
444
|
* @returns {Object} { background, stroke } colors
|
|
445
445
|
*/
|
|
446
|
-
|
|
447
446
|
var displayUtils_getRadialColors = function getRadialColors(_ref) {
|
|
448
447
|
var backgroundEnabled = _ref.backgroundEnabled,
|
|
449
|
-
|
|
448
|
+
backgroundColor = _ref.backgroundColor;
|
|
450
449
|
return Object(singleValueUtils_["getGraphColors"])({
|
|
451
450
|
backgroundEnabled: backgroundEnabled,
|
|
452
451
|
backgroundColor: backgroundColor,
|
|
@@ -459,6 +458,7 @@ var displayUtils_getRadialColors = function getRadialColors(_ref) {
|
|
|
459
458
|
}
|
|
460
459
|
});
|
|
461
460
|
};
|
|
461
|
+
|
|
462
462
|
/**
|
|
463
463
|
* Figure out the diameter of the graph
|
|
464
464
|
* @method getGraphSize
|
|
@@ -468,19 +468,17 @@ var displayUtils_getRadialColors = function getRadialColors(_ref) {
|
|
|
468
468
|
* @param {Number} props.underLabel // Underlabel if present
|
|
469
469
|
* @returns {Number} diameter of the graph
|
|
470
470
|
*/
|
|
471
|
-
|
|
472
471
|
var displayUtils_getGraphSize = function getGraphSize(_ref2) {
|
|
473
472
|
var width = _ref2.width,
|
|
474
|
-
|
|
475
|
-
|
|
473
|
+
height = _ref2.height,
|
|
474
|
+
underLabel = _ref2.underLabel;
|
|
476
475
|
var size = Math.min(width, height);
|
|
477
|
-
|
|
478
476
|
if (underLabel) {
|
|
479
477
|
size -= singleValueUtils_["DEFAULT_FONT"];
|
|
480
478
|
}
|
|
481
|
-
|
|
482
479
|
return size;
|
|
483
480
|
};
|
|
481
|
+
|
|
484
482
|
/**
|
|
485
483
|
* Get the maximum size of the container that holds the graph text
|
|
486
484
|
* @method getValueContentSize
|
|
@@ -489,34 +487,34 @@ var displayUtils_getGraphSize = function getGraphSize(_ref2) {
|
|
|
489
487
|
* @param {Number} props.radialStrokeWidth // Stroke width of the graph
|
|
490
488
|
* @returns {Number} content size for showing major and trend values in radial graph
|
|
491
489
|
*/
|
|
492
|
-
|
|
493
490
|
var getValueContentSize = function getValueContentSize(_ref3) {
|
|
494
491
|
var graphSize = _ref3.graphSize,
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
var diameter = graphSize - radialStrokeWidth;
|
|
492
|
+
radialStrokeWidth = _ref3.radialStrokeWidth;
|
|
493
|
+
// Account for the graph's stroke width
|
|
494
|
+
var diameter = graphSize - radialStrokeWidth;
|
|
495
|
+
// Use pythagoreum theorum with circle diameter
|
|
498
496
|
// to calculate the size of the sides of the square inside the circle
|
|
499
|
-
|
|
500
497
|
return Math.floor(Math.sqrt(Math.pow(diameter, 2) / 2));
|
|
501
498
|
};
|
|
499
|
+
|
|
502
500
|
/*
|
|
503
501
|
* @method getRadialStrokeWidth
|
|
504
502
|
* @param {Number} graphSize
|
|
505
503
|
* @returns {Number} radial stroke width
|
|
506
504
|
*/
|
|
507
|
-
|
|
508
505
|
var getRadialStrokeWidth = function getRadialStrokeWidth(graphSize) {
|
|
509
506
|
return graphSize >= 90 ? DEFAULT_RADIAL_STROKE_WIDTH : SMALL_RADIAL_STROKE_WIDTH;
|
|
510
507
|
};
|
|
508
|
+
|
|
511
509
|
/*
|
|
512
510
|
* @method isValidPosition
|
|
513
511
|
* @param {String} position
|
|
514
512
|
* @returns {Bool}
|
|
515
513
|
*/
|
|
516
|
-
|
|
517
514
|
var isValidPosition = function isValidPosition(position) {
|
|
518
515
|
return VALID_TREND_POSITIONS.indexOf(position) > -1;
|
|
519
516
|
};
|
|
517
|
+
|
|
520
518
|
/**
|
|
521
519
|
* Compute the trend indicator position based on font size of major and trend value
|
|
522
520
|
* @method computeTrendIndicatorPosition
|
|
@@ -526,23 +524,20 @@ var isValidPosition = function isValidPosition(position) {
|
|
|
526
524
|
* @param {Number} props.trendTextFontSize
|
|
527
525
|
* @returns {String} trend indicator position in radial graph
|
|
528
526
|
*/
|
|
529
|
-
|
|
530
527
|
var computeTrendIndicatorPosition = function computeTrendIndicatorPosition(_ref4) {
|
|
531
528
|
var trendIndicatorPosition = _ref4.trendIndicatorPosition,
|
|
532
|
-
|
|
533
|
-
|
|
529
|
+
majorTextFontSize = _ref4.majorTextFontSize,
|
|
530
|
+
trendTextFontSize = _ref4.trendTextFontSize;
|
|
534
531
|
var position = trendIndicatorPosition;
|
|
535
|
-
|
|
536
532
|
if (!isValidPosition(position)) {
|
|
537
533
|
position = 'standard';
|
|
538
534
|
}
|
|
539
|
-
|
|
540
535
|
if (position !== 'outside' && (trendTextFontSize < TREND_FONT_THRESHOLD || majorTextFontSize < MAJOR_FONT_THRESHOLD)) {
|
|
541
536
|
position = 'below';
|
|
542
537
|
}
|
|
543
|
-
|
|
544
538
|
return position;
|
|
545
539
|
};
|
|
540
|
+
|
|
546
541
|
/*
|
|
547
542
|
* @method showTrendPositionStandard
|
|
548
543
|
* @param {Object} props
|
|
@@ -550,12 +545,12 @@ var computeTrendIndicatorPosition = function computeTrendIndicatorPosition(_ref4
|
|
|
550
545
|
* @param {String} props.position
|
|
551
546
|
* @returns {Bool}
|
|
552
547
|
*/
|
|
553
|
-
|
|
554
548
|
var showTrendPositionStandard = function showTrendPositionStandard(_ref5) {
|
|
555
549
|
var showTrendIndicator = _ref5.showTrendIndicator,
|
|
556
|
-
|
|
550
|
+
position = _ref5.position;
|
|
557
551
|
return showTrendIndicator && position === 'standard';
|
|
558
552
|
};
|
|
553
|
+
|
|
559
554
|
/*
|
|
560
555
|
* @method showTrendPositionBelow
|
|
561
556
|
* @param {Object} props
|
|
@@ -563,12 +558,12 @@ var showTrendPositionStandard = function showTrendPositionStandard(_ref5) {
|
|
|
563
558
|
* @param {String} props.position
|
|
564
559
|
* @returns {Bool}
|
|
565
560
|
*/
|
|
566
|
-
|
|
567
561
|
var showTrendPositionBelow = function showTrendPositionBelow(_ref6) {
|
|
568
562
|
var showTrendIndicator = _ref6.showTrendIndicator,
|
|
569
|
-
|
|
563
|
+
position = _ref6.position;
|
|
570
564
|
return showTrendIndicator && position === 'below';
|
|
571
565
|
};
|
|
566
|
+
|
|
572
567
|
/*
|
|
573
568
|
* @method showTrendPositionOutside
|
|
574
569
|
* @param {Object} props
|
|
@@ -576,61 +571,46 @@ var showTrendPositionBelow = function showTrendPositionBelow(_ref6) {
|
|
|
576
571
|
* @param {String} props.position
|
|
577
572
|
* @returns {Bool}
|
|
578
573
|
*/
|
|
579
|
-
|
|
580
574
|
var showTrendPositionOutside = function showTrendPositionOutside(_ref7) {
|
|
581
575
|
var showTrendIndicator = _ref7.showTrendIndicator,
|
|
582
|
-
|
|
576
|
+
position = _ref7.position;
|
|
583
577
|
return showTrendIndicator && position === 'outside';
|
|
584
578
|
};
|
|
579
|
+
|
|
585
580
|
/*
|
|
586
581
|
* todo: need handle max and min
|
|
587
582
|
* @method getRadialProgress
|
|
588
583
|
* @param {Number} majorValue
|
|
589
584
|
* @returns {Number} progress bar in radial graph
|
|
590
585
|
*/
|
|
591
|
-
|
|
592
586
|
var getRadialProgress = function getRadialProgress(majorValue) {
|
|
593
587
|
return Number.isNaN(Number(majorValue)) ? 0 : majorValue / Math.max(majorValue, 100) * 100;
|
|
594
588
|
};
|
|
595
589
|
// CONCATENATED MODULE: ./src/visualizations/SingleValueRadial/src/components/RadialLayout.jsx
|
|
596
590
|
|
|
597
591
|
|
|
598
|
-
|
|
599
592
|
function ownKeys(object, enumerableOnly) {
|
|
600
593
|
var keys = Object.keys(object);
|
|
601
|
-
|
|
602
594
|
if (Object.getOwnPropertySymbols) {
|
|
603
595
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
604
|
-
|
|
596
|
+
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
605
597
|
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
606
|
-
});
|
|
607
|
-
keys.push.apply(keys, symbols);
|
|
598
|
+
})), keys.push.apply(keys, symbols);
|
|
608
599
|
}
|
|
609
|
-
|
|
610
600
|
return keys;
|
|
611
601
|
}
|
|
612
|
-
|
|
613
602
|
function _objectSpread(target) {
|
|
614
603
|
for (var i = 1; i < arguments.length; i++) {
|
|
615
|
-
var source = arguments[i]
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
} else if (Object.getOwnPropertyDescriptors) {
|
|
622
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
623
|
-
} else {
|
|
624
|
-
ownKeys(Object(source)).forEach(function (key) {
|
|
625
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
626
|
-
});
|
|
627
|
-
}
|
|
604
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
605
|
+
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
606
|
+
defineProperty_default()(target, key, source[key]);
|
|
607
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
608
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
609
|
+
});
|
|
628
610
|
}
|
|
629
|
-
|
|
630
611
|
return target;
|
|
631
|
-
}
|
|
632
|
-
|
|
633
|
-
|
|
612
|
+
}
|
|
613
|
+
// this is a copy of RadialLayout.jsx @ 23.5.0 before the design changes to PureSingleValueRadial were rolled out
|
|
634
614
|
|
|
635
615
|
|
|
636
616
|
|
|
@@ -678,6 +658,7 @@ var UnderLabelContainer = external_styled_components_default.a.div.withConfig({
|
|
|
678
658
|
}, function (props) {
|
|
679
659
|
return props.size || 12;
|
|
680
660
|
});
|
|
661
|
+
|
|
681
662
|
/**
|
|
682
663
|
* Render the trend indicator
|
|
683
664
|
* @method renderTrendValue
|
|
@@ -687,8 +668,8 @@ var UnderLabelContainer = external_styled_components_default.a.div.withConfig({
|
|
|
687
668
|
|
|
688
669
|
var RadialLayout_renderIsolateTrend = function renderIsolateTrend(_ref) {
|
|
689
670
|
var trendText = _ref.trendText,
|
|
690
|
-
|
|
691
|
-
|
|
671
|
+
trendColor = _ref.trendColor,
|
|
672
|
+
contentSize = _ref.contentSize;
|
|
692
673
|
var trendTextFontSize = Object(singleValueUtils_["getTrendFontSize"])({
|
|
693
674
|
width: contentSize / 2,
|
|
694
675
|
height: contentSize / 4,
|
|
@@ -702,39 +683,35 @@ var RadialLayout_renderIsolateTrend = function renderIsolateTrend(_ref) {
|
|
|
702
683
|
text: trendText
|
|
703
684
|
});
|
|
704
685
|
};
|
|
705
|
-
|
|
706
686
|
RadialLayout_renderIsolateTrend.propTypes = {
|
|
707
687
|
trendText: external_prop_types_default.a.string,
|
|
708
688
|
trendColor: external_prop_types_default.a.string,
|
|
709
689
|
contentSize: external_prop_types_default.a.number
|
|
710
690
|
};
|
|
711
|
-
|
|
712
691
|
var RadialLayout_RadialContent = function RadialContent(_ref2) {
|
|
713
692
|
var props = extends_default()({}, _ref2);
|
|
714
|
-
|
|
715
693
|
var majorColor = props.majorColor,
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
694
|
+
majorText = props.majorText,
|
|
695
|
+
majorTextFontSize = props.majorTextFontSize,
|
|
696
|
+
majorValueTitle = props.majorValueTitle,
|
|
697
|
+
trendColor = props.trendColor,
|
|
698
|
+
trendText = props.trendText,
|
|
699
|
+
trendTextFontSize = props.trendTextFontSize,
|
|
700
|
+
showTrendIndicator = props.showTrendIndicator,
|
|
701
|
+
trendPosition = props.trendPosition,
|
|
702
|
+
unit = props.unit,
|
|
703
|
+
unitPosition = props.unitPosition,
|
|
704
|
+
underLabelColor = props.underLabelColor,
|
|
705
|
+
underLabelFontSize = props.underLabelFontSize,
|
|
706
|
+
underLabel = props.underLabel,
|
|
707
|
+
onValueClick = props.onValueClick,
|
|
708
|
+
contentSize = props.contentSize,
|
|
709
|
+
showRadialGraph = props.showRadialGraph,
|
|
710
|
+
graphSize = props.graphSize,
|
|
711
|
+
progress = props.progress,
|
|
712
|
+
radialBackgroundColor = props.radialBackgroundColor,
|
|
713
|
+
radialStrokeColor = props.radialStrokeColor,
|
|
714
|
+
radialStrokeWidth = props.radialStrokeWidth; // for trend position below and outside
|
|
738
715
|
var trendComponent = RadialLayout_renderIsolateTrend({
|
|
739
716
|
trendText: trendText,
|
|
740
717
|
trendColor: trendColor,
|
|
@@ -790,7 +767,6 @@ var RadialLayout_RadialContent = function RadialContent(_ref2) {
|
|
|
790
767
|
size: graphSize
|
|
791
768
|
}, radialGraph, belowTrendComponent, /*#__PURE__*/external_react_default.a.createElement(PositionDiv, null, basicSingleValues)), trendPosition !== 'outside' && underLabelComponent), outsideComponent);
|
|
792
769
|
};
|
|
793
|
-
|
|
794
770
|
RadialLayout_RadialContent.propTypes = _objectSpread(_objectSpread({}, SingleValueBasic_default.a.propTypes), {}, {
|
|
795
771
|
trendPosition: external_prop_types_default.a.string,
|
|
796
772
|
contentSize: external_prop_types_default.a.number,
|
|
@@ -803,8 +779,8 @@ RadialLayout_RadialContent.propTypes = _objectSpread(_objectSpread({}, SingleVal
|
|
|
803
779
|
});
|
|
804
780
|
/* harmony default export */ var RadialLayout = (RadialLayout_RadialContent);
|
|
805
781
|
// 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
782
|
|
|
783
|
+
// this is a copy of SingleValueRadial.jsx @ 23.5.0 before the design changes to PureSingleValueRadial were rolled out
|
|
808
784
|
|
|
809
785
|
|
|
810
786
|
|
|
@@ -837,27 +813,24 @@ var VizStyleWrapper = external_styled_components_default.a.div.attrs(function (_
|
|
|
837
813
|
return props.backgroundColor;
|
|
838
814
|
});
|
|
839
815
|
VizStyleWrapper.displayName = 'VizStyleWrapper';
|
|
840
|
-
|
|
841
816
|
var SingleValueRadial_SingleValueRadial = function SingleValueRadial(_ref2) {
|
|
842
817
|
var props = extends_default()({}, _ref2);
|
|
843
|
-
|
|
844
818
|
var width = props.width,
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
819
|
+
_props$height = props.height,
|
|
820
|
+
height = _props$height === void 0 ? 250 : _props$height,
|
|
821
|
+
style = props.style,
|
|
822
|
+
majorFontSize = props.majorFontSize,
|
|
823
|
+
majorValue = props.majorValue,
|
|
824
|
+
majorValueField = props.majorValueField,
|
|
825
|
+
trendValue = props.trendValue,
|
|
826
|
+
trendFontSize = props.trendFontSize,
|
|
827
|
+
unitPosition = props.unitPosition,
|
|
828
|
+
numberPrecision = props.numberPrecision,
|
|
829
|
+
shouldUseThousandSeparators = props.shouldUseThousandSeparators,
|
|
830
|
+
shouldAbbreviateTrendValue = props.shouldAbbreviateTrendValue,
|
|
831
|
+
_props$trendIndicator = props.trendIndicatorPosition,
|
|
832
|
+
trendIndicatorPosition = _props$trendIndicator === void 0 ? 'standard' : _props$trendIndicator,
|
|
833
|
+
onValueClick = props.onValueClick; // calculate colors
|
|
861
834
|
var defaultColors = {
|
|
862
835
|
defaultFontColor: pick_default()({
|
|
863
836
|
enterprise: {
|
|
@@ -871,14 +844,12 @@ var SingleValueRadial_SingleValueRadial = function SingleValueRadial(_ref2) {
|
|
|
871
844
|
prisma: variables_default.a.contentColorActive(props)
|
|
872
845
|
})(props)
|
|
873
846
|
};
|
|
874
|
-
|
|
875
847
|
var _computeColors = Object(singleValueUtils_["computeColors"])(props, defaultColors),
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
848
|
+
backgroundEnabled = _computeColors.backgroundEnabled,
|
|
849
|
+
backgroundColor = _computeColors.backgroundColor,
|
|
850
|
+
majorColor = _computeColors.majorColor,
|
|
851
|
+
trendColor = _computeColors.trendColor,
|
|
852
|
+
underLabelColor = _computeColors.underLabelColor;
|
|
882
853
|
var radialColors = displayUtils_getRadialColors({
|
|
883
854
|
backgroundEnabled: backgroundEnabled,
|
|
884
855
|
backgroundColor: backgroundColor
|
|
@@ -888,11 +859,9 @@ var SingleValueRadial_SingleValueRadial = function SingleValueRadial(_ref2) {
|
|
|
888
859
|
var handleValueClick = Object(external_react_["useCallback"])(function (ev) {
|
|
889
860
|
return Object(singleValueUtils_["handleValueClickCallback"])(ev, majorValue, majorValueField, trendValue, onValueClick);
|
|
890
861
|
}, [onValueClick, majorValue, majorValueField, trendValue]);
|
|
891
|
-
|
|
892
862
|
var renderVisualization = function renderVisualization(_ref3) {
|
|
893
863
|
var containerWidth = _ref3.width,
|
|
894
|
-
|
|
895
|
-
|
|
864
|
+
containerHeight = _ref3.height;
|
|
896
865
|
if (containerWidth < 35 || containerHeight < 35) {
|
|
897
866
|
return /*#__PURE__*/external_react_default.a.createElement(Message_default.a, {
|
|
898
867
|
width: containerWidth,
|
|
@@ -900,14 +869,15 @@ var SingleValueRadial_SingleValueRadial = function SingleValueRadial(_ref2) {
|
|
|
900
869
|
message: Object(i18n_["_"])('Too small to render content'),
|
|
901
870
|
level: "info"
|
|
902
871
|
});
|
|
903
|
-
}
|
|
904
|
-
|
|
872
|
+
}
|
|
905
873
|
|
|
874
|
+
// will update later based on text size
|
|
906
875
|
var trendDisplay = props.trendDisplay,
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
var showRadialGraph = true;
|
|
876
|
+
unit = props.unit,
|
|
877
|
+
underLabel = props.underLabel;
|
|
878
|
+
var showRadialGraph = true;
|
|
910
879
|
|
|
880
|
+
// calculate radial graph, major and trend content, and underlabel size
|
|
911
881
|
var graphSize = displayUtils_getGraphSize({
|
|
912
882
|
width: containerWidth,
|
|
913
883
|
height: containerHeight,
|
|
@@ -918,8 +888,9 @@ var SingleValueRadial_SingleValueRadial = function SingleValueRadial(_ref2) {
|
|
|
918
888
|
graphSize: graphSize,
|
|
919
889
|
radialStrokeWidth: radialStrokeWidth
|
|
920
890
|
});
|
|
921
|
-
var underLabelFontSize = Object(singleValueUtils_["getUnderLabelHeight"])(graphSize * 0.1);
|
|
891
|
+
var underLabelFontSize = Object(singleValueUtils_["getUnderLabelHeight"])(graphSize * 0.1);
|
|
922
892
|
|
|
893
|
+
// calculate major and trend text
|
|
923
894
|
var toRemoveList = [{
|
|
924
895
|
key: 'underLabel',
|
|
925
896
|
value: ''
|
|
@@ -933,44 +904,43 @@ var SingleValueRadial_SingleValueRadial = function SingleValueRadial(_ref2) {
|
|
|
933
904
|
key: 'unit',
|
|
934
905
|
value: ''
|
|
935
906
|
}];
|
|
936
|
-
|
|
937
907
|
var _computeSingleValueCo = Object(singleValueUtils_["computeSingleValueContent"])({
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
908
|
+
majorValue: majorValue,
|
|
909
|
+
trendValue: trendValue,
|
|
910
|
+
majorFontSize: majorFontSize,
|
|
911
|
+
trendFontSize: trendFontSize,
|
|
912
|
+
trendDisplay: trendDisplay,
|
|
913
|
+
contentWidth: valueContentSize,
|
|
914
|
+
contentHeight: valueContentSize,
|
|
915
|
+
containerWidth: containerWidth,
|
|
916
|
+
containerHeight: containerHeight,
|
|
917
|
+
unit: unit,
|
|
918
|
+
numberPrecision: numberPrecision,
|
|
919
|
+
shouldUseThousandSeparators: shouldUseThousandSeparators,
|
|
920
|
+
shouldAbbreviateTrendValue: shouldAbbreviateTrendValue,
|
|
921
|
+
toRemoveList: toRemoveList
|
|
922
|
+
}),
|
|
923
|
+
majorText = _computeSingleValueCo.majorText,
|
|
924
|
+
trendText = _computeSingleValueCo.trendText,
|
|
925
|
+
majorTextFontSize = _computeSingleValueCo.majorTextFontSize,
|
|
926
|
+
trendTextFontSize = _computeSingleValueCo.trendTextFontSize,
|
|
927
|
+
majorValueTitle = _computeSingleValueCo.majorValueTitle,
|
|
928
|
+
smallVizProps = _computeSingleValueCo.smallVizProps;
|
|
960
929
|
if (!isEmpty_default()(smallVizProps)) {
|
|
961
930
|
underLabel = smallVizProps.underLabel;
|
|
962
931
|
showRadialGraph = smallVizProps.showRadialGraph;
|
|
963
932
|
trendDisplay = smallVizProps.trendDisplay;
|
|
964
933
|
unit = smallVizProps.unit;
|
|
965
|
-
}
|
|
966
|
-
|
|
934
|
+
}
|
|
967
935
|
|
|
936
|
+
// calculate trend position
|
|
968
937
|
var position = computeTrendIndicatorPosition({
|
|
969
938
|
trendIndicatorPosition: trendIndicatorPosition,
|
|
970
939
|
majorTextFontSize: majorTextFontSize,
|
|
971
940
|
trendTextFontSize: trendTextFontSize
|
|
972
|
-
});
|
|
941
|
+
});
|
|
973
942
|
|
|
943
|
+
// calculate radial
|
|
974
944
|
var progress = getRadialProgress(majorValue);
|
|
975
945
|
return /*#__PURE__*/external_react_default.a.createElement(VizStyleWrapper, {
|
|
976
946
|
backgroundColor: backgroundColor,
|
|
@@ -1002,7 +972,6 @@ var SingleValueRadial_SingleValueRadial = function SingleValueRadial(_ref2) {
|
|
|
1002
972
|
radialStrokeWidth: radialStrokeWidth
|
|
1003
973
|
}));
|
|
1004
974
|
};
|
|
1005
|
-
|
|
1006
975
|
return /*#__PURE__*/external_react_default.a.createElement(Container, {
|
|
1007
976
|
width: width,
|
|
1008
977
|
height: height
|
|
@@ -1010,7 +979,6 @@ var SingleValueRadial_SingleValueRadial = function SingleValueRadial(_ref2) {
|
|
|
1010
979
|
return renderVisualization(containerDimension);
|
|
1011
980
|
}));
|
|
1012
981
|
};
|
|
1013
|
-
|
|
1014
982
|
SingleValueRadial_SingleValueRadial.propTypes = {
|
|
1015
983
|
width: external_prop_types_default.a.oneOfType([external_prop_types_default.a.string, external_prop_types_default.a.number]),
|
|
1016
984
|
height: external_prop_types_default.a.oneOfType([external_prop_types_default.a.string, external_prop_types_default.a.number]),
|
|
@@ -1055,38 +1023,25 @@ var propUtils = __webpack_require__(20);
|
|
|
1055
1023
|
// CONCATENATED MODULE: ./src/visualizations/SingleValueRadial/SingleValueRadial.jsx
|
|
1056
1024
|
|
|
1057
1025
|
|
|
1058
|
-
|
|
1059
1026
|
function SingleValueRadial_ownKeys(object, enumerableOnly) {
|
|
1060
1027
|
var keys = Object.keys(object);
|
|
1061
|
-
|
|
1062
1028
|
if (Object.getOwnPropertySymbols) {
|
|
1063
1029
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
1064
|
-
|
|
1030
|
+
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
1065
1031
|
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
1066
|
-
});
|
|
1067
|
-
keys.push.apply(keys, symbols);
|
|
1032
|
+
})), keys.push.apply(keys, symbols);
|
|
1068
1033
|
}
|
|
1069
|
-
|
|
1070
1034
|
return keys;
|
|
1071
1035
|
}
|
|
1072
|
-
|
|
1073
1036
|
function SingleValueRadial_objectSpread(target) {
|
|
1074
1037
|
for (var i = 1; i < arguments.length; i++) {
|
|
1075
|
-
var source = arguments[i]
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
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
|
-
}
|
|
1038
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
1039
|
+
i % 2 ? SingleValueRadial_ownKeys(Object(source), !0).forEach(function (key) {
|
|
1040
|
+
defineProperty_default()(target, key, source[key]);
|
|
1041
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : SingleValueRadial_ownKeys(Object(source)).forEach(function (key) {
|
|
1042
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
1043
|
+
});
|
|
1088
1044
|
}
|
|
1089
|
-
|
|
1090
1045
|
return target;
|
|
1091
1046
|
}
|
|
1092
1047
|
|
|
@@ -1094,8 +1049,8 @@ function SingleValueRadial_objectSpread(target) {
|
|
|
1094
1049
|
|
|
1095
1050
|
|
|
1096
1051
|
|
|
1097
|
-
// This propsMapping is for React SingleValue to use PureSingleValue.
|
|
1098
1052
|
|
|
1053
|
+
// This propsMapping is for React SingleValue to use PureSingleValue.
|
|
1099
1054
|
var propsMapping = {
|
|
1100
1055
|
value: 'majorValue',
|
|
1101
1056
|
deltaValue: 'trendValue',
|
|
@@ -1105,19 +1060,16 @@ var propsMapping = {
|
|
|
1105
1060
|
useThousandSeparators: 'shouldUseThousandSeparators'
|
|
1106
1061
|
};
|
|
1107
1062
|
var deprecatedProps = ['showTrendIndicator', 'trendDisplayMode'];
|
|
1108
|
-
|
|
1109
1063
|
var SingleValueRadial_ReactSingleValueRadial = function ReactSingleValueRadial(_ref) {
|
|
1110
1064
|
var props = extends_default()({}, _ref);
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1065
|
+
var newProps = Object(propUtils["a" /* propsConvert */])(props, propsMapping);
|
|
1066
|
+
// change props
|
|
1114
1067
|
var trendDisplay = newProps.showTrendIndicator ? newProps.trendDisplayMode : 'off';
|
|
1115
1068
|
newProps = SingleValueRadial_objectSpread(SingleValueRadial_objectSpread({}, Object(propUtils["b" /* propsDeprecate */])(newProps, deprecatedProps)), {}, {
|
|
1116
1069
|
trendDisplay: trendDisplay
|
|
1117
1070
|
});
|
|
1118
1071
|
return /*#__PURE__*/external_react_default.a.createElement(components_SingleValueRadial, newProps);
|
|
1119
1072
|
};
|
|
1120
|
-
|
|
1121
1073
|
SingleValueRadial_ReactSingleValueRadial.propTypes = {
|
|
1122
1074
|
width: external_prop_types_default.a.oneOfType([external_prop_types_default.a.string, external_prop_types_default.a.number]),
|
|
1123
1075
|
height: external_prop_types_default.a.oneOfType([external_prop_types_default.a.string, external_prop_types_default.a.number]),
|