@spscommerce/ds-react-charts 3.12.4 → 3.16.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/lib/bar/SpsBarChart.d.ts +4 -4
- package/lib/bar/SpsBarChart.examples.d.ts +1 -1
- package/lib/bar/SpsBarChartComponents.d.ts +8 -8
- package/lib/bar/SpsBarChartHelperFunctions.d.ts +2 -2
- package/lib/index.cjs.js +331 -423
- package/lib/index.d.ts +4 -3
- package/lib/index.esm.js +328 -421
- package/lib/manifest.d.ts +2 -0
- package/package.json +8 -8
- package/rollup.config.js +24 -0
package/lib/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export
|
|
2
|
-
export {
|
|
3
|
-
export
|
|
1
|
+
export * from './manifest';
|
|
2
|
+
export { SpsBarChart, ChartDataObject } from './bar/SpsBarChart';
|
|
3
|
+
export { SpsDefaultChartTooltip, SpsDefaultXAxisTick, SpsDefaultYAxisTick, PercentXAxisTick, } from './bar/SpsBarChartComponents';
|
|
4
|
+
export * from './bar/SpsBarChart.examples';
|
package/lib/index.esm.js
CHANGED
|
@@ -36,10 +36,14 @@ function __read(o, n) {
|
|
|
36
36
|
return ar;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
function
|
|
40
|
-
for (var
|
|
41
|
-
ar
|
|
42
|
-
|
|
39
|
+
function __spreadArray(to, from, pack) {
|
|
40
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
41
|
+
if (ar || !(i in from)) {
|
|
42
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
43
|
+
ar[i] = from[i];
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
43
47
|
}
|
|
44
48
|
|
|
45
49
|
function __makeTemplateObject(cooked, raw) {
|
|
@@ -49,21 +53,6 @@ function __makeTemplateObject(cooked, raw) {
|
|
|
49
53
|
|
|
50
54
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
51
55
|
|
|
52
|
-
function getAugmentedNamespace(n) {
|
|
53
|
-
if (n.__esModule) return n;
|
|
54
|
-
var a = Object.defineProperty({}, '__esModule', {value: true});
|
|
55
|
-
Object.keys(n).forEach(function (k) {
|
|
56
|
-
var d = Object.getOwnPropertyDescriptor(n, k);
|
|
57
|
-
Object.defineProperty(a, k, d.get ? d : {
|
|
58
|
-
enumerable: true,
|
|
59
|
-
get: function () {
|
|
60
|
-
return n[k];
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
return a;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
56
|
var _global = {exports: {}};
|
|
68
57
|
|
|
69
58
|
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
|
|
@@ -2214,7 +2203,7 @@ var PropTypes = propTypes$5.exports;
|
|
|
2214
2203
|
var classnames = {exports: {}};
|
|
2215
2204
|
|
|
2216
2205
|
/*!
|
|
2217
|
-
Copyright (c)
|
|
2206
|
+
Copyright (c) 2018 Jed Watson.
|
|
2218
2207
|
Licensed under the MIT License (MIT), see
|
|
2219
2208
|
http://jedwatson.github.io/classnames
|
|
2220
2209
|
*/
|
|
@@ -2226,7 +2215,7 @@ var classnames = {exports: {}};
|
|
|
2226
2215
|
|
|
2227
2216
|
var hasOwn = {}.hasOwnProperty;
|
|
2228
2217
|
|
|
2229
|
-
function classNames
|
|
2218
|
+
function classNames() {
|
|
2230
2219
|
var classes = [];
|
|
2231
2220
|
|
|
2232
2221
|
for (var i = 0; i < arguments.length; i++) {
|
|
@@ -2237,16 +2226,22 @@ var classnames = {exports: {}};
|
|
|
2237
2226
|
|
|
2238
2227
|
if (argType === 'string' || argType === 'number') {
|
|
2239
2228
|
classes.push(arg);
|
|
2240
|
-
} else if (Array.isArray(arg)
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2229
|
+
} else if (Array.isArray(arg)) {
|
|
2230
|
+
if (arg.length) {
|
|
2231
|
+
var inner = classNames.apply(null, arg);
|
|
2232
|
+
if (inner) {
|
|
2233
|
+
classes.push(inner);
|
|
2234
|
+
}
|
|
2244
2235
|
}
|
|
2245
2236
|
} else if (argType === 'object') {
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2237
|
+
if (arg.toString === Object.prototype.toString) {
|
|
2238
|
+
for (var key in arg) {
|
|
2239
|
+
if (hasOwn.call(arg, key) && arg[key]) {
|
|
2240
|
+
classes.push(key);
|
|
2241
|
+
}
|
|
2249
2242
|
}
|
|
2243
|
+
} else {
|
|
2244
|
+
classes.push(arg.toString());
|
|
2250
2245
|
}
|
|
2251
2246
|
}
|
|
2252
2247
|
}
|
|
@@ -10593,15 +10588,54 @@ var now$2 = function() {
|
|
|
10593
10588
|
|
|
10594
10589
|
var now_1 = now$2;
|
|
10595
10590
|
|
|
10596
|
-
|
|
10591
|
+
/** Used to match a single whitespace character. */
|
|
10592
|
+
|
|
10593
|
+
var reWhitespace = /\s/;
|
|
10594
|
+
|
|
10595
|
+
/**
|
|
10596
|
+
* Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
|
|
10597
|
+
* character of `string`.
|
|
10598
|
+
*
|
|
10599
|
+
* @private
|
|
10600
|
+
* @param {string} string The string to inspect.
|
|
10601
|
+
* @returns {number} Returns the index of the last non-whitespace character.
|
|
10602
|
+
*/
|
|
10603
|
+
function trimmedEndIndex$1(string) {
|
|
10604
|
+
var index = string.length;
|
|
10605
|
+
|
|
10606
|
+
while (index-- && reWhitespace.test(string.charAt(index))) {}
|
|
10607
|
+
return index;
|
|
10608
|
+
}
|
|
10609
|
+
|
|
10610
|
+
var _trimmedEndIndex = trimmedEndIndex$1;
|
|
10611
|
+
|
|
10612
|
+
var trimmedEndIndex = _trimmedEndIndex;
|
|
10613
|
+
|
|
10614
|
+
/** Used to match leading whitespace. */
|
|
10615
|
+
var reTrimStart = /^\s+/;
|
|
10616
|
+
|
|
10617
|
+
/**
|
|
10618
|
+
* The base implementation of `_.trim`.
|
|
10619
|
+
*
|
|
10620
|
+
* @private
|
|
10621
|
+
* @param {string} string The string to trim.
|
|
10622
|
+
* @returns {string} Returns the trimmed string.
|
|
10623
|
+
*/
|
|
10624
|
+
function baseTrim$1(string) {
|
|
10625
|
+
return string
|
|
10626
|
+
? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')
|
|
10627
|
+
: string;
|
|
10628
|
+
}
|
|
10629
|
+
|
|
10630
|
+
var _baseTrim = baseTrim$1;
|
|
10631
|
+
|
|
10632
|
+
var baseTrim = _baseTrim,
|
|
10633
|
+
isObject$2 = isObject_1,
|
|
10597
10634
|
isSymbol$1 = isSymbol_1;
|
|
10598
10635
|
|
|
10599
10636
|
/** Used as references for various `Number` constants. */
|
|
10600
10637
|
var NAN = 0 / 0;
|
|
10601
10638
|
|
|
10602
|
-
/** Used to match leading and trailing whitespace. */
|
|
10603
|
-
var reTrim = /^\s+|\s+$/g;
|
|
10604
|
-
|
|
10605
10639
|
/** Used to detect bad signed hexadecimal string values. */
|
|
10606
10640
|
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
|
10607
10641
|
|
|
@@ -10651,7 +10685,7 @@ function toNumber$2(value) {
|
|
|
10651
10685
|
if (typeof value != 'string') {
|
|
10652
10686
|
return value === 0 ? value : +value;
|
|
10653
10687
|
}
|
|
10654
|
-
value = value
|
|
10688
|
+
value = baseTrim(value);
|
|
10655
10689
|
var isBinary = reIsBinary.test(value);
|
|
10656
10690
|
return (isBinary || reIsOctal.test(value))
|
|
10657
10691
|
? freeParseInt(value.slice(2), isBinary ? 2 : 8)
|
|
@@ -10975,6 +11009,9 @@ function range$3(a, b, str) {
|
|
|
10975
11009
|
var i = ai;
|
|
10976
11010
|
|
|
10977
11011
|
if (ai >= 0 && bi > 0) {
|
|
11012
|
+
if(a===b) {
|
|
11013
|
+
return [ai, bi];
|
|
11014
|
+
}
|
|
10978
11015
|
begs = [];
|
|
10979
11016
|
left = str.length;
|
|
10980
11017
|
|
|
@@ -12571,10 +12608,6 @@ function flatMap(collection, iteratee) {
|
|
|
12571
12608
|
|
|
12572
12609
|
var flatMap_1 = flatMap;
|
|
12573
12610
|
|
|
12574
|
-
var lib = {};
|
|
12575
|
-
|
|
12576
|
-
var getNiceTickValues$1 = {};
|
|
12577
|
-
|
|
12578
12611
|
/*
|
|
12579
12612
|
* decimal.js-light v2.5.1
|
|
12580
12613
|
* An arbitrary-precision Decimal type for JavaScript.
|
|
@@ -14561,28 +14594,17 @@ ONE = new Decimal(1);
|
|
|
14561
14594
|
|
|
14562
14595
|
var Decimal$1 = Decimal;
|
|
14563
14596
|
|
|
14564
|
-
|
|
14565
|
-
__proto__: null,
|
|
14566
|
-
get Decimal () { return Decimal; },
|
|
14567
|
-
'default': Decimal$1
|
|
14568
|
-
});
|
|
14597
|
+
function _toConsumableArray$5(arr) { return _arrayWithoutHoles$5(arr) || _iterableToArray$5(arr) || _unsupportedIterableToArray$1(arr) || _nonIterableSpread$5(); }
|
|
14569
14598
|
|
|
14570
|
-
|
|
14599
|
+
function _nonIterableSpread$5() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
14571
14600
|
|
|
14572
|
-
var
|
|
14601
|
+
function _unsupportedIterableToArray$1(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$1(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen); }
|
|
14573
14602
|
|
|
14574
|
-
|
|
14575
|
-
value: true
|
|
14576
|
-
});
|
|
14577
|
-
utils.memoize = utils.reverse = utils.compose = utils.map = utils.range = utils.curry = utils.PLACE_HOLDER = void 0;
|
|
14578
|
-
|
|
14579
|
-
function _toConsumableArray$5(arr) { return _arrayWithoutHoles$5(arr) || _iterableToArray$5(arr) || _nonIterableSpread$5(); }
|
|
14603
|
+
function _iterableToArray$5(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
|
|
14580
14604
|
|
|
14581
|
-
function
|
|
14605
|
+
function _arrayWithoutHoles$5(arr) { if (Array.isArray(arr)) return _arrayLikeToArray$1(arr); }
|
|
14582
14606
|
|
|
14583
|
-
function
|
|
14584
|
-
|
|
14585
|
-
function _arrayWithoutHoles$5(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
|
|
14607
|
+
function _arrayLikeToArray$1(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
14586
14608
|
|
|
14587
14609
|
var identity$4 = function identity(i) {
|
|
14588
14610
|
return i;
|
|
@@ -14591,7 +14613,6 @@ var identity$4 = function identity(i) {
|
|
|
14591
14613
|
var PLACE_HOLDER = {
|
|
14592
14614
|
'@@functional/placeholder': true
|
|
14593
14615
|
};
|
|
14594
|
-
utils.PLACE_HOLDER = PLACE_HOLDER;
|
|
14595
14616
|
|
|
14596
14617
|
var isPlaceHolder = function isPlaceHolder(val) {
|
|
14597
14618
|
return val === PLACE_HOLDER;
|
|
@@ -14641,9 +14662,6 @@ var curryN = function curryN(n, fn) {
|
|
|
14641
14662
|
var curry = function curry(fn) {
|
|
14642
14663
|
return curryN(fn.length, fn);
|
|
14643
14664
|
};
|
|
14644
|
-
|
|
14645
|
-
utils.curry = curry;
|
|
14646
|
-
|
|
14647
14665
|
var range$2 = function range(begin, end) {
|
|
14648
14666
|
var arr = [];
|
|
14649
14667
|
|
|
@@ -14653,8 +14671,6 @@ var range$2 = function range(begin, end) {
|
|
|
14653
14671
|
|
|
14654
14672
|
return arr;
|
|
14655
14673
|
};
|
|
14656
|
-
|
|
14657
|
-
utils.range = range$2;
|
|
14658
14674
|
var map$3 = curry(function (fn, arr) {
|
|
14659
14675
|
if (Array.isArray(arr)) {
|
|
14660
14676
|
return arr.map(fn);
|
|
@@ -14664,8 +14680,6 @@ var map$3 = curry(function (fn, arr) {
|
|
|
14664
14680
|
return arr[key];
|
|
14665
14681
|
}).map(fn);
|
|
14666
14682
|
});
|
|
14667
|
-
utils.map = map$3;
|
|
14668
|
-
|
|
14669
14683
|
var compose = function compose() {
|
|
14670
14684
|
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
14671
14685
|
args[_key3] = arguments[_key3];
|
|
@@ -14685,9 +14699,6 @@ var compose = function compose() {
|
|
|
14685
14699
|
}, firstFn.apply(void 0, arguments));
|
|
14686
14700
|
};
|
|
14687
14701
|
};
|
|
14688
|
-
|
|
14689
|
-
utils.compose = compose;
|
|
14690
|
-
|
|
14691
14702
|
var reverse = function reverse(arr) {
|
|
14692
14703
|
if (Array.isArray(arr)) {
|
|
14693
14704
|
return arr.reverse();
|
|
@@ -14696,9 +14707,6 @@ var reverse = function reverse(arr) {
|
|
|
14696
14707
|
|
|
14697
14708
|
return arr.split('').reverse.join('');
|
|
14698
14709
|
};
|
|
14699
|
-
|
|
14700
|
-
utils.reverse = reverse;
|
|
14701
|
-
|
|
14702
14710
|
var memoize = function memoize(fn) {
|
|
14703
14711
|
var lastArgs = null;
|
|
14704
14712
|
var lastResult = null;
|
|
@@ -14719,27 +14727,11 @@ var memoize = function memoize(fn) {
|
|
|
14719
14727
|
};
|
|
14720
14728
|
};
|
|
14721
14729
|
|
|
14722
|
-
utils.memoize = memoize;
|
|
14723
|
-
|
|
14724
|
-
var arithmetic = {};
|
|
14725
|
-
|
|
14726
|
-
Object.defineProperty(arithmetic, "__esModule", {
|
|
14727
|
-
value: true
|
|
14728
|
-
});
|
|
14729
|
-
arithmetic.default = void 0;
|
|
14730
|
-
|
|
14731
|
-
var _decimal$1 = _interopRequireDefault$1(require$$0);
|
|
14732
|
-
|
|
14733
|
-
var _utils$1 = utils;
|
|
14734
|
-
|
|
14735
|
-
function _interopRequireDefault$1(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14736
|
-
|
|
14737
14730
|
/**
|
|
14738
14731
|
* @fileOverview 一些公用的运算方法
|
|
14739
14732
|
* @author xile611
|
|
14740
14733
|
* @date 2015-09-17
|
|
14741
14734
|
*/
|
|
14742
|
-
|
|
14743
14735
|
/**
|
|
14744
14736
|
* 获取数值的位数
|
|
14745
14737
|
* 其中绝对值属于区间[0.1, 1), 得到的值为0
|
|
@@ -14749,13 +14741,14 @@ function _interopRequireDefault$1(obj) { return obj && obj.__esModule ? obj : {
|
|
|
14749
14741
|
* @param {Number} value 数值
|
|
14750
14742
|
* @return {Integer} 位数
|
|
14751
14743
|
*/
|
|
14744
|
+
|
|
14752
14745
|
function getDigitCount(value) {
|
|
14753
14746
|
var result;
|
|
14754
14747
|
|
|
14755
14748
|
if (value === 0) {
|
|
14756
14749
|
result = 1;
|
|
14757
14750
|
} else {
|
|
14758
|
-
result = Math.floor(new
|
|
14751
|
+
result = Math.floor(new Decimal$1(value).abs().log(10).toNumber()) + 1;
|
|
14759
14752
|
}
|
|
14760
14753
|
|
|
14761
14754
|
return result;
|
|
@@ -14772,7 +14765,7 @@ function getDigitCount(value) {
|
|
|
14772
14765
|
|
|
14773
14766
|
|
|
14774
14767
|
function rangeStep(start, end, step) {
|
|
14775
|
-
var num = new
|
|
14768
|
+
var num = new Decimal$1(start);
|
|
14776
14769
|
var i = 0;
|
|
14777
14770
|
var result = []; // magic number to prevent infinite loop
|
|
14778
14771
|
|
|
@@ -14794,7 +14787,7 @@ function rangeStep(start, end, step) {
|
|
|
14794
14787
|
*/
|
|
14795
14788
|
|
|
14796
14789
|
|
|
14797
|
-
var interpolateNumber$1 =
|
|
14790
|
+
var interpolateNumber$1 = curry(function (a, b, t) {
|
|
14798
14791
|
var newA = +a;
|
|
14799
14792
|
var newB = +b;
|
|
14800
14793
|
return newA + t * (newB - newA);
|
|
@@ -14808,7 +14801,7 @@ var interpolateNumber$1 = (0, _utils$1.curry)(function (a, b, t) {
|
|
|
14808
14801
|
* @return {Number} 当x在 a ~ b这个范围内时,返回值属于[0, 1]
|
|
14809
14802
|
*/
|
|
14810
14803
|
|
|
14811
|
-
var uninterpolateNumber =
|
|
14804
|
+
var uninterpolateNumber = curry(function (a, b, x) {
|
|
14812
14805
|
var diff = b - +a;
|
|
14813
14806
|
diff = diff || Infinity;
|
|
14814
14807
|
return (x - a) / diff;
|
|
@@ -14823,49 +14816,38 @@ var uninterpolateNumber = (0, _utils$1.curry)(function (a, b, x) {
|
|
|
14823
14816
|
* 当x不在 a ~ b这个区间时,会截断到 a ~ b 这个区间
|
|
14824
14817
|
*/
|
|
14825
14818
|
|
|
14826
|
-
var uninterpolateTruncation =
|
|
14819
|
+
var uninterpolateTruncation = curry(function (a, b, x) {
|
|
14827
14820
|
var diff = b - +a;
|
|
14828
14821
|
diff = diff || Infinity;
|
|
14829
14822
|
return Math.max(0, Math.min(1, (x - a) / diff));
|
|
14830
14823
|
});
|
|
14831
|
-
var
|
|
14824
|
+
var Arithmetic = {
|
|
14832
14825
|
rangeStep: rangeStep,
|
|
14833
14826
|
getDigitCount: getDigitCount,
|
|
14834
14827
|
interpolateNumber: interpolateNumber$1,
|
|
14835
14828
|
uninterpolateNumber: uninterpolateNumber,
|
|
14836
14829
|
uninterpolateTruncation: uninterpolateTruncation
|
|
14837
14830
|
};
|
|
14838
|
-
arithmetic.default = _default;
|
|
14839
|
-
|
|
14840
|
-
Object.defineProperty(getNiceTickValues$1, "__esModule", {
|
|
14841
|
-
value: true
|
|
14842
|
-
});
|
|
14843
|
-
getNiceTickValues$1.getTickValuesFixedDomain = getNiceTickValues$1.getTickValues = getNiceTickValues$1.getNiceTickValues = void 0;
|
|
14844
|
-
|
|
14845
|
-
var _decimal = _interopRequireDefault(require$$0);
|
|
14846
14831
|
|
|
14847
|
-
|
|
14832
|
+
function _toConsumableArray$4(arr) { return _arrayWithoutHoles$4(arr) || _iterableToArray$4(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread$4(); }
|
|
14848
14833
|
|
|
14849
|
-
|
|
14834
|
+
function _nonIterableSpread$4() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
14850
14835
|
|
|
14851
|
-
function
|
|
14836
|
+
function _iterableToArray$4(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
|
|
14852
14837
|
|
|
14853
|
-
function
|
|
14838
|
+
function _arrayWithoutHoles$4(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
14854
14839
|
|
|
14855
|
-
function
|
|
14840
|
+
function _slicedToArray$2(arr, i) { return _arrayWithHoles$2(arr) || _iterableToArrayLimit$2(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest$2(); }
|
|
14856
14841
|
|
|
14857
|
-
function
|
|
14842
|
+
function _nonIterableRest$2() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
14858
14843
|
|
|
14859
|
-
function
|
|
14844
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
14860
14845
|
|
|
14861
|
-
function
|
|
14846
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
14862
14847
|
|
|
14863
|
-
function
|
|
14864
|
-
|
|
14865
|
-
function _iterableToArrayLimit$2(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
14848
|
+
function _iterableToArrayLimit$2(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
14866
14849
|
|
|
14867
14850
|
function _arrayWithHoles$2(arr) { if (Array.isArray(arr)) return arr; }
|
|
14868
|
-
|
|
14869
14851
|
/**
|
|
14870
14852
|
* Calculate a interval of a minimum value and a maximum value
|
|
14871
14853
|
*
|
|
@@ -14873,6 +14855,7 @@ function _arrayWithHoles$2(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
14873
14855
|
* @param {Number} max The maximum value
|
|
14874
14856
|
* @return {Array} An interval
|
|
14875
14857
|
*/
|
|
14858
|
+
|
|
14876
14859
|
function getValidInterval(_ref) {
|
|
14877
14860
|
var _ref2 = _slicedToArray$2(_ref, 2),
|
|
14878
14861
|
min = _ref2[0],
|
|
@@ -14901,20 +14884,19 @@ function getValidInterval(_ref) {
|
|
|
14901
14884
|
|
|
14902
14885
|
function getFormatStep(roughStep, allowDecimals, correctionFactor) {
|
|
14903
14886
|
if (roughStep.lte(0)) {
|
|
14904
|
-
return new
|
|
14887
|
+
return new Decimal$1(0);
|
|
14905
14888
|
}
|
|
14906
14889
|
|
|
14907
|
-
var digitCount =
|
|
14890
|
+
var digitCount = Arithmetic.getDigitCount(roughStep.toNumber()); // The ratio between the rough step and the smallest number which has a bigger
|
|
14908
14891
|
// order of magnitudes than the rough step
|
|
14909
14892
|
|
|
14910
|
-
|
|
14911
|
-
var digitCountValue = new _decimal.default(10).pow(digitCount);
|
|
14893
|
+
var digitCountValue = new Decimal$1(10).pow(digitCount);
|
|
14912
14894
|
var stepRatio = roughStep.div(digitCountValue); // When an integer and a float multiplied, the accuracy of result may be wrong
|
|
14913
14895
|
|
|
14914
14896
|
var stepRatioScale = digitCount !== 1 ? 0.05 : 0.1;
|
|
14915
|
-
var amendStepRatio = new
|
|
14897
|
+
var amendStepRatio = new Decimal$1(Math.ceil(stepRatio.div(stepRatioScale).toNumber())).add(correctionFactor).mul(stepRatioScale);
|
|
14916
14898
|
var formatStep = amendStepRatio.mul(digitCountValue);
|
|
14917
|
-
return allowDecimals ? formatStep : new
|
|
14899
|
+
return allowDecimals ? formatStep : new Decimal$1(Math.ceil(formatStep));
|
|
14918
14900
|
}
|
|
14919
14901
|
/**
|
|
14920
14902
|
* calculate the ticks when the minimum value equals to the maximum value
|
|
@@ -14929,29 +14911,29 @@ function getFormatStep(roughStep, allowDecimals, correctionFactor) {
|
|
|
14929
14911
|
function getTickOfSingleValue(value, tickCount, allowDecimals) {
|
|
14930
14912
|
var step = 1; // calculate the middle value of ticks
|
|
14931
14913
|
|
|
14932
|
-
var middle = new
|
|
14914
|
+
var middle = new Decimal$1(value);
|
|
14933
14915
|
|
|
14934
14916
|
if (!middle.isint() && allowDecimals) {
|
|
14935
14917
|
var absVal = Math.abs(value);
|
|
14936
14918
|
|
|
14937
14919
|
if (absVal < 1) {
|
|
14938
14920
|
// The step should be a float number when the difference is smaller than 1
|
|
14939
|
-
step = new
|
|
14940
|
-
middle = new
|
|
14921
|
+
step = new Decimal$1(10).pow(Arithmetic.getDigitCount(value) - 1);
|
|
14922
|
+
middle = new Decimal$1(Math.floor(middle.div(step).toNumber())).mul(step);
|
|
14941
14923
|
} else if (absVal > 1) {
|
|
14942
14924
|
// Return the maximum integer which is smaller than 'value' when 'value' is greater than 1
|
|
14943
|
-
middle = new
|
|
14925
|
+
middle = new Decimal$1(Math.floor(value));
|
|
14944
14926
|
}
|
|
14945
14927
|
} else if (value === 0) {
|
|
14946
|
-
middle = new
|
|
14928
|
+
middle = new Decimal$1(Math.floor((tickCount - 1) / 2));
|
|
14947
14929
|
} else if (!allowDecimals) {
|
|
14948
|
-
middle = new
|
|
14930
|
+
middle = new Decimal$1(Math.floor(value));
|
|
14949
14931
|
}
|
|
14950
14932
|
|
|
14951
14933
|
var middleIndex = Math.floor((tickCount - 1) / 2);
|
|
14952
|
-
var fn =
|
|
14953
|
-
return middle.add(new
|
|
14954
|
-
}),
|
|
14934
|
+
var fn = compose(map$3(function (n) {
|
|
14935
|
+
return middle.add(new Decimal$1(n - middleIndex).mul(step)).toNumber();
|
|
14936
|
+
}), range$2);
|
|
14955
14937
|
return fn(0, tickCount);
|
|
14956
14938
|
}
|
|
14957
14939
|
/**
|
|
@@ -14972,28 +14954,28 @@ function calculateStep(min, max, tickCount, allowDecimals) {
|
|
|
14972
14954
|
// dirty hack (for recharts' test)
|
|
14973
14955
|
if (!Number.isFinite((max - min) / (tickCount - 1))) {
|
|
14974
14956
|
return {
|
|
14975
|
-
step: new
|
|
14976
|
-
tickMin: new
|
|
14977
|
-
tickMax: new
|
|
14957
|
+
step: new Decimal$1(0),
|
|
14958
|
+
tickMin: new Decimal$1(0),
|
|
14959
|
+
tickMax: new Decimal$1(0)
|
|
14978
14960
|
};
|
|
14979
14961
|
} // The step which is easy to understand between two ticks
|
|
14980
14962
|
|
|
14981
14963
|
|
|
14982
|
-
var step = getFormatStep(new
|
|
14964
|
+
var step = getFormatStep(new Decimal$1(max).sub(min).div(tickCount - 1), allowDecimals, correctionFactor); // A medial value of ticks
|
|
14983
14965
|
|
|
14984
14966
|
var middle; // When 0 is inside the interval, 0 should be a tick
|
|
14985
14967
|
|
|
14986
14968
|
if (min <= 0 && max >= 0) {
|
|
14987
|
-
middle = new
|
|
14969
|
+
middle = new Decimal$1(0);
|
|
14988
14970
|
} else {
|
|
14989
14971
|
// calculate the middle value
|
|
14990
|
-
middle = new
|
|
14972
|
+
middle = new Decimal$1(min).add(max).div(2); // minus modulo value
|
|
14991
14973
|
|
|
14992
|
-
middle = middle.sub(new
|
|
14974
|
+
middle = middle.sub(new Decimal$1(middle).mod(step));
|
|
14993
14975
|
}
|
|
14994
14976
|
|
|
14995
14977
|
var belowCount = Math.ceil(middle.sub(min).div(step).toNumber());
|
|
14996
|
-
var upCount = Math.ceil(new
|
|
14978
|
+
var upCount = Math.ceil(new Decimal$1(max).sub(middle).div(step).toNumber());
|
|
14997
14979
|
var scaleCount = belowCount + upCount + 1;
|
|
14998
14980
|
|
|
14999
14981
|
if (scaleCount > tickCount) {
|
|
@@ -15009,8 +14991,8 @@ function calculateStep(min, max, tickCount, allowDecimals) {
|
|
|
15009
14991
|
|
|
15010
14992
|
return {
|
|
15011
14993
|
step: step,
|
|
15012
|
-
tickMin: middle.sub(new
|
|
15013
|
-
tickMax: middle.add(new
|
|
14994
|
+
tickMin: middle.sub(new Decimal$1(belowCount).mul(step)),
|
|
14995
|
+
tickMax: middle.add(new Decimal$1(upCount).mul(step))
|
|
15014
14996
|
};
|
|
15015
14997
|
}
|
|
15016
14998
|
/**
|
|
@@ -15039,13 +15021,13 @@ function getNiceTickValuesFn(_ref3) {
|
|
|
15039
15021
|
cormax = _getValidInterval2[1];
|
|
15040
15022
|
|
|
15041
15023
|
if (cormin === -Infinity || cormax === Infinity) {
|
|
15042
|
-
var _values = cormax === Infinity ? [cormin].concat(_toConsumableArray$4(
|
|
15024
|
+
var _values = cormax === Infinity ? [cormin].concat(_toConsumableArray$4(range$2(0, tickCount - 1).map(function () {
|
|
15043
15025
|
return Infinity;
|
|
15044
|
-
}))) : _toConsumableArray$4(
|
|
15026
|
+
}))) : [].concat(_toConsumableArray$4(range$2(0, tickCount - 1).map(function () {
|
|
15045
15027
|
return -Infinity;
|
|
15046
|
-
}))
|
|
15028
|
+
})), [cormax]);
|
|
15047
15029
|
|
|
15048
|
-
return min > max ?
|
|
15030
|
+
return min > max ? reverse(_values) : _values;
|
|
15049
15031
|
}
|
|
15050
15032
|
|
|
15051
15033
|
if (cormin === cormax) {
|
|
@@ -15058,51 +15040,8 @@ function getNiceTickValuesFn(_ref3) {
|
|
|
15058
15040
|
tickMin = _calculateStep.tickMin,
|
|
15059
15041
|
tickMax = _calculateStep.tickMax;
|
|
15060
15042
|
|
|
15061
|
-
var values =
|
|
15062
|
-
|
|
15063
|
-
return min > max ? (0, _utils.reverse)(values) : values;
|
|
15064
|
-
}
|
|
15065
|
-
/**
|
|
15066
|
-
* Calculate the ticks of an interval, the count of ticks won't be guraranteed
|
|
15067
|
-
*
|
|
15068
|
-
* @param {Number} min, max min: The minimum value, max: The maximum value
|
|
15069
|
-
* @param {Integer} tickCount The count of ticks
|
|
15070
|
-
* @param {Boolean} allowDecimals Allow the ticks to be decimals or not
|
|
15071
|
-
* @return {Array} ticks
|
|
15072
|
-
*/
|
|
15073
|
-
|
|
15074
|
-
|
|
15075
|
-
function getTickValuesFn(_ref5) {
|
|
15076
|
-
var _ref6 = _slicedToArray$2(_ref5, 2),
|
|
15077
|
-
min = _ref6[0],
|
|
15078
|
-
max = _ref6[1];
|
|
15079
|
-
|
|
15080
|
-
var tickCount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 6;
|
|
15081
|
-
var allowDecimals = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
15082
|
-
// More than two ticks should be return
|
|
15083
|
-
var count = Math.max(tickCount, 2);
|
|
15084
|
-
|
|
15085
|
-
var _getValidInterval3 = getValidInterval([min, max]),
|
|
15086
|
-
_getValidInterval4 = _slicedToArray$2(_getValidInterval3, 2),
|
|
15087
|
-
cormin = _getValidInterval4[0],
|
|
15088
|
-
cormax = _getValidInterval4[1];
|
|
15089
|
-
|
|
15090
|
-
if (cormin === -Infinity || cormax === Infinity) {
|
|
15091
|
-
return [min, max];
|
|
15092
|
-
}
|
|
15093
|
-
|
|
15094
|
-
if (cormin === cormax) {
|
|
15095
|
-
return getTickOfSingleValue(cormin, tickCount, allowDecimals);
|
|
15096
|
-
}
|
|
15097
|
-
|
|
15098
|
-
var step = getFormatStep(new _decimal.default(cormax).sub(cormin).div(count - 1), allowDecimals, 0);
|
|
15099
|
-
var fn = (0, _utils.compose)((0, _utils.map)(function (n) {
|
|
15100
|
-
return new _decimal.default(cormin).add(new _decimal.default(n).mul(step)).toNumber();
|
|
15101
|
-
}), _utils.range);
|
|
15102
|
-
var values = fn(0, count).filter(function (entry) {
|
|
15103
|
-
return entry >= cormin && entry <= cormax;
|
|
15104
|
-
});
|
|
15105
|
-
return min > max ? (0, _utils.reverse)(values) : values;
|
|
15043
|
+
var values = Arithmetic.rangeStep(tickMin, tickMax.add(new Decimal$1(0.1).mul(step)), step);
|
|
15044
|
+
return min > max ? reverse(values) : values;
|
|
15106
15045
|
}
|
|
15107
15046
|
/**
|
|
15108
15047
|
* Calculate the ticks of an interval, the count of ticks won't be guraranteed,
|
|
@@ -15137,46 +15076,13 @@ function getTickValuesFixedDomainFn(_ref7, tickCount) {
|
|
|
15137
15076
|
}
|
|
15138
15077
|
|
|
15139
15078
|
var count = Math.max(tickCount, 2);
|
|
15140
|
-
var step = getFormatStep(new
|
|
15141
|
-
|
|
15142
|
-
|
|
15143
|
-
|
|
15144
|
-
return min > max ? (0, _utils.reverse)(values) : values;
|
|
15079
|
+
var step = getFormatStep(new Decimal$1(cormax).sub(cormin).div(count - 1), allowDecimals, 0);
|
|
15080
|
+
var values = [].concat(_toConsumableArray$4(Arithmetic.rangeStep(new Decimal$1(cormin), new Decimal$1(cormax).sub(new Decimal$1(0.99).mul(step)), step)), [cormax]);
|
|
15081
|
+
return min > max ? reverse(values) : values;
|
|
15145
15082
|
}
|
|
15146
15083
|
|
|
15147
|
-
var getNiceTickValues =
|
|
15148
|
-
|
|
15149
|
-
var getTickValues = (0, _utils.memoize)(getTickValuesFn);
|
|
15150
|
-
getNiceTickValues$1.getTickValues = getTickValues;
|
|
15151
|
-
var getTickValuesFixedDomain = (0, _utils.memoize)(getTickValuesFixedDomainFn);
|
|
15152
|
-
getNiceTickValues$1.getTickValuesFixedDomain = getTickValuesFixedDomain;
|
|
15153
|
-
|
|
15154
|
-
(function (exports) {
|
|
15155
|
-
|
|
15156
|
-
Object.defineProperty(exports, "__esModule", {
|
|
15157
|
-
value: true
|
|
15158
|
-
});
|
|
15159
|
-
Object.defineProperty(exports, "getTickValues", {
|
|
15160
|
-
enumerable: true,
|
|
15161
|
-
get: function get() {
|
|
15162
|
-
return _getNiceTickValues.getTickValues;
|
|
15163
|
-
}
|
|
15164
|
-
});
|
|
15165
|
-
Object.defineProperty(exports, "getNiceTickValues", {
|
|
15166
|
-
enumerable: true,
|
|
15167
|
-
get: function get() {
|
|
15168
|
-
return _getNiceTickValues.getNiceTickValues;
|
|
15169
|
-
}
|
|
15170
|
-
});
|
|
15171
|
-
Object.defineProperty(exports, "getTickValuesFixedDomain", {
|
|
15172
|
-
enumerable: true,
|
|
15173
|
-
get: function get() {
|
|
15174
|
-
return _getNiceTickValues.getTickValuesFixedDomain;
|
|
15175
|
-
}
|
|
15176
|
-
});
|
|
15177
|
-
|
|
15178
|
-
var _getNiceTickValues = getNiceTickValues$1;
|
|
15179
|
-
}(lib));
|
|
15084
|
+
var getNiceTickValues = memoize(getNiceTickValuesFn);
|
|
15085
|
+
var getTickValuesFixedDomain = memoize(getTickValuesFixedDomainFn);
|
|
15180
15086
|
|
|
15181
15087
|
function ascending$1(a, b) {
|
|
15182
15088
|
return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
|
|
@@ -19582,7 +19488,7 @@ var getTicksOfScale = function getTicksOfScale(scale, opts) {
|
|
|
19582
19488
|
if (tickCount && type === 'number' && originalDomain && (originalDomain[0] === 'auto' || originalDomain[1] === 'auto')) {
|
|
19583
19489
|
// Calculate the ticks by the number of grid when the axis is a number axis
|
|
19584
19490
|
var domain = scale.domain();
|
|
19585
|
-
var tickValues =
|
|
19491
|
+
var tickValues = getNiceTickValues(domain, tickCount, allowDecimals);
|
|
19586
19492
|
scale.domain(calculateDomainOfTicks(tickValues, type));
|
|
19587
19493
|
return {
|
|
19588
19494
|
niceTicks: tickValues
|
|
@@ -19592,7 +19498,7 @@ var getTicksOfScale = function getTicksOfScale(scale, opts) {
|
|
|
19592
19498
|
if (tickCount && type === 'number') {
|
|
19593
19499
|
var _domain = scale.domain();
|
|
19594
19500
|
|
|
19595
|
-
var _tickValues =
|
|
19501
|
+
var _tickValues = getTickValuesFixedDomain(_domain, tickCount, allowDecimals);
|
|
19596
19502
|
|
|
19597
19503
|
return {
|
|
19598
19504
|
niceTicks: _tickValues
|
|
@@ -27092,128 +26998,6 @@ var RechartsBarChart = generateCategoricalChart({
|
|
|
27092
26998
|
formatAxisMap: formatAxisMap
|
|
27093
26999
|
});
|
|
27094
27000
|
|
|
27095
|
-
var fontFamily = "Source Sans Pro,Helvetica,Arial,sans-serif";
|
|
27096
|
-
/**
|
|
27097
|
-
* Creates a percentage axis tick on the X axis with proper styling.
|
|
27098
|
-
* Can be passed to tick in the XAxis Recharts component within SpsBarChart.
|
|
27099
|
-
* @param payload - Payload containing value to be displayed, provided by Recharts.
|
|
27100
|
-
* @param x - X value for placement on the SVG, provided by Recharts.
|
|
27101
|
-
* @param y - Y value for placement on the SVG, provided by Recharts.
|
|
27102
|
-
*/
|
|
27103
|
-
var PercentXAxisTick = function (_a) {
|
|
27104
|
-
var payload = _a.payload, x = _a.x, y = _a.y;
|
|
27105
|
-
return (React.createElement(Text, { verticalAnchor: "start", width: 30, height: 30, x: x, y: y, stroke: "none", textAnchor: "middle", style: {
|
|
27106
|
-
fill: colors.gray500,
|
|
27107
|
-
fontFamily: fontFamily,
|
|
27108
|
-
fontWeight: 400,
|
|
27109
|
-
} }, payload.value.toString() + "%"));
|
|
27110
|
-
};
|
|
27111
|
-
/**
|
|
27112
|
-
* Creates axis tick on the X axis with proper styling.
|
|
27113
|
-
* Can be passed to tick in the XAxis Recharts component within SpsBarChart.
|
|
27114
|
-
* Is the default X Axis tick in SpsBarChart.
|
|
27115
|
-
* @param payload - Payload containing value to be displayed, provided by Recharts.
|
|
27116
|
-
* @param x - X value for placement on the SVG, provided by Recharts.
|
|
27117
|
-
* @param y - Y value for placement on the SVG, provided by Recharts.
|
|
27118
|
-
*/
|
|
27119
|
-
var SpsDefaultXAxisTick = function (_a) {
|
|
27120
|
-
var payload = _a.payload, x = _a.x, y = _a.y;
|
|
27121
|
-
return (React.createElement("text", { x: x, y: y, dy: "0.75rem", stroke: "none", textAnchor: "middle", style: {
|
|
27122
|
-
fill: colors.gray500,
|
|
27123
|
-
fontFamily: fontFamily,
|
|
27124
|
-
fontWeight: 400,
|
|
27125
|
-
}, className: "default-x-axis" }, payload.value.toString()));
|
|
27126
|
-
};
|
|
27127
|
-
/**
|
|
27128
|
-
* Creates axis tick on the Y axis with proper styling.
|
|
27129
|
-
* Can be passed to tick in the YAxis Recharts component within SpsBarChart.
|
|
27130
|
-
* Is the default Y Axis tick in SpsBarChart
|
|
27131
|
-
* @param payload - Payload containing value to be displayed, provided by Recharts.
|
|
27132
|
-
* @param x - X value for placement on the SVG, provided by Recharts.
|
|
27133
|
-
* @param y - Y value for placement on the SVG, provided by Recharts.
|
|
27134
|
-
*/
|
|
27135
|
-
var SpsDefaultYAxisTick = function (_a) {
|
|
27136
|
-
var payload = _a.payload, x = _a.x, y = _a.y;
|
|
27137
|
-
return (React.createElement("text", { x: x, y: y, stroke: "none", textAnchor: "end", style: {
|
|
27138
|
-
fill: colors.gray500,
|
|
27139
|
-
fontFamily: fontFamily,
|
|
27140
|
-
fontWeight: 500,
|
|
27141
|
-
}, className: "default-y-axis" }, payload.value.toString()));
|
|
27142
|
-
};
|
|
27143
|
-
/**
|
|
27144
|
-
* The tooltip for each bar rendered with proper styling.
|
|
27145
|
-
* Is passed into the toolTipWrapper from the ToolTipHandler.
|
|
27146
|
-
* Is the default customTooltip in SpsBarChart
|
|
27147
|
-
* @param descriptions - Array containing any toolTip content wanted.
|
|
27148
|
-
* Each entry is a new line.
|
|
27149
|
-
* @param label - Title of the toolTip, comes from the label provided in the ChartData.
|
|
27150
|
-
* @param width - Calculated width of the toolTip for positioning of the caret.
|
|
27151
|
-
*/
|
|
27152
|
-
var SpsDefaultChartTooltip = function (_a) {
|
|
27153
|
-
var descriptions = _a.descriptions, label = _a.label, width = _a.width;
|
|
27154
|
-
return (React.createElement("div", { style: {
|
|
27155
|
-
backgroundColor: colors.gray600,
|
|
27156
|
-
color: colors.white,
|
|
27157
|
-
fontSize: "0.875rem",
|
|
27158
|
-
width: "auto",
|
|
27159
|
-
height: "auto",
|
|
27160
|
-
padding: "1.25rem",
|
|
27161
|
-
borderRadius: ".1875rem",
|
|
27162
|
-
whiteSpace: "normal",
|
|
27163
|
-
} },
|
|
27164
|
-
React.createElement("span", { className: "sps-tooltip__title d-block" }, label),
|
|
27165
|
-
descriptions &&
|
|
27166
|
-
descriptions.map(function (data, index) {
|
|
27167
|
-
return (React.createElement("span", { key: index, className: "sps-tooltip__body d-block" }, data));
|
|
27168
|
-
}),
|
|
27169
|
-
React.createElement("span", { className: "sps-tooltip__caret", style: { bottom: "-0.313rem", left: width / 2 - 5 } })));
|
|
27170
|
-
};
|
|
27171
|
-
/**
|
|
27172
|
-
* Wraps the toolTip in a foreign object so HTML elements can be displayed and
|
|
27173
|
-
* positioned within the SVG. Calculates the width of the toolTip for positioning
|
|
27174
|
-
* relative to the corresponding bar.
|
|
27175
|
-
* @param x - X value of the corresponding bar.
|
|
27176
|
-
* @param barWidth - Width of corresponding bar, in px.
|
|
27177
|
-
* @param y - Y value of the corresponding bar.
|
|
27178
|
-
* @param isHorizontalBarChart - Whether or not the toolTip position should
|
|
27179
|
-
* be calculated for a horizontal graph.
|
|
27180
|
-
* @param customToolTip - Custom Tooltip to be wrapped and rendered.
|
|
27181
|
-
* @param chartData - Data to be provided to the toolTip
|
|
27182
|
-
*/
|
|
27183
|
-
var ToolTipWrapper = function (_a) {
|
|
27184
|
-
var x = _a.x, barWidth = _a.barWidth, y = _a.y, isHorizontalBarChart = _a.isHorizontalBarChart, customToolTip = _a.customToolTip, chartData = _a.chartData;
|
|
27185
|
-
var toolTip = useRef(null);
|
|
27186
|
-
var _b = __read(useState(0), 2), toolTipWidth = _b[0], setToolTipWidth = _b[1];
|
|
27187
|
-
useEffect(function () {
|
|
27188
|
-
var width = toolTip.current ? toolTip.current.offsetWidth : 0;
|
|
27189
|
-
setToolTipWidth(width);
|
|
27190
|
-
}, [toolTip.current]);
|
|
27191
|
-
if (isHorizontalBarChart) {
|
|
27192
|
-
return (React.createElement("g", null,
|
|
27193
|
-
React.createElement("foreignObject", { height: 300, width: 300, x: x + barWidth - toolTipWidth / 2, y: y - 300, textAnchor: "middle", style: { position: "relative" } },
|
|
27194
|
-
React.createElement("div", { style: {
|
|
27195
|
-
position: "absolute",
|
|
27196
|
-
bottom: "0.625rem",
|
|
27197
|
-
}, ref: toolTip }, React.cloneElement(customToolTip, {
|
|
27198
|
-
descriptions: chartData.descriptions,
|
|
27199
|
-
label: chartData.label,
|
|
27200
|
-
width: toolTipWidth,
|
|
27201
|
-
})))));
|
|
27202
|
-
}
|
|
27203
|
-
else {
|
|
27204
|
-
return (React.createElement("g", null,
|
|
27205
|
-
React.createElement("foreignObject", { height: 300, width: 300, x: x + barWidth / 2 - toolTipWidth / 2, y: y - 300, textAnchor: "middle", style: { position: "relative" } },
|
|
27206
|
-
React.createElement("div", { style: {
|
|
27207
|
-
position: "absolute",
|
|
27208
|
-
bottom: "0.625rem",
|
|
27209
|
-
}, ref: toolTip }, React.cloneElement(customToolTip, {
|
|
27210
|
-
descriptions: chartData.descriptions,
|
|
27211
|
-
label: chartData.label,
|
|
27212
|
-
width: toolTipWidth,
|
|
27213
|
-
})))));
|
|
27214
|
-
}
|
|
27215
|
-
};
|
|
27216
|
-
|
|
27217
27001
|
var noop = {value: function() {}};
|
|
27218
27002
|
|
|
27219
27003
|
function dispatch() {
|
|
@@ -29123,6 +28907,124 @@ function selection_transition(name) {
|
|
|
29123
28907
|
selection.prototype.interrupt = selection_interrupt;
|
|
29124
28908
|
selection.prototype.transition = selection_transition;
|
|
29125
28909
|
|
|
28910
|
+
var fontFamily = 'Source Sans Pro,Helvetica,Arial,sans-serif';
|
|
28911
|
+
/**
|
|
28912
|
+
* Creates a percentage axis tick on the X axis with proper styling.
|
|
28913
|
+
* Can be passed to tick in the XAxis Recharts component within SpsBarChart.
|
|
28914
|
+
* @param payload - Payload containing value to be displayed, provided by Recharts.
|
|
28915
|
+
* @param x - X value for placement on the SVG, provided by Recharts.
|
|
28916
|
+
* @param y - Y value for placement on the SVG, provided by Recharts.
|
|
28917
|
+
*/
|
|
28918
|
+
var PercentXAxisTick = function (_a) {
|
|
28919
|
+
var payload = _a.payload, x = _a.x, y = _a.y;
|
|
28920
|
+
return (React.createElement(Text, { verticalAnchor: "start", width: 30, height: 30, x: x, y: y, stroke: "none", textAnchor: "middle", style: {
|
|
28921
|
+
fill: colors.gray500,
|
|
28922
|
+
fontFamily: fontFamily,
|
|
28923
|
+
fontWeight: 400,
|
|
28924
|
+
} }, payload.value.toString() + "%"));
|
|
28925
|
+
};
|
|
28926
|
+
/**
|
|
28927
|
+
* Creates axis tick on the X axis with proper styling.
|
|
28928
|
+
* Can be passed to tick in the XAxis Recharts component within SpsBarChart.
|
|
28929
|
+
* Is the default X Axis tick in SpsBarChart.
|
|
28930
|
+
* @param payload - Payload containing value to be displayed, provided by Recharts.
|
|
28931
|
+
* @param x - X value for placement on the SVG, provided by Recharts.
|
|
28932
|
+
* @param y - Y value for placement on the SVG, provided by Recharts.
|
|
28933
|
+
*/
|
|
28934
|
+
var SpsDefaultXAxisTick = function (_a) {
|
|
28935
|
+
var payload = _a.payload, x = _a.x, y = _a.y;
|
|
28936
|
+
return (React.createElement("text", { x: x, y: y, dy: "0.75rem", stroke: "none", textAnchor: "middle", style: {
|
|
28937
|
+
fill: colors.gray500,
|
|
28938
|
+
fontFamily: fontFamily,
|
|
28939
|
+
fontWeight: 400,
|
|
28940
|
+
}, className: "default-x-axis" }, payload.value.toString()));
|
|
28941
|
+
};
|
|
28942
|
+
/**
|
|
28943
|
+
* Creates axis tick on the Y axis with proper styling.
|
|
28944
|
+
* Can be passed to tick in the YAxis Recharts component within SpsBarChart.
|
|
28945
|
+
* Is the default Y Axis tick in SpsBarChart
|
|
28946
|
+
* @param payload - Payload containing value to be displayed, provided by Recharts.
|
|
28947
|
+
* @param x - X value for placement on the SVG, provided by Recharts.
|
|
28948
|
+
* @param y - Y value for placement on the SVG, provided by Recharts.
|
|
28949
|
+
*/
|
|
28950
|
+
var SpsDefaultYAxisTick = function (_a) {
|
|
28951
|
+
var payload = _a.payload, x = _a.x, y = _a.y;
|
|
28952
|
+
return (React.createElement("text", { x: x, y: y, stroke: "none", textAnchor: "end", style: {
|
|
28953
|
+
fill: colors.gray500,
|
|
28954
|
+
fontFamily: fontFamily,
|
|
28955
|
+
fontWeight: 500,
|
|
28956
|
+
}, className: "default-y-axis" }, payload.value.toString()));
|
|
28957
|
+
};
|
|
28958
|
+
/**
|
|
28959
|
+
* The tooltip for each bar rendered with proper styling.
|
|
28960
|
+
* Is passed into the toolTipWrapper from the ToolTipHandler.
|
|
28961
|
+
* Is the default customTooltip in SpsBarChart
|
|
28962
|
+
* @param descriptions - Array containing any toolTip content wanted.
|
|
28963
|
+
* Each entry is a new line.
|
|
28964
|
+
* @param label - Title of the toolTip, comes from the label provided in the ChartData.
|
|
28965
|
+
* @param width - Calculated width of the toolTip for positioning of the caret.
|
|
28966
|
+
*/
|
|
28967
|
+
var SpsDefaultChartTooltip = function (_a) {
|
|
28968
|
+
var descriptions = _a.descriptions, label = _a.label, width = _a.width;
|
|
28969
|
+
return (React.createElement("div", { style: {
|
|
28970
|
+
backgroundColor: colors.gray600,
|
|
28971
|
+
color: colors.white,
|
|
28972
|
+
fontSize: '0.875rem',
|
|
28973
|
+
width: 'auto',
|
|
28974
|
+
height: 'auto',
|
|
28975
|
+
padding: '1.25rem',
|
|
28976
|
+
borderRadius: '.1875rem',
|
|
28977
|
+
whiteSpace: 'normal',
|
|
28978
|
+
} },
|
|
28979
|
+
React.createElement("span", { className: "sps-tooltip__title d-block" }, label),
|
|
28980
|
+
descriptions
|
|
28981
|
+
&& descriptions.map(function (data, index) { return (React.createElement("span", { key: index, className: "sps-tooltip__body d-block" }, data)); }),
|
|
28982
|
+
React.createElement("span", { className: "sps-tooltip__caret", style: { bottom: '-0.313rem', left: width / 2 - 5 } })));
|
|
28983
|
+
};
|
|
28984
|
+
/**
|
|
28985
|
+
* Wraps the toolTip in a foreign object so HTML elements can be displayed and
|
|
28986
|
+
* positioned within the SVG. Calculates the width of the toolTip for positioning
|
|
28987
|
+
* relative to the corresponding bar.
|
|
28988
|
+
* @param x - X value of the corresponding bar.
|
|
28989
|
+
* @param barWidth - Width of corresponding bar, in px.
|
|
28990
|
+
* @param y - Y value of the corresponding bar.
|
|
28991
|
+
* @param isHorizontalBarChart - Whether or not the toolTip position should
|
|
28992
|
+
* be calculated for a horizontal graph.
|
|
28993
|
+
* @param customToolTip - Custom Tooltip to be wrapped and rendered.
|
|
28994
|
+
* @param chartData - Data to be provided to the toolTip
|
|
28995
|
+
*/
|
|
28996
|
+
var ToolTipWrapper = function (_a) {
|
|
28997
|
+
var x = _a.x, barWidth = _a.barWidth, y = _a.y, isHorizontalBarChart = _a.isHorizontalBarChart, customToolTip = _a.customToolTip, chartData = _a.chartData;
|
|
28998
|
+
var toolTip = useRef(null);
|
|
28999
|
+
var _b = __read(useState(0), 2), toolTipWidth = _b[0], setToolTipWidth = _b[1];
|
|
29000
|
+
useEffect(function () {
|
|
29001
|
+
var width = toolTip.current ? toolTip.current.offsetWidth : 0;
|
|
29002
|
+
setToolTipWidth(width);
|
|
29003
|
+
}, [toolTip.current]);
|
|
29004
|
+
if (isHorizontalBarChart) {
|
|
29005
|
+
return (React.createElement("g", null,
|
|
29006
|
+
React.createElement("foreignObject", { height: 300, width: 300, x: x + barWidth - toolTipWidth / 2, y: y - 300, textAnchor: "middle", style: { position: 'relative' } },
|
|
29007
|
+
React.createElement("div", { style: {
|
|
29008
|
+
position: 'absolute',
|
|
29009
|
+
bottom: '0.625rem',
|
|
29010
|
+
}, ref: toolTip }, React.cloneElement(customToolTip, {
|
|
29011
|
+
descriptions: chartData.descriptions,
|
|
29012
|
+
label: chartData.label,
|
|
29013
|
+
width: toolTipWidth,
|
|
29014
|
+
})))));
|
|
29015
|
+
}
|
|
29016
|
+
return (React.createElement("g", null,
|
|
29017
|
+
React.createElement("foreignObject", { height: 300, width: 300, x: x + barWidth / 2 - toolTipWidth / 2, y: y - 300, textAnchor: "middle", style: { position: 'relative' } },
|
|
29018
|
+
React.createElement("div", { style: {
|
|
29019
|
+
position: 'absolute',
|
|
29020
|
+
bottom: '0.625rem',
|
|
29021
|
+
}, ref: toolTip }, React.cloneElement(customToolTip, {
|
|
29022
|
+
descriptions: chartData.descriptions,
|
|
29023
|
+
label: chartData.label,
|
|
29024
|
+
width: toolTipWidth,
|
|
29025
|
+
})))));
|
|
29026
|
+
};
|
|
29027
|
+
|
|
29126
29028
|
var defaultLineHeight = 1.1; // ems,
|
|
29127
29029
|
var defaultDY = 0.275; // ems
|
|
29128
29030
|
var twoLinesDY = defaultDY * -1;
|
|
@@ -29140,39 +29042,41 @@ var wrapText = function (textGroup, width, isYAxis) {
|
|
|
29140
29042
|
textGroup.each(function () {
|
|
29141
29043
|
var text = select(this);
|
|
29142
29044
|
var words = text.text().split(/\s+/).reverse();
|
|
29143
|
-
var word
|
|
29045
|
+
var word;
|
|
29046
|
+
var line = [];
|
|
29047
|
+
var lineNumber = 0;
|
|
29144
29048
|
var lineNumberLimit = isYAxis ? 2 : 3;
|
|
29145
29049
|
var lineHeight = defaultLineHeight;
|
|
29146
|
-
var x = text.attr(
|
|
29147
|
-
var y = text.attr(
|
|
29148
|
-
var dy = parseFloat(text.attr(
|
|
29050
|
+
var x = text.attr('x') ? text.attr('x') : 0;
|
|
29051
|
+
var y = text.attr('y') ? text.attr('y') : 0;
|
|
29052
|
+
var dy = parseFloat(text.attr('dy')) || defaultDY;
|
|
29149
29053
|
var tspan = text
|
|
29150
29054
|
.text(null)
|
|
29151
|
-
.append(
|
|
29152
|
-
.attr(
|
|
29153
|
-
.attr(
|
|
29154
|
-
.attr(
|
|
29155
|
-
.attr(
|
|
29055
|
+
.append('tspan')
|
|
29056
|
+
.attr('x', x)
|
|
29057
|
+
.attr('y', y)
|
|
29058
|
+
.attr('dy', dy + "em")
|
|
29059
|
+
.attr('anchor', isYAxis ? 'end' : 'middle');
|
|
29156
29060
|
while ((word = words.pop())) {
|
|
29157
29061
|
line.push(word);
|
|
29158
|
-
tspan.text(line.join(
|
|
29159
|
-
if (tspan
|
|
29160
|
-
tspan.node().getBoundingClientRect()
|
|
29161
|
-
tspan.node().getBoundingClientRect().width > width
|
|
29162
|
-
line.length > 1) {
|
|
29062
|
+
tspan.text(line.join(' '));
|
|
29063
|
+
if (tspan
|
|
29064
|
+
&& tspan.node().getBoundingClientRect()
|
|
29065
|
+
&& tspan.node().getBoundingClientRect().width > width
|
|
29066
|
+
&& line.length > 1) {
|
|
29163
29067
|
line.pop();
|
|
29164
29068
|
if (lineNumber >= lineNumberLimit) {
|
|
29165
|
-
tspan.text(line.join(
|
|
29069
|
+
tspan.text(line.join(' ') + "...");
|
|
29166
29070
|
break;
|
|
29167
29071
|
}
|
|
29168
|
-
tspan.text(line.join(
|
|
29072
|
+
tspan.text(line.join(' '));
|
|
29169
29073
|
line = [word];
|
|
29170
29074
|
tspan = text
|
|
29171
|
-
.append(
|
|
29172
|
-
.attr(
|
|
29173
|
-
.attr(
|
|
29174
|
-
.attr(
|
|
29175
|
-
.attr(
|
|
29075
|
+
.append('tspan')
|
|
29076
|
+
.attr('x', x)
|
|
29077
|
+
.attr('y', y)
|
|
29078
|
+
.attr('dy', (++lineNumber * lineHeight + dy).toFixed(3) + "em")
|
|
29079
|
+
.attr('anchor', isYAxis ? 'end' : 'middle')
|
|
29176
29080
|
.text(lineNumber === lineNumberLimit && words.length > 0 ? word + "..." : word);
|
|
29177
29081
|
}
|
|
29178
29082
|
}
|
|
@@ -29190,11 +29094,9 @@ var adjustAxisDY = function (textGroup, textHeight) {
|
|
|
29190
29094
|
var height = text.node().getBoundingClientRect && text.node().getBoundingClientRect().height;
|
|
29191
29095
|
var startDY = height > textHeight * 3 ? threeLinesDY : twoLinesDY;
|
|
29192
29096
|
if (height > textHeight * 2) {
|
|
29193
|
-
text.selectAll(
|
|
29194
|
-
|
|
29195
|
-
|
|
29196
|
-
: (startDY + i * defaultLineHeight).toFixed(3) + "em";
|
|
29197
|
-
});
|
|
29097
|
+
text.selectAll('tspan').attr('dy', function (d, i) { return (i === 0
|
|
29098
|
+
? startDY + "em"
|
|
29099
|
+
: (startDY + i * defaultLineHeight).toFixed(3) + "em"); });
|
|
29198
29100
|
}
|
|
29199
29101
|
});
|
|
29200
29102
|
};
|
|
@@ -29209,78 +29111,78 @@ var adjustAxisDY = function (textGroup, textHeight) {
|
|
|
29209
29111
|
* gradients if multiple charts are rendered on a single page
|
|
29210
29112
|
*/
|
|
29211
29113
|
var gradientCalculator = function (defs, data, isHorizontal, fillColor, identifier) {
|
|
29212
|
-
var max = Math.max.apply(Math,
|
|
29114
|
+
var max = Math.max.apply(Math, __spreadArray([], __read(data.map(function (a) { return a.value; }))));
|
|
29213
29115
|
data.forEach(function (element, index) {
|
|
29214
29116
|
var valueDividedByMax = isNaN(element.value / max) ? 0 : element.value / max;
|
|
29215
29117
|
if (isHorizontal) {
|
|
29216
29118
|
var linearGradient = defs
|
|
29217
|
-
.append(
|
|
29218
|
-
.attr(
|
|
29119
|
+
.append('linearGradient')
|
|
29120
|
+
.attr('id', "gradient-" + identifier + "-" + index);
|
|
29219
29121
|
linearGradient
|
|
29220
|
-
.append(
|
|
29221
|
-
.attr(
|
|
29222
|
-
.attr(
|
|
29223
|
-
.attr(
|
|
29122
|
+
.append('stop')
|
|
29123
|
+
.attr('stop-color', fillColor)
|
|
29124
|
+
.attr('offset', '0%')
|
|
29125
|
+
.attr('stop-opacity', 0.5);
|
|
29224
29126
|
linearGradient
|
|
29225
|
-
.append(
|
|
29226
|
-
.attr(
|
|
29227
|
-
.attr(
|
|
29228
|
-
.attr(
|
|
29127
|
+
.append('stop')
|
|
29128
|
+
.attr('stop-color', fillColor)
|
|
29129
|
+
.attr('offset', '100%')
|
|
29130
|
+
.attr('stop-opacity', Math.max(0.5, valueDividedByMax));
|
|
29229
29131
|
}
|
|
29230
29132
|
else {
|
|
29231
29133
|
var linearGradient = defs
|
|
29232
|
-
.append(
|
|
29233
|
-
.attr(
|
|
29234
|
-
.attr(
|
|
29134
|
+
.append('linearGradient')
|
|
29135
|
+
.attr('id', "gradient-" + identifier + "-" + index)
|
|
29136
|
+
.attr('gradientTransform', 'rotate(90)');
|
|
29235
29137
|
linearGradient
|
|
29236
|
-
.append(
|
|
29237
|
-
.attr(
|
|
29238
|
-
.attr(
|
|
29239
|
-
.attr(
|
|
29138
|
+
.append('stop')
|
|
29139
|
+
.attr('stop-color', fillColor)
|
|
29140
|
+
.attr('offset', '0%')
|
|
29141
|
+
.attr('stop-opacity', Math.max(0.5, valueDividedByMax));
|
|
29240
29142
|
linearGradient
|
|
29241
|
-
.append(
|
|
29242
|
-
.attr(
|
|
29243
|
-
.attr(
|
|
29244
|
-
.attr(
|
|
29143
|
+
.append('stop')
|
|
29144
|
+
.attr('stop-color', fillColor)
|
|
29145
|
+
.attr('offset', Math.max(50, valueDividedByMax * 100) + "%")
|
|
29146
|
+
.attr('stop-opacity', 0.5);
|
|
29245
29147
|
linearGradient
|
|
29246
|
-
.append(
|
|
29247
|
-
.attr(
|
|
29248
|
-
.attr(
|
|
29249
|
-
.attr(
|
|
29148
|
+
.append('stop')
|
|
29149
|
+
.attr('stop-color', fillColor)
|
|
29150
|
+
.attr('offset', '100%')
|
|
29151
|
+
.attr('stop-opacity', 0.5);
|
|
29250
29152
|
}
|
|
29251
29153
|
});
|
|
29252
29154
|
};
|
|
29253
29155
|
|
|
29254
29156
|
var SpsBarChart = function (_a) {
|
|
29255
|
-
var xAxis = _a.xAxis, yAxis = _a.yAxis, chartData = _a.chartData, chartHeight = _a.chartHeight, identifier = _a.identifier, chartWidth = _a.chartWidth, _b = _a.isHorizontalBarChart, isHorizontalBarChart = _b === void 0 ? false : _b, _c = _a.customXAxis, customXAxis = _c === void 0 ? React.createElement(SpsDefaultXAxisTick, null) : _c, _d = _a.customYAxis, customYAxis = _d === void 0 ? React.createElement(SpsDefaultYAxisTick, null) : _d, _e = _a.barFillColor, barFillColor = _e === void 0 ? colors.blue200 : _e, _f = _a.customToolTip, customToolTip = _f === void 0 ? React.createElement(SpsDefaultChartTooltip, null) : _f, _g = _a.barSize, barSize = _g === void 0 ? 40 : _g, _h = _a.barCategoryGap, barCategoryGap = _h === void 0 ? 20 : _h, _j = _a.margins, margins = _j === void 0 ? {
|
|
29157
|
+
var xAxis = _a.xAxis, yAxis = _a.yAxis, chartData = _a.chartData, chartHeight = _a.chartHeight, identifier = _a.identifier, chartWidth = _a.chartWidth, _b = _a.isHorizontalBarChart, isHorizontalBarChart = _b === void 0 ? false : _b, _c = _a.customXAxis, customXAxis = _c === void 0 ? React.createElement(SpsDefaultXAxisTick, null) : _c, _d = _a.customYAxis, customYAxis = _d === void 0 ? React.createElement(SpsDefaultYAxisTick, null) : _d, _e = _a.barFillColor, barFillColor = _e === void 0 ? colors.blue200 : _e, _f = _a.customToolTip, customToolTip = _f === void 0 ? React.createElement(SpsDefaultChartTooltip, null) : _f, _g = _a.barSize, barSize = _g === void 0 ? 40 : _g, _h = _a.barCategoryGap, barCategoryGap = _h === void 0 ? 20 : _h, _j = _a.margins, margins = _j === void 0 ? {
|
|
29158
|
+
bottom: 30, left: 0, top: 40, right: 10,
|
|
29159
|
+
} : _j, _k = _a.barHoverFill, barHoverFill = _k === void 0 ? colors.blue300 : _k;
|
|
29256
29160
|
var _l = __read(useState(null), 2), isToolTipActive = _l[0], setIsToolTipActive = _l[1];
|
|
29257
29161
|
var defaultTextHeight = 12; // px
|
|
29258
29162
|
var leftMarginSpacing = 20; // px
|
|
29259
29163
|
useEffect(function () {
|
|
29260
29164
|
select("#" + identifier)
|
|
29261
|
-
.select(
|
|
29262
|
-
.selectAll(
|
|
29165
|
+
.select('.recharts-surface')
|
|
29166
|
+
.selectAll('.default-y-axis')
|
|
29263
29167
|
.call(wrapText, margins.left + leftMarginSpacing, isHorizontalBarChart);
|
|
29264
29168
|
select("#" + identifier)
|
|
29265
|
-
.select(
|
|
29266
|
-
.selectAll(
|
|
29169
|
+
.select('.recharts-surface')
|
|
29170
|
+
.selectAll('.default-y-axis')
|
|
29267
29171
|
.call(adjustAxisDY, defaultTextHeight);
|
|
29268
29172
|
select("#" + identifier)
|
|
29269
|
-
.select(
|
|
29270
|
-
.selectAll(
|
|
29173
|
+
.select('.recharts-surface')
|
|
29174
|
+
.selectAll('.default-x-axis')
|
|
29271
29175
|
.call(wrapText, barSize, isHorizontalBarChart);
|
|
29272
29176
|
select("#" + identifier)
|
|
29273
|
-
.select(
|
|
29274
|
-
.append(
|
|
29177
|
+
.select('.recharts-surface')
|
|
29178
|
+
.append('defs')
|
|
29275
29179
|
.call(gradientCalculator, chartData, isHorizontalBarChart, barFillColor, identifier);
|
|
29276
29180
|
}, [chartData, barFillColor, isHorizontalBarChart, barSize, margins.left, identifier]);
|
|
29277
29181
|
/**
|
|
29278
29182
|
* Grabs the generated gradient for the bar from the SVG defs.
|
|
29279
29183
|
* @param index - Index of bar, used to grab correct gradient
|
|
29280
29184
|
*/
|
|
29281
|
-
var getGradient = function (index) {
|
|
29282
|
-
return "url(#gradient-" + identifier + "-" + index + ")";
|
|
29283
|
-
};
|
|
29185
|
+
var getGradient = function (index) { return "url(#gradient-" + identifier + "-" + index + ")"; };
|
|
29284
29186
|
/**
|
|
29285
29187
|
* Handler to render the toolTipWrapper on mouse over of corresponding bar.
|
|
29286
29188
|
* @param index - Index of bar, used to identify active bar and provide
|
|
@@ -29297,29 +29199,27 @@ var SpsBarChart = function (_a) {
|
|
|
29297
29199
|
};
|
|
29298
29200
|
return (React.createElement("div", { className: "sps-chart" },
|
|
29299
29201
|
React.createElement("div", { id: identifier },
|
|
29300
|
-
React.createElement(RechartsBarChart, { data: chartData, layout: isHorizontalBarChart ?
|
|
29202
|
+
React.createElement(RechartsBarChart, { data: chartData, layout: isHorizontalBarChart ? 'vertical' : 'horizontal', barSize: barSize, barCategoryGap: barCategoryGap, margin: margins, height: chartHeight, width: chartWidth },
|
|
29301
29203
|
React.createElement(CartesianGrid, { vertical: isHorizontalBarChart, horizontal: !isHorizontalBarChart, stroke: colors.gray300 }),
|
|
29302
|
-
React.createElement(XAxis, { dataKey: isHorizontalBarChart ?
|
|
29303
|
-
React.createElement(YAxis, { dataKey: isHorizontalBarChart ?
|
|
29204
|
+
React.createElement(XAxis, { dataKey: isHorizontalBarChart ? 'value' : 'label', type: xAxis.type, domain: xAxis.domain, ticks: xAxis.tickValues, tickCount: xAxis.tickCount, tick: customXAxis, allowDataOverflow: false, interval: 0, tickLine: false, stroke: colors.gray300 }),
|
|
29205
|
+
React.createElement(YAxis, { dataKey: isHorizontalBarChart ? 'label' : 'value', type: yAxis.type, domain: yAxis.domain, ticks: yAxis.tickValues, tickCount: yAxis.tickCount, tick: customYAxis, allowDataOverflow: false, interval: 0, tickLine: false, stroke: colors.gray300 }),
|
|
29304
29206
|
React.createElement(Bar, { dataKey: "value", radius: isHorizontalBarChart ? [0, 4, 4, 0] : [4, 4, 0, 0], background: isHorizontalBarChart && {
|
|
29305
29207
|
fill: colors.gray200,
|
|
29306
|
-
opacity:
|
|
29208
|
+
opacity: '.6',
|
|
29307
29209
|
}, onMouseEnter: function (props, index) {
|
|
29308
29210
|
setIsToolTipActive(index);
|
|
29309
29211
|
}, onMouseLeave: function () {
|
|
29310
29212
|
setIsToolTipActive(null);
|
|
29311
29213
|
} },
|
|
29312
|
-
chartData.map(function (entry, index) {
|
|
29313
|
-
|
|
29314
|
-
|
|
29315
|
-
: getGradient(index) }));
|
|
29316
|
-
}),
|
|
29214
|
+
chartData.map(function (entry, index) { return (React.createElement(Cell, { cursor: "pointer", key: "cell-" + index, fill: index === isToolTipActive
|
|
29215
|
+
? barHoverFill
|
|
29216
|
+
: getGradient(index) })); }),
|
|
29317
29217
|
React.createElement(LabelList, { dataKey: "label", content: ToolTipHandler }))))));
|
|
29318
29218
|
};
|
|
29319
29219
|
|
|
29320
29220
|
var SpsBarChartExamples = {
|
|
29321
29221
|
vertical: {
|
|
29322
|
-
label:
|
|
29222
|
+
label: 'Vertical',
|
|
29323
29223
|
description: code(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n <p>Vertical bar chart example.</p>\n "], ["\n <p>Vertical bar chart example.</p>\n "]))),
|
|
29324
29224
|
examples: {
|
|
29325
29225
|
vertical: {
|
|
@@ -29330,4 +29230,11 @@ var SpsBarChartExamples = {
|
|
|
29330
29230
|
};
|
|
29331
29231
|
var templateObject_1, templateObject_2;
|
|
29332
29232
|
|
|
29333
|
-
|
|
29233
|
+
var MANIFEST = {
|
|
29234
|
+
'Bar Chart': {
|
|
29235
|
+
components: [SpsBarChart],
|
|
29236
|
+
examples: SpsBarChartExamples,
|
|
29237
|
+
},
|
|
29238
|
+
};
|
|
29239
|
+
|
|
29240
|
+
export { MANIFEST, PercentXAxisTick, SpsBarChart, SpsBarChartExamples, SpsDefaultChartTooltip, SpsDefaultXAxisTick, SpsDefaultYAxisTick };
|