victory-legend 37.1.2 → 37.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/CHANGELOG.md +8 -0
- package/dist/victory-legend.js +209 -82
- package/dist/victory-legend.min.js +1 -1
- package/es/helper-methods.js +3 -2
- package/lib/helper-methods.js +3 -2
- package/package.json +2 -2
- package/src/helper-methods.ts +2 -2
package/CHANGELOG.md
CHANGED
package/dist/victory-legend.js
CHANGED
|
@@ -38,9 +38,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
38
38
|
|
|
39
39
|
const getColorScale = props => {
|
|
40
40
|
const {
|
|
41
|
-
colorScale
|
|
41
|
+
colorScale,
|
|
42
|
+
theme
|
|
42
43
|
} = props;
|
|
43
|
-
return typeof colorScale === "string" ? victory_core__WEBPACK_IMPORTED_MODULE_3__.getColorScale(colorScale) : colorScale || [];
|
|
44
|
+
return typeof colorScale === "string" ? victory_core__WEBPACK_IMPORTED_MODULE_3__.getColorScale(colorScale, theme) : colorScale || [];
|
|
44
45
|
};
|
|
45
46
|
const getLabelStyles = props => {
|
|
46
47
|
const {
|
|
@@ -6178,31 +6179,34 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
6178
6179
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
6179
6180
|
/* harmony export */ "VictoryPortal": function() { return /* binding */ VictoryPortal; }
|
|
6180
6181
|
/* harmony export */ });
|
|
6181
|
-
/* harmony import */ var
|
|
6182
|
-
/* harmony import */ var
|
|
6183
|
-
/* harmony import */ var
|
|
6184
|
-
/* harmony import */ var
|
|
6185
|
-
/* harmony import */ var
|
|
6186
|
-
/* harmony import */ var
|
|
6187
|
-
/* harmony import */ var
|
|
6182
|
+
/* harmony import */ var lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash/uniqueId */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/uniqueId.js");
|
|
6183
|
+
/* harmony import */ var lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0__);
|
|
6184
|
+
/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash/defaults */ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/defaults.js");
|
|
6185
|
+
/* harmony import */ var lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_defaults__WEBPACK_IMPORTED_MODULE_1__);
|
|
6186
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react */ "react");
|
|
6187
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__);
|
|
6188
|
+
/* harmony import */ var _victory_util_log__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../victory-util/log */ "../../victory-core/es/victory-util/log.js");
|
|
6189
|
+
/* harmony import */ var _victory_util_helpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../victory-util/helpers */ "../../victory-core/es/victory-util/helpers.js");
|
|
6190
|
+
/* harmony import */ var _portal_context__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./portal-context */ "../../victory-core/es/victory-portal/portal-context.js");
|
|
6191
|
+
|
|
6188
6192
|
|
|
6189
6193
|
|
|
6190
6194
|
|
|
6191
6195
|
|
|
6192
6196
|
|
|
6193
6197
|
const defaultProps = {
|
|
6194
|
-
groupComponent: /*#__PURE__*/
|
|
6198
|
+
groupComponent: /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().createElement("g", null)
|
|
6195
6199
|
};
|
|
6196
6200
|
const VictoryPortal = initialProps => {
|
|
6197
6201
|
const props = {
|
|
6198
6202
|
...defaultProps,
|
|
6199
6203
|
...initialProps
|
|
6200
6204
|
};
|
|
6201
|
-
const id =
|
|
6202
|
-
const portalContext = (0,
|
|
6205
|
+
const [id] = (0,react__WEBPACK_IMPORTED_MODULE_2__.useState)(lodash_uniqueId__WEBPACK_IMPORTED_MODULE_0___default()());
|
|
6206
|
+
const portalContext = (0,_portal_context__WEBPACK_IMPORTED_MODULE_3__.usePortalContext)();
|
|
6203
6207
|
if (!portalContext) {
|
|
6204
6208
|
const msg = "`renderInPortal` is not supported outside of `VictoryContainer`. " + "Component will be rendered in place";
|
|
6205
|
-
|
|
6209
|
+
_victory_util_log__WEBPACK_IMPORTED_MODULE_4__.warn(msg);
|
|
6206
6210
|
}
|
|
6207
6211
|
const children = Array.isArray(props.children) ? props.children[0] : props.children;
|
|
6208
6212
|
const {
|
|
@@ -6213,15 +6217,15 @@ const VictoryPortal = initialProps => {
|
|
|
6213
6217
|
groupComponent,
|
|
6214
6218
|
standalone: false
|
|
6215
6219
|
} : {};
|
|
6216
|
-
const newProps =
|
|
6220
|
+
const newProps = lodash_defaults__WEBPACK_IMPORTED_MODULE_1___default()(standardProps, childProps, _victory_util_helpers__WEBPACK_IMPORTED_MODULE_5__.omit(props, ["children", "groupComponent"]), {
|
|
6217
6221
|
key: childProps.key ?? id
|
|
6218
6222
|
});
|
|
6219
|
-
const child = children && /*#__PURE__*/
|
|
6220
|
-
|
|
6223
|
+
const child = children && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default().cloneElement(children, newProps);
|
|
6224
|
+
react__WEBPACK_IMPORTED_MODULE_2___default().useEffect(() => {
|
|
6221
6225
|
portalContext?.addChild(id, child);
|
|
6222
6226
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
6223
6227
|
}, [props.children]);
|
|
6224
|
-
|
|
6228
|
+
react__WEBPACK_IMPORTED_MODULE_2___default().useEffect(() => {
|
|
6225
6229
|
return () => portalContext?.removeChild(id);
|
|
6226
6230
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
6227
6231
|
}, []);
|
|
@@ -6596,20 +6600,16 @@ const orange = {
|
|
|
6596
6600
|
"100": "#FEE2D5",
|
|
6597
6601
|
"300": "#FFA981",
|
|
6598
6602
|
"500": "#FF6F2C",
|
|
6603
|
+
"700": "#FF4E1B",
|
|
6599
6604
|
"900": "#D74D26"
|
|
6600
6605
|
};
|
|
6601
6606
|
const red = {
|
|
6602
6607
|
"100": "#FFDCE5",
|
|
6603
6608
|
"300": "#FF9EB7",
|
|
6604
6609
|
"500": "#F82B60",
|
|
6610
|
+
"700": "#D31A3D",
|
|
6605
6611
|
"900": "#BA1E45"
|
|
6606
6612
|
};
|
|
6607
|
-
const pink = {
|
|
6608
|
-
"100": "#FFDAF6",
|
|
6609
|
-
"300": "#F99DE2",
|
|
6610
|
-
"500": "#FF08C2",
|
|
6611
|
-
"900": "#B2158B"
|
|
6612
|
-
};
|
|
6613
6613
|
const purple = {
|
|
6614
6614
|
"100": "#EDE3FE",
|
|
6615
6615
|
"300": "#CDB0FF",
|
|
@@ -6620,6 +6620,7 @@ const blue = {
|
|
|
6620
6620
|
"100": "#CFDFFF",
|
|
6621
6621
|
"300": "#9CC7FF",
|
|
6622
6622
|
"500": "#2D7FF9",
|
|
6623
|
+
"700": "#0056B3",
|
|
6623
6624
|
"900": "#2750AE"
|
|
6624
6625
|
};
|
|
6625
6626
|
const cyan = {
|
|
@@ -6638,9 +6639,29 @@ const green = {
|
|
|
6638
6639
|
"100": "#D1F7C4",
|
|
6639
6640
|
"300": "#93E088",
|
|
6640
6641
|
"500": "#20C933",
|
|
6642
|
+
"700": "#1B9B2A",
|
|
6641
6643
|
"900": "#338A17"
|
|
6642
6644
|
};
|
|
6643
|
-
const colors =
|
|
6645
|
+
const colors = {
|
|
6646
|
+
blue: blue["500"],
|
|
6647
|
+
cyan: cyan["500"],
|
|
6648
|
+
green: green["500"],
|
|
6649
|
+
yellow: yellow["500"],
|
|
6650
|
+
orange: orange["500"],
|
|
6651
|
+
red: red["500"],
|
|
6652
|
+
purple: purple["500"],
|
|
6653
|
+
teal: teal["500"]
|
|
6654
|
+
};
|
|
6655
|
+
const colorScale = Object.values(colors);
|
|
6656
|
+
const grayscale = [gray["100"], gray["300"], gray["500"], gray["700"], gray["900"]];
|
|
6657
|
+
const warm = [yellow["300"], yellow["500"], orange["500"], orange["900"], red["500"]];
|
|
6658
|
+
const cool = [purple["500"], blue["500"], cyan["500"], teal["500"], green["500"]];
|
|
6659
|
+
const heatmap = [green["900"], green["500"], yellow["500"], orange["500"], red["500"]];
|
|
6660
|
+
const redPalette = Object.values(red);
|
|
6661
|
+
const greenPalette = Object.values(green);
|
|
6662
|
+
const bluePalette = Object.values(blue);
|
|
6663
|
+
const defaultColor = blue["500"];
|
|
6664
|
+
|
|
6644
6665
|
// *
|
|
6645
6666
|
// * Typography
|
|
6646
6667
|
// *
|
|
@@ -6654,8 +6675,8 @@ const padding = 8;
|
|
|
6654
6675
|
const baseProps = {
|
|
6655
6676
|
width: 450,
|
|
6656
6677
|
height: 300,
|
|
6657
|
-
padding:
|
|
6658
|
-
colorScale
|
|
6678
|
+
padding: 60,
|
|
6679
|
+
colorScale
|
|
6659
6680
|
};
|
|
6660
6681
|
// *
|
|
6661
6682
|
// * Labels
|
|
@@ -6684,10 +6705,23 @@ const borderRadius = 1;
|
|
|
6684
6705
|
// * Theme
|
|
6685
6706
|
// *
|
|
6686
6707
|
const clean = {
|
|
6708
|
+
palette: {
|
|
6709
|
+
colors,
|
|
6710
|
+
grayscale,
|
|
6711
|
+
qualitative: colorScale,
|
|
6712
|
+
heatmap,
|
|
6713
|
+
warm,
|
|
6714
|
+
cool,
|
|
6715
|
+
red: redPalette,
|
|
6716
|
+
green: greenPalette,
|
|
6717
|
+
blue: bluePalette
|
|
6718
|
+
},
|
|
6687
6719
|
area: Object.assign({
|
|
6688
6720
|
style: {
|
|
6689
6721
|
data: {
|
|
6690
|
-
fill:
|
|
6722
|
+
fill: defaultColor,
|
|
6723
|
+
strokeWidth: 2,
|
|
6724
|
+
fillOpacity: 0.5
|
|
6691
6725
|
},
|
|
6692
6726
|
labels: baseLabelStyles
|
|
6693
6727
|
}
|
|
@@ -6696,13 +6730,13 @@ const clean = {
|
|
|
6696
6730
|
style: {
|
|
6697
6731
|
axis: {
|
|
6698
6732
|
fill: "transparent",
|
|
6699
|
-
stroke: gray["
|
|
6733
|
+
stroke: gray["500"],
|
|
6700
6734
|
strokeWidth: 1,
|
|
6701
6735
|
strokeLinecap,
|
|
6702
6736
|
strokeLinejoin
|
|
6703
6737
|
},
|
|
6704
6738
|
axisLabel: Object.assign({}, centeredLabelStyles, {
|
|
6705
|
-
padding,
|
|
6739
|
+
padding: 35,
|
|
6706
6740
|
stroke: "transparent"
|
|
6707
6741
|
}),
|
|
6708
6742
|
grid: {
|
|
@@ -6721,10 +6755,10 @@ const clean = {
|
|
|
6721
6755
|
polarAxis: Object.assign({
|
|
6722
6756
|
style: {
|
|
6723
6757
|
axis: {
|
|
6724
|
-
stroke: gray["
|
|
6758
|
+
stroke: gray["500"]
|
|
6725
6759
|
},
|
|
6726
6760
|
grid: {
|
|
6727
|
-
stroke: gray["
|
|
6761
|
+
stroke: gray["400"],
|
|
6728
6762
|
strokeDasharray,
|
|
6729
6763
|
strokeLinecap,
|
|
6730
6764
|
strokeLinejoin,
|
|
@@ -6733,7 +6767,7 @@ const clean = {
|
|
|
6733
6767
|
ticks: {
|
|
6734
6768
|
fill: "transparent",
|
|
6735
6769
|
size: 5,
|
|
6736
|
-
stroke: gray["
|
|
6770
|
+
stroke: gray["400"],
|
|
6737
6771
|
strokeWidth: 1,
|
|
6738
6772
|
strokeLinecap,
|
|
6739
6773
|
strokeLinejoin
|
|
@@ -6744,10 +6778,10 @@ const clean = {
|
|
|
6744
6778
|
polarDependentAxis: Object.assign({
|
|
6745
6779
|
style: {
|
|
6746
6780
|
axis: {
|
|
6747
|
-
stroke: gray["
|
|
6781
|
+
stroke: gray["500"]
|
|
6748
6782
|
},
|
|
6749
6783
|
grid: {
|
|
6750
|
-
stroke: gray["
|
|
6784
|
+
stroke: gray["400"],
|
|
6751
6785
|
strokeDasharray,
|
|
6752
6786
|
strokeLinecap,
|
|
6753
6787
|
strokeLinejoin,
|
|
@@ -6756,7 +6790,7 @@ const clean = {
|
|
|
6756
6790
|
ticks: {
|
|
6757
6791
|
fill: "transparent",
|
|
6758
6792
|
size: 5,
|
|
6759
|
-
stroke: gray["
|
|
6793
|
+
stroke: gray["300"],
|
|
6760
6794
|
strokeWidth: 1,
|
|
6761
6795
|
strokeLinecap,
|
|
6762
6796
|
strokeLinejoin
|
|
@@ -6767,9 +6801,10 @@ const clean = {
|
|
|
6767
6801
|
bar: Object.assign({
|
|
6768
6802
|
style: {
|
|
6769
6803
|
data: {
|
|
6770
|
-
fill:
|
|
6804
|
+
fill: defaultColor,
|
|
6771
6805
|
padding,
|
|
6772
|
-
strokeWidth:
|
|
6806
|
+
strokeWidth: 1,
|
|
6807
|
+
fillOpacity: 0.5
|
|
6773
6808
|
},
|
|
6774
6809
|
labels: baseLabelStyles
|
|
6775
6810
|
},
|
|
@@ -6805,15 +6840,16 @@ const clean = {
|
|
|
6805
6840
|
}),
|
|
6806
6841
|
q1: {
|
|
6807
6842
|
padding,
|
|
6808
|
-
fill:
|
|
6809
|
-
rx: borderRadius
|
|
6843
|
+
fill: colorScale[0],
|
|
6844
|
+
rx: borderRadius,
|
|
6845
|
+
strokeWidth: 2
|
|
6810
6846
|
},
|
|
6811
6847
|
q1Labels: Object.assign({}, baseLabelStyles, {
|
|
6812
6848
|
padding: 3
|
|
6813
6849
|
}),
|
|
6814
6850
|
q3: {
|
|
6815
6851
|
padding,
|
|
6816
|
-
fill:
|
|
6852
|
+
fill: colorScale[1],
|
|
6817
6853
|
rx: borderRadius
|
|
6818
6854
|
},
|
|
6819
6855
|
q3Labels: Object.assign({}, baseLabelStyles, {
|
|
@@ -6834,8 +6870,8 @@ const clean = {
|
|
|
6834
6870
|
})
|
|
6835
6871
|
},
|
|
6836
6872
|
candleColors: {
|
|
6837
|
-
positive:
|
|
6838
|
-
negative:
|
|
6873
|
+
positive: green["500"],
|
|
6874
|
+
negative: red["500"]
|
|
6839
6875
|
},
|
|
6840
6876
|
wickStrokeWidth: 2
|
|
6841
6877
|
}, baseProps),
|
|
@@ -6854,14 +6890,13 @@ const clean = {
|
|
|
6854
6890
|
}
|
|
6855
6891
|
}, baseProps),
|
|
6856
6892
|
group: Object.assign({
|
|
6857
|
-
colorScale
|
|
6893
|
+
colorScale
|
|
6858
6894
|
}, baseProps),
|
|
6859
6895
|
histogram: Object.assign({
|
|
6860
6896
|
style: {
|
|
6861
6897
|
data: {
|
|
6862
6898
|
fill: cyan["500"],
|
|
6863
|
-
|
|
6864
|
-
strokeWidth: 0
|
|
6899
|
+
fillOpacity: 0.5
|
|
6865
6900
|
},
|
|
6866
6901
|
labels: baseLabelStyles
|
|
6867
6902
|
},
|
|
@@ -6872,21 +6907,23 @@ const clean = {
|
|
|
6872
6907
|
}, baseProps),
|
|
6873
6908
|
label: baseLabelStyles,
|
|
6874
6909
|
legend: {
|
|
6875
|
-
colorScale
|
|
6876
|
-
gutter:
|
|
6877
|
-
|
|
6910
|
+
colorScale,
|
|
6911
|
+
gutter: 24,
|
|
6912
|
+
borderPadding: 10,
|
|
6913
|
+
orientation: "horizontal",
|
|
6878
6914
|
titleOrientation: "top",
|
|
6915
|
+
centerTitle: true,
|
|
6879
6916
|
style: {
|
|
6880
6917
|
data: {
|
|
6881
6918
|
type: "circle"
|
|
6882
6919
|
},
|
|
6883
6920
|
labels: {
|
|
6884
6921
|
...baseLabelStyles,
|
|
6885
|
-
fontSize:
|
|
6922
|
+
fontSize: 12
|
|
6886
6923
|
},
|
|
6887
6924
|
title: Object.assign({}, baseLabelStyles, {
|
|
6888
6925
|
padding,
|
|
6889
|
-
fontSize:
|
|
6926
|
+
fontSize: 16
|
|
6890
6927
|
}),
|
|
6891
6928
|
border: {
|
|
6892
6929
|
stroke: gray["200"],
|
|
@@ -6900,7 +6937,7 @@ const clean = {
|
|
|
6900
6937
|
data: {
|
|
6901
6938
|
fill: "transparent",
|
|
6902
6939
|
opacity: 1,
|
|
6903
|
-
stroke:
|
|
6940
|
+
stroke: defaultColor,
|
|
6904
6941
|
strokeWidth: 2,
|
|
6905
6942
|
strokeLinecap,
|
|
6906
6943
|
strokeLinejoin
|
|
@@ -6910,31 +6947,40 @@ const clean = {
|
|
|
6910
6947
|
}, baseProps),
|
|
6911
6948
|
pie: Object.assign({
|
|
6912
6949
|
style: {
|
|
6950
|
+
parent: {
|
|
6951
|
+
backgroundColor: gray.white
|
|
6952
|
+
},
|
|
6913
6953
|
data: {
|
|
6914
6954
|
padding,
|
|
6915
6955
|
stroke: gray.white,
|
|
6916
6956
|
strokeWidth: 1
|
|
6917
6957
|
},
|
|
6918
|
-
labels:
|
|
6919
|
-
|
|
6920
|
-
|
|
6958
|
+
labels: {
|
|
6959
|
+
...baseLabelStyles,
|
|
6960
|
+
padding: 20,
|
|
6961
|
+
fill: gray["600"],
|
|
6962
|
+
fontSize: 10
|
|
6963
|
+
}
|
|
6921
6964
|
},
|
|
6922
|
-
colorScale
|
|
6965
|
+
colorScale,
|
|
6923
6966
|
cornerRadius: borderRadius
|
|
6924
6967
|
}, baseProps),
|
|
6925
6968
|
scatter: Object.assign({
|
|
6926
6969
|
style: {
|
|
6927
6970
|
data: {
|
|
6928
|
-
fill:
|
|
6971
|
+
fill: defaultColor,
|
|
6929
6972
|
opacity: 1,
|
|
6930
6973
|
stroke: "transparent",
|
|
6931
6974
|
strokeWidth: 0
|
|
6932
6975
|
},
|
|
6933
|
-
labels:
|
|
6976
|
+
labels: {
|
|
6977
|
+
...baseLabelStyles,
|
|
6978
|
+
padding: 20
|
|
6979
|
+
}
|
|
6934
6980
|
}
|
|
6935
6981
|
}, baseProps),
|
|
6936
6982
|
stack: Object.assign({
|
|
6937
|
-
colorScale
|
|
6983
|
+
colorScale
|
|
6938
6984
|
}, baseProps),
|
|
6939
6985
|
tooltip: {
|
|
6940
6986
|
style: Object.assign({}, baseLabelStyles, {
|
|
@@ -6942,7 +6988,7 @@ const clean = {
|
|
|
6942
6988
|
pointerEvents: "none"
|
|
6943
6989
|
}),
|
|
6944
6990
|
flyoutStyle: {
|
|
6945
|
-
stroke: gray["
|
|
6991
|
+
stroke: gray["300"],
|
|
6946
6992
|
strokeWidth: 2,
|
|
6947
6993
|
fill: gray.white,
|
|
6948
6994
|
pointerEvents: "none"
|
|
@@ -6959,8 +7005,8 @@ const clean = {
|
|
|
6959
7005
|
voronoi: Object.assign({
|
|
6960
7006
|
style: {
|
|
6961
7007
|
data: {
|
|
6962
|
-
fill:
|
|
6963
|
-
stroke:
|
|
7008
|
+
fill: blue["100"],
|
|
7009
|
+
stroke: defaultColor,
|
|
6964
7010
|
strokeWidth: 2
|
|
6965
7011
|
},
|
|
6966
7012
|
labels: Object.assign({}, baseLabelStyles, {
|
|
@@ -6997,9 +7043,28 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
6997
7043
|
// *
|
|
6998
7044
|
// * Colors
|
|
6999
7045
|
// *
|
|
7000
|
-
const colors =
|
|
7046
|
+
const colors = {
|
|
7047
|
+
blue: "#4F7DA1",
|
|
7048
|
+
pink: "#E2A37F",
|
|
7049
|
+
teal: "#00796B",
|
|
7050
|
+
purple: "#DF948A",
|
|
7051
|
+
green: "#8BC34A",
|
|
7052
|
+
orange: "#F4511E",
|
|
7053
|
+
cyan: "#006064",
|
|
7054
|
+
red: "#DF5A49",
|
|
7055
|
+
yellow: "#FFF59D"
|
|
7056
|
+
};
|
|
7057
|
+
const colorScale = ["#252525", "#525252", "#737373", "#969696", "#bdbdbd", "#d9d9d9", "#f0f0f0"];
|
|
7001
7058
|
const charcoal = "#252525";
|
|
7002
7059
|
const grey = "#969696";
|
|
7060
|
+
const qualitative = ["#334D5C", "#45B29D", "#EFC94C", "#E27A3F", "#DF5A49", "#4F7DA1", "#55DBC1", "#EFDA97", "#E2A37F", "#DF948A"];
|
|
7061
|
+
const heatmap = ["#428517", "#77D200", "#D6D305", "#EC8E19", "#C92B05"];
|
|
7062
|
+
const warm = ["#940031", "#C43343", "#DC5429", "#FF821D", "#FFAF55"];
|
|
7063
|
+
const cool = ["#2746B9", "#0B69D4", "#2794DB", "#31BB76", "#60E83B"];
|
|
7064
|
+
const red = ["#FCAE91", "#FB6A4A", "#DE2D26", "#A50F15", "#750B0E"];
|
|
7065
|
+
const green = ["#354722", "#466631", "#649146", "#8AB25C", "#A9C97E"];
|
|
7066
|
+
const blue = ["#002C61", "#004B8F", "#006BC9", "#3795E5", "#65B4F4"];
|
|
7067
|
+
|
|
7003
7068
|
// *
|
|
7004
7069
|
// * Typography
|
|
7005
7070
|
// *
|
|
@@ -7013,7 +7078,7 @@ const baseProps = {
|
|
|
7013
7078
|
width: 450,
|
|
7014
7079
|
height: 300,
|
|
7015
7080
|
padding: 50,
|
|
7016
|
-
colorScale
|
|
7081
|
+
colorScale
|
|
7017
7082
|
};
|
|
7018
7083
|
// *
|
|
7019
7084
|
// * Labels
|
|
@@ -7035,6 +7100,17 @@ const centeredLabelStyles = Object.assign({
|
|
|
7035
7100
|
const strokeLinecap = "round";
|
|
7036
7101
|
const strokeLinejoin = "round";
|
|
7037
7102
|
const grayscale = {
|
|
7103
|
+
palette: {
|
|
7104
|
+
colors,
|
|
7105
|
+
grayscale: colorScale,
|
|
7106
|
+
qualitative,
|
|
7107
|
+
heatmap,
|
|
7108
|
+
warm,
|
|
7109
|
+
cool,
|
|
7110
|
+
red,
|
|
7111
|
+
green,
|
|
7112
|
+
blue
|
|
7113
|
+
},
|
|
7038
7114
|
area: Object.assign({
|
|
7039
7115
|
style: {
|
|
7040
7116
|
data: {
|
|
@@ -7149,7 +7225,7 @@ const grayscale = {
|
|
|
7149
7225
|
}
|
|
7150
7226
|
}, baseProps),
|
|
7151
7227
|
group: Object.assign({
|
|
7152
|
-
colorScale
|
|
7228
|
+
colorScale
|
|
7153
7229
|
}, baseProps),
|
|
7154
7230
|
histogram: Object.assign({
|
|
7155
7231
|
style: {
|
|
@@ -7162,7 +7238,7 @@ const grayscale = {
|
|
|
7162
7238
|
}
|
|
7163
7239
|
}, baseProps),
|
|
7164
7240
|
legend: {
|
|
7165
|
-
colorScale
|
|
7241
|
+
colorScale,
|
|
7166
7242
|
gutter: 10,
|
|
7167
7243
|
orientation: "vertical",
|
|
7168
7244
|
titleOrientation: "top",
|
|
@@ -7197,7 +7273,7 @@ const grayscale = {
|
|
|
7197
7273
|
padding: 20
|
|
7198
7274
|
})
|
|
7199
7275
|
},
|
|
7200
|
-
colorScale
|
|
7276
|
+
colorScale,
|
|
7201
7277
|
width: 400,
|
|
7202
7278
|
height: 400,
|
|
7203
7279
|
padding: 50
|
|
@@ -7213,7 +7289,7 @@ const grayscale = {
|
|
|
7213
7289
|
}
|
|
7214
7290
|
}, baseProps),
|
|
7215
7291
|
stack: Object.assign({
|
|
7216
|
-
colorScale
|
|
7292
|
+
colorScale
|
|
7217
7293
|
}, baseProps),
|
|
7218
7294
|
tooltip: {
|
|
7219
7295
|
style: Object.assign({}, baseLabelStyles, {
|
|
@@ -7273,11 +7349,31 @@ const lime300 = "#DCE775";
|
|
|
7273
7349
|
const lightGreen500 = "#8BC34A";
|
|
7274
7350
|
const teal700 = "#00796B";
|
|
7275
7351
|
const cyan900 = "#006064";
|
|
7276
|
-
const
|
|
7352
|
+
const colorScale = [deepOrange600, yellow200, lime300, lightGreen500, teal700, cyan900];
|
|
7277
7353
|
const blueGrey50 = "#ECEFF1";
|
|
7278
7354
|
const blueGrey300 = "#90A4AE";
|
|
7279
7355
|
const blueGrey700 = "#455A64";
|
|
7280
7356
|
const grey900 = "#212121";
|
|
7357
|
+
const colors = {
|
|
7358
|
+
blue: "#4F7DA1",
|
|
7359
|
+
pink: "#E2A37F",
|
|
7360
|
+
teal: teal700,
|
|
7361
|
+
purple: "#DF948A",
|
|
7362
|
+
green: lightGreen500,
|
|
7363
|
+
orange: deepOrange600,
|
|
7364
|
+
cyan: cyan900,
|
|
7365
|
+
red: "#DF5A49",
|
|
7366
|
+
yellow: yellow200
|
|
7367
|
+
};
|
|
7368
|
+
const grayscale = [blueGrey50, blueGrey300, blueGrey700, grey900];
|
|
7369
|
+
const qualitative = ["#334D5C", "#45B29D", "#EFC94C", "#E27A3F", "#DF5A49", "#4F7DA1", "#55DBC1", "#EFDA97", "#E2A37F", "#DF948A"];
|
|
7370
|
+
const heatmap = ["#428517", "#77D200", "#D6D305", "#EC8E19", "#C92B05"];
|
|
7371
|
+
const warm = ["#940031", "#C43343", "#DC5429", "#FF821D", "#FFAF55"];
|
|
7372
|
+
const cool = ["#2746B9", "#0B69D4", "#2794DB", "#31BB76", "#60E83B"];
|
|
7373
|
+
const red = ["#FCAE91", "#FB6A4A", "#DE2D26", "#A50F15", "#750B0E"];
|
|
7374
|
+
const green = ["#354722", "#466631", "#649146", "#8AB25C", "#A9C97E"];
|
|
7375
|
+
const blue = ["#002C61", "#004B8F", "#006BC9", "#3795E5", "#65B4F4"];
|
|
7376
|
+
|
|
7281
7377
|
// *
|
|
7282
7378
|
// * Typography
|
|
7283
7379
|
// *
|
|
@@ -7315,6 +7411,17 @@ const strokeDasharray = "10, 5";
|
|
|
7315
7411
|
const strokeLinecap = "round";
|
|
7316
7412
|
const strokeLinejoin = "round";
|
|
7317
7413
|
const material = {
|
|
7414
|
+
palette: {
|
|
7415
|
+
colors,
|
|
7416
|
+
grayscale,
|
|
7417
|
+
qualitative,
|
|
7418
|
+
heatmap,
|
|
7419
|
+
warm,
|
|
7420
|
+
cool,
|
|
7421
|
+
red,
|
|
7422
|
+
green,
|
|
7423
|
+
blue
|
|
7424
|
+
},
|
|
7318
7425
|
area: Object.assign({
|
|
7319
7426
|
style: {
|
|
7320
7427
|
data: {
|
|
@@ -7447,7 +7554,7 @@ const material = {
|
|
|
7447
7554
|
}
|
|
7448
7555
|
}, baseProps),
|
|
7449
7556
|
group: Object.assign({
|
|
7450
|
-
colorScale
|
|
7557
|
+
colorScale
|
|
7451
7558
|
}, baseProps),
|
|
7452
7559
|
histogram: Object.assign({
|
|
7453
7560
|
style: {
|
|
@@ -7460,7 +7567,7 @@ const material = {
|
|
|
7460
7567
|
}
|
|
7461
7568
|
}, baseProps),
|
|
7462
7569
|
legend: {
|
|
7463
|
-
colorScale
|
|
7570
|
+
colorScale,
|
|
7464
7571
|
gutter: 10,
|
|
7465
7572
|
orientation: "vertical",
|
|
7466
7573
|
titleOrientation: "top",
|
|
@@ -7486,7 +7593,7 @@ const material = {
|
|
|
7486
7593
|
}
|
|
7487
7594
|
}, baseProps),
|
|
7488
7595
|
pie: Object.assign({
|
|
7489
|
-
colorScale
|
|
7596
|
+
colorScale,
|
|
7490
7597
|
style: {
|
|
7491
7598
|
data: {
|
|
7492
7599
|
padding,
|
|
@@ -7510,7 +7617,7 @@ const material = {
|
|
|
7510
7617
|
}
|
|
7511
7618
|
}, baseProps),
|
|
7512
7619
|
stack: Object.assign({
|
|
7513
|
-
colorScale
|
|
7620
|
+
colorScale
|
|
7514
7621
|
}, baseProps),
|
|
7515
7622
|
tooltip: {
|
|
7516
7623
|
style: Object.assign({}, baseLabelStyles, {
|
|
@@ -9467,6 +9574,9 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
9467
9574
|
/* harmony export */ "getColorScale": function() { return /* binding */ getColorScale; },
|
|
9468
9575
|
/* harmony export */ "toTransformString": function() { return /* binding */ toTransformString; }
|
|
9469
9576
|
/* harmony export */ });
|
|
9577
|
+
/* harmony import */ var _victory_theme_victory_theme__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../victory-theme/victory-theme */ "../../victory-core/es/victory-theme/victory-theme.js");
|
|
9578
|
+
|
|
9579
|
+
|
|
9470
9580
|
/**
|
|
9471
9581
|
* Given an object with CSS/SVG transform definitions, return the string value
|
|
9472
9582
|
* for use with the `transform` CSS property or SVG attribute. Note that we
|
|
@@ -9503,20 +9613,37 @@ const toTransformString = function (obj) {
|
|
|
9503
9613
|
* of 5 hex string values in that color scale. If no 'name' parameter
|
|
9504
9614
|
* is given, it will return the Victory default grayscale.
|
|
9505
9615
|
* @param {String} name The name of the color scale to return (optional).
|
|
9616
|
+
* @param {Object} theme The theme object to retrieve the color scale from (optional).
|
|
9506
9617
|
* @returns {Array} An array of 5 hex string values composing a color scale.
|
|
9507
9618
|
*/
|
|
9508
|
-
function getColorScale(name) {
|
|
9619
|
+
function getColorScale(name, theme) {
|
|
9620
|
+
if (theme === void 0) {
|
|
9621
|
+
theme = _victory_theme_victory_theme__WEBPACK_IMPORTED_MODULE_0__.VictoryTheme.material;
|
|
9622
|
+
}
|
|
9623
|
+
const {
|
|
9624
|
+
palette: {
|
|
9625
|
+
grayscale = ["#cccccc", "#969696", "#636363", "#252525"],
|
|
9626
|
+
qualitative = [],
|
|
9627
|
+
heatmap = [],
|
|
9628
|
+
warm = [],
|
|
9629
|
+
cool = [],
|
|
9630
|
+
red = [],
|
|
9631
|
+
blue = [],
|
|
9632
|
+
green = []
|
|
9633
|
+
} = {}
|
|
9634
|
+
} = theme;
|
|
9509
9635
|
const scales = {
|
|
9510
|
-
grayscale
|
|
9511
|
-
qualitative
|
|
9512
|
-
heatmap
|
|
9513
|
-
warm
|
|
9514
|
-
cool
|
|
9515
|
-
red
|
|
9516
|
-
blue
|
|
9517
|
-
green
|
|
9636
|
+
grayscale,
|
|
9637
|
+
qualitative,
|
|
9638
|
+
heatmap,
|
|
9639
|
+
warm,
|
|
9640
|
+
cool,
|
|
9641
|
+
red,
|
|
9642
|
+
blue,
|
|
9643
|
+
green
|
|
9518
9644
|
};
|
|
9519
|
-
|
|
9645
|
+
const selectedScale = name && scales[name]?.length ? scales[name] : scales.grayscale;
|
|
9646
|
+
return selectedScale;
|
|
9520
9647
|
}
|
|
9521
9648
|
|
|
9522
9649
|
/***/ }),
|