victory-core 37.1.1 → 37.2.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 +18 -0
- package/dist/victory-core.js +608 -41
- package/dist/victory-core.min.js +1 -1
- package/es/types/prop-types.d.ts +1 -0
- package/es/victory-portal/victory-portal.js +2 -1
- package/es/victory-theme/clean.d.ts +3 -0
- package/es/victory-theme/clean.js +457 -0
- package/es/victory-theme/grayscale.js +36 -6
- package/es/victory-theme/material.js +36 -5
- package/es/victory-theme/types.d.ts +17 -0
- package/es/victory-theme/victory-theme.d.ts +1 -0
- package/es/victory-theme/victory-theme.js +3 -1
- package/es/victory-util/style.d.ts +3 -1
- package/es/victory-util/style.js +29 -10
- package/es/victory-util/textsize.js +5 -0
- package/es/victory-util/wrapper.d.ts +2 -2
- package/es/victory-util/wrapper.js +8 -4
- package/lib/types/prop-types.d.ts +1 -0
- package/lib/victory-portal/victory-portal.js +2 -1
- package/lib/victory-theme/clean.d.ts +3 -0
- package/lib/victory-theme/clean.js +463 -0
- package/lib/victory-theme/grayscale.js +36 -6
- package/lib/victory-theme/material.js +36 -5
- package/lib/victory-theme/types.d.ts +17 -0
- package/lib/victory-theme/victory-theme.d.ts +1 -0
- package/lib/victory-theme/victory-theme.js +3 -1
- package/lib/victory-util/style.d.ts +3 -1
- package/lib/victory-util/style.js +28 -10
- package/lib/victory-util/textsize.js +5 -0
- package/lib/victory-util/wrapper.d.ts +2 -2
- package/lib/victory-util/wrapper.js +8 -4
- package/package.json +2 -2
- package/src/types/prop-types.ts +1 -0
- package/src/victory-portal/victory-portal.tsx +2 -2
- package/src/victory-theme/clean.tsx +448 -0
- package/src/victory-theme/grayscale.tsx +49 -6
- package/src/victory-theme/material.tsx +50 -6
- package/src/victory-theme/types.ts +27 -0
- package/src/victory-theme/victory-theme.tsx +3 -1
- package/src/victory-util/style.ts +37 -22
- package/src/victory-util/textsize.ts +5 -0
- package/src/victory-util/wrapper.tsx +8 -4
|
@@ -7,9 +7,28 @@ exports.grayscale = void 0;
|
|
|
7
7
|
// *
|
|
8
8
|
// * Colors
|
|
9
9
|
// *
|
|
10
|
-
const colors =
|
|
10
|
+
const colors = {
|
|
11
|
+
blue: "#4F7DA1",
|
|
12
|
+
pink: "#E2A37F",
|
|
13
|
+
teal: "#00796B",
|
|
14
|
+
purple: "#DF948A",
|
|
15
|
+
green: "#8BC34A",
|
|
16
|
+
orange: "#F4511E",
|
|
17
|
+
cyan: "#006064",
|
|
18
|
+
red: "#DF5A49",
|
|
19
|
+
yellow: "#FFF59D"
|
|
20
|
+
};
|
|
21
|
+
const colorScale = ["#252525", "#525252", "#737373", "#969696", "#bdbdbd", "#d9d9d9", "#f0f0f0"];
|
|
11
22
|
const charcoal = "#252525";
|
|
12
23
|
const grey = "#969696";
|
|
24
|
+
const qualitative = ["#334D5C", "#45B29D", "#EFC94C", "#E27A3F", "#DF5A49", "#4F7DA1", "#55DBC1", "#EFDA97", "#E2A37F", "#DF948A"];
|
|
25
|
+
const heatmap = ["#428517", "#77D200", "#D6D305", "#EC8E19", "#C92B05"];
|
|
26
|
+
const warm = ["#940031", "#C43343", "#DC5429", "#FF821D", "#FFAF55"];
|
|
27
|
+
const cool = ["#2746B9", "#0B69D4", "#2794DB", "#31BB76", "#60E83B"];
|
|
28
|
+
const red = ["#FCAE91", "#FB6A4A", "#DE2D26", "#A50F15", "#750B0E"];
|
|
29
|
+
const green = ["#354722", "#466631", "#649146", "#8AB25C", "#A9C97E"];
|
|
30
|
+
const blue = ["#002C61", "#004B8F", "#006BC9", "#3795E5", "#65B4F4"];
|
|
31
|
+
|
|
13
32
|
// *
|
|
14
33
|
// * Typography
|
|
15
34
|
// *
|
|
@@ -23,7 +42,7 @@ const baseProps = {
|
|
|
23
42
|
width: 450,
|
|
24
43
|
height: 300,
|
|
25
44
|
padding: 50,
|
|
26
|
-
colorScale
|
|
45
|
+
colorScale
|
|
27
46
|
};
|
|
28
47
|
// *
|
|
29
48
|
// * Labels
|
|
@@ -45,6 +64,17 @@ const centeredLabelStyles = Object.assign({
|
|
|
45
64
|
const strokeLinecap = "round";
|
|
46
65
|
const strokeLinejoin = "round";
|
|
47
66
|
const grayscale = exports.grayscale = {
|
|
67
|
+
palette: {
|
|
68
|
+
colors,
|
|
69
|
+
grayscale: colorScale,
|
|
70
|
+
qualitative,
|
|
71
|
+
heatmap,
|
|
72
|
+
warm,
|
|
73
|
+
cool,
|
|
74
|
+
red,
|
|
75
|
+
green,
|
|
76
|
+
blue
|
|
77
|
+
},
|
|
48
78
|
area: Object.assign({
|
|
49
79
|
style: {
|
|
50
80
|
data: {
|
|
@@ -159,7 +189,7 @@ const grayscale = exports.grayscale = {
|
|
|
159
189
|
}
|
|
160
190
|
}, baseProps),
|
|
161
191
|
group: Object.assign({
|
|
162
|
-
colorScale
|
|
192
|
+
colorScale
|
|
163
193
|
}, baseProps),
|
|
164
194
|
histogram: Object.assign({
|
|
165
195
|
style: {
|
|
@@ -172,7 +202,7 @@ const grayscale = exports.grayscale = {
|
|
|
172
202
|
}
|
|
173
203
|
}, baseProps),
|
|
174
204
|
legend: {
|
|
175
|
-
colorScale
|
|
205
|
+
colorScale,
|
|
176
206
|
gutter: 10,
|
|
177
207
|
orientation: "vertical",
|
|
178
208
|
titleOrientation: "top",
|
|
@@ -207,7 +237,7 @@ const grayscale = exports.grayscale = {
|
|
|
207
237
|
padding: 20
|
|
208
238
|
})
|
|
209
239
|
},
|
|
210
|
-
colorScale
|
|
240
|
+
colorScale,
|
|
211
241
|
width: 400,
|
|
212
242
|
height: 400,
|
|
213
243
|
padding: 50
|
|
@@ -223,7 +253,7 @@ const grayscale = exports.grayscale = {
|
|
|
223
253
|
}
|
|
224
254
|
}, baseProps),
|
|
225
255
|
stack: Object.assign({
|
|
226
|
-
colorScale
|
|
256
|
+
colorScale
|
|
227
257
|
}, baseProps),
|
|
228
258
|
tooltip: {
|
|
229
259
|
style: Object.assign({}, baseLabelStyles, {
|
|
@@ -13,11 +13,31 @@ const lime300 = "#DCE775";
|
|
|
13
13
|
const lightGreen500 = "#8BC34A";
|
|
14
14
|
const teal700 = "#00796B";
|
|
15
15
|
const cyan900 = "#006064";
|
|
16
|
-
const
|
|
16
|
+
const colorScale = [deepOrange600, yellow200, lime300, lightGreen500, teal700, cyan900];
|
|
17
17
|
const blueGrey50 = "#ECEFF1";
|
|
18
18
|
const blueGrey300 = "#90A4AE";
|
|
19
19
|
const blueGrey700 = "#455A64";
|
|
20
20
|
const grey900 = "#212121";
|
|
21
|
+
const colors = {
|
|
22
|
+
blue: "#4F7DA1",
|
|
23
|
+
pink: "#E2A37F",
|
|
24
|
+
teal: teal700,
|
|
25
|
+
purple: "#DF948A",
|
|
26
|
+
green: lightGreen500,
|
|
27
|
+
orange: deepOrange600,
|
|
28
|
+
cyan: cyan900,
|
|
29
|
+
red: "#DF5A49",
|
|
30
|
+
yellow: yellow200
|
|
31
|
+
};
|
|
32
|
+
const grayscale = [blueGrey50, blueGrey300, blueGrey700, grey900];
|
|
33
|
+
const qualitative = ["#334D5C", "#45B29D", "#EFC94C", "#E27A3F", "#DF5A49", "#4F7DA1", "#55DBC1", "#EFDA97", "#E2A37F", "#DF948A"];
|
|
34
|
+
const heatmap = ["#428517", "#77D200", "#D6D305", "#EC8E19", "#C92B05"];
|
|
35
|
+
const warm = ["#940031", "#C43343", "#DC5429", "#FF821D", "#FFAF55"];
|
|
36
|
+
const cool = ["#2746B9", "#0B69D4", "#2794DB", "#31BB76", "#60E83B"];
|
|
37
|
+
const red = ["#FCAE91", "#FB6A4A", "#DE2D26", "#A50F15", "#750B0E"];
|
|
38
|
+
const green = ["#354722", "#466631", "#649146", "#8AB25C", "#A9C97E"];
|
|
39
|
+
const blue = ["#002C61", "#004B8F", "#006BC9", "#3795E5", "#65B4F4"];
|
|
40
|
+
|
|
21
41
|
// *
|
|
22
42
|
// * Typography
|
|
23
43
|
// *
|
|
@@ -55,6 +75,17 @@ const strokeDasharray = "10, 5";
|
|
|
55
75
|
const strokeLinecap = "round";
|
|
56
76
|
const strokeLinejoin = "round";
|
|
57
77
|
const material = exports.material = {
|
|
78
|
+
palette: {
|
|
79
|
+
colors,
|
|
80
|
+
grayscale,
|
|
81
|
+
qualitative,
|
|
82
|
+
heatmap,
|
|
83
|
+
warm,
|
|
84
|
+
cool,
|
|
85
|
+
red,
|
|
86
|
+
green,
|
|
87
|
+
blue
|
|
88
|
+
},
|
|
58
89
|
area: Object.assign({
|
|
59
90
|
style: {
|
|
60
91
|
data: {
|
|
@@ -187,7 +218,7 @@ const material = exports.material = {
|
|
|
187
218
|
}
|
|
188
219
|
}, baseProps),
|
|
189
220
|
group: Object.assign({
|
|
190
|
-
colorScale
|
|
221
|
+
colorScale
|
|
191
222
|
}, baseProps),
|
|
192
223
|
histogram: Object.assign({
|
|
193
224
|
style: {
|
|
@@ -200,7 +231,7 @@ const material = exports.material = {
|
|
|
200
231
|
}
|
|
201
232
|
}, baseProps),
|
|
202
233
|
legend: {
|
|
203
|
-
colorScale
|
|
234
|
+
colorScale,
|
|
204
235
|
gutter: 10,
|
|
205
236
|
orientation: "vertical",
|
|
206
237
|
titleOrientation: "top",
|
|
@@ -226,7 +257,7 @@ const material = exports.material = {
|
|
|
226
257
|
}
|
|
227
258
|
}, baseProps),
|
|
228
259
|
pie: Object.assign({
|
|
229
|
-
colorScale
|
|
260
|
+
colorScale,
|
|
230
261
|
style: {
|
|
231
262
|
data: {
|
|
232
263
|
padding,
|
|
@@ -250,7 +281,7 @@ const material = exports.material = {
|
|
|
250
281
|
}
|
|
251
282
|
}, baseProps),
|
|
252
283
|
stack: Object.assign({
|
|
253
|
-
colorScale
|
|
284
|
+
colorScale
|
|
254
285
|
}, baseProps),
|
|
255
286
|
tooltip: {
|
|
256
287
|
style: Object.assign({}, baseLabelStyles, {
|
|
@@ -59,7 +59,22 @@ export interface VictoryAxisCommonProps {
|
|
|
59
59
|
tickValues?: any[];
|
|
60
60
|
}
|
|
61
61
|
export declare type VerticalAnchorType = "start" | "middle" | "end";
|
|
62
|
+
declare type VictoryThemePaletteKeys = "blue" | "pink" | "teal" | "purple" | "green" | "orange" | "cyan" | "red" | "yellow";
|
|
63
|
+
export declare type VictoryThemePalette = {
|
|
64
|
+
[key in VictoryThemePaletteKeys]?: string;
|
|
65
|
+
};
|
|
62
66
|
export interface VictoryThemeDefinition {
|
|
67
|
+
palette?: {
|
|
68
|
+
colors?: VictoryThemePalette;
|
|
69
|
+
grayscale?: string[];
|
|
70
|
+
qualitative?: string[];
|
|
71
|
+
heatmap?: string[];
|
|
72
|
+
warm?: string[];
|
|
73
|
+
cool?: string[];
|
|
74
|
+
red?: string[];
|
|
75
|
+
blue?: string[];
|
|
76
|
+
green?: string[];
|
|
77
|
+
};
|
|
63
78
|
area?: {
|
|
64
79
|
style?: {
|
|
65
80
|
data?: VictoryStyleObject;
|
|
@@ -152,6 +167,7 @@ export interface VictoryThemeDefinition {
|
|
|
152
167
|
offsetY?: number;
|
|
153
168
|
orientation?: OrientationTypes;
|
|
154
169
|
} & VictoryCommonThemeProps;
|
|
170
|
+
label?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
|
|
155
171
|
legend?: {
|
|
156
172
|
gutter?: number | BlockProps;
|
|
157
173
|
rowGutter?: number | BlockProps;
|
|
@@ -236,4 +252,5 @@ export interface VictoryThemeDefinition {
|
|
|
236
252
|
};
|
|
237
253
|
} & VictoryCommonThemeProps & VictoryDatableProps;
|
|
238
254
|
}
|
|
255
|
+
export {};
|
|
239
256
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -2,5 +2,6 @@ export * from "./types";
|
|
|
2
2
|
export declare const VictoryTheme: {
|
|
3
3
|
grayscale: import("./types").VictoryThemeDefinition;
|
|
4
4
|
material: import("./types").VictoryThemeDefinition;
|
|
5
|
+
clean: import("./types").VictoryThemeDefinition;
|
|
5
6
|
};
|
|
6
7
|
//# sourceMappingURL=victory-theme.d.ts.map
|
|
@@ -9,6 +9,7 @@ var _exportNames = {
|
|
|
9
9
|
exports.VictoryTheme = void 0;
|
|
10
10
|
var _grayscale = require("./grayscale");
|
|
11
11
|
var _material = require("./material");
|
|
12
|
+
var _clean = require("./clean");
|
|
12
13
|
var _types = require("./types");
|
|
13
14
|
Object.keys(_types).forEach(function (key) {
|
|
14
15
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -23,5 +24,6 @@ Object.keys(_types).forEach(function (key) {
|
|
|
23
24
|
});
|
|
24
25
|
const VictoryTheme = exports.VictoryTheme = {
|
|
25
26
|
grayscale: _grayscale.grayscale,
|
|
26
|
-
material: _material.material
|
|
27
|
+
material: _material.material,
|
|
28
|
+
clean: _clean.clean
|
|
27
29
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { VictoryThemeDefinition } from "../victory-theme/victory-theme";
|
|
1
2
|
/**
|
|
2
3
|
* Given an object with CSS/SVG transform definitions, return the string value
|
|
3
4
|
* for use with the `transform` CSS property or SVG attribute. Note that we
|
|
@@ -13,7 +14,8 @@ export declare const toTransformString: (obj: any, ...more: any[]) => any;
|
|
|
13
14
|
* of 5 hex string values in that color scale. If no 'name' parameter
|
|
14
15
|
* is given, it will return the Victory default grayscale.
|
|
15
16
|
* @param {String} name The name of the color scale to return (optional).
|
|
17
|
+
* @param {Object} theme The theme object to retrieve the color scale from (optional).
|
|
16
18
|
* @returns {Array} An array of 5 hex string values composing a color scale.
|
|
17
19
|
*/
|
|
18
|
-
export declare function getColorScale(name
|
|
20
|
+
export declare function getColorScale(name?: string, theme?: VictoryThemeDefinition): string[];
|
|
19
21
|
//# sourceMappingURL=style.d.ts.map
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getColorScale = getColorScale;
|
|
7
7
|
exports.toTransformString = void 0;
|
|
8
|
+
var _victoryTheme = require("../victory-theme/victory-theme");
|
|
8
9
|
/**
|
|
9
10
|
* Given an object with CSS/SVG transform definitions, return the string value
|
|
10
11
|
* for use with the `transform` CSS property or SVG attribute. Note that we
|
|
@@ -41,19 +42,36 @@ const toTransformString = function (obj) {
|
|
|
41
42
|
* of 5 hex string values in that color scale. If no 'name' parameter
|
|
42
43
|
* is given, it will return the Victory default grayscale.
|
|
43
44
|
* @param {String} name The name of the color scale to return (optional).
|
|
45
|
+
* @param {Object} theme The theme object to retrieve the color scale from (optional).
|
|
44
46
|
* @returns {Array} An array of 5 hex string values composing a color scale.
|
|
45
47
|
*/
|
|
46
48
|
exports.toTransformString = toTransformString;
|
|
47
|
-
function getColorScale(name) {
|
|
49
|
+
function getColorScale(name, theme) {
|
|
50
|
+
if (theme === void 0) {
|
|
51
|
+
theme = _victoryTheme.VictoryTheme.material;
|
|
52
|
+
}
|
|
53
|
+
const {
|
|
54
|
+
palette: {
|
|
55
|
+
grayscale = ["#cccccc", "#969696", "#636363", "#252525"],
|
|
56
|
+
qualitative = [],
|
|
57
|
+
heatmap = [],
|
|
58
|
+
warm = [],
|
|
59
|
+
cool = [],
|
|
60
|
+
red = [],
|
|
61
|
+
blue = [],
|
|
62
|
+
green = []
|
|
63
|
+
} = {}
|
|
64
|
+
} = theme;
|
|
48
65
|
const scales = {
|
|
49
|
-
grayscale
|
|
50
|
-
qualitative
|
|
51
|
-
heatmap
|
|
52
|
-
warm
|
|
53
|
-
cool
|
|
54
|
-
red
|
|
55
|
-
blue
|
|
56
|
-
green
|
|
66
|
+
grayscale,
|
|
67
|
+
qualitative,
|
|
68
|
+
heatmap,
|
|
69
|
+
warm,
|
|
70
|
+
cool,
|
|
71
|
+
red,
|
|
72
|
+
blue,
|
|
73
|
+
green
|
|
57
74
|
};
|
|
58
|
-
|
|
75
|
+
const selectedScale = name && scales[name]?.length ? scales[name] : scales.grayscale;
|
|
76
|
+
return selectedScale;
|
|
59
77
|
}
|
|
@@ -12,6 +12,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
12
12
|
|
|
13
13
|
// Based on measuring specific character widths
|
|
14
14
|
// as in the following example https://bl.ocks.org/tophtucker/62f93a4658387bb61e4510c37e2e97cf
|
|
15
|
+
// For new fonts: pull gist, open index.html locally, add font files (if not generic), enter font name in `font-family` input
|
|
15
16
|
// prettier-ignore
|
|
16
17
|
const fonts = {
|
|
17
18
|
"American Typewriter": {
|
|
@@ -70,6 +71,10 @@ const fonts = {
|
|
|
70
71
|
widths: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.2359375, 0.2234375, 0.3921875, 0.7125, 0.49375, 0.8859375, 0.771875, 0.2125, 0.3078125, 0.309375, 0.375, 0.4234375, 0.234375, 0.3125, 0.234375, 0.3, 0.5828125, 0.365625, 0.434375, 0.3921875, 0.5234375, 0.3984375, 0.5125, 0.4328125, 0.46875, 0.5125, 0.234375, 0.234375, 0.515625, 0.4234375, 0.515625, 0.340625, 0.7609375, 0.7359375, 0.6359375, 0.721875, 0.8125, 0.6375, 0.5875, 0.8078125, 0.853125, 0.4296875, 0.503125, 0.78125, 0.609375, 0.9609375, 0.8515625, 0.8140625, 0.6125, 0.8140625, 0.71875, 0.49375, 0.7125, 0.76875, 0.771875, 1.125, 0.7765625, 0.7734375, 0.65625, 0.321875, 0.3078125, 0.321875, 0.3546875, 0.5, 0.3375, 0.446875, 0.5359375, 0.45, 0.5296875, 0.4546875, 0.425, 0.4921875, 0.54375, 0.2671875, 0.240625, 0.5390625, 0.25, 0.815625, 0.5375, 0.5234375, 0.5390625, 0.5421875, 0.365625, 0.36875, 0.35625, 0.5171875, 0.5015625, 0.75, 0.5, 0.509375, 0.44375, 0.2421875, 0.14375, 0.2421875, 0.35],
|
|
71
72
|
avg: 0.5116447368421051
|
|
72
73
|
},
|
|
74
|
+
"Inter": {
|
|
75
|
+
widths: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.2796875, 0.2890625, 0.4671875, 0.634375, 0.6421875, 0.9828125, 0.6453125, 0.3, 0.365625, 0.365625, 0.5015625, 0.6625, 0.2890625, 0.4609375, 0.2890625, 0.3609375, 0.63125, 0.4078125, 0.6109375, 0.61875, 0.646875, 0.59375, 0.6203125, 0.5671875, 0.61875, 0.6203125, 0.2890625, 0.303125, 0.6625, 0.6625, 0.6625, 0.5125, 0.9671875, 0.690625, 0.6546875, 0.73125, 0.721875, 0.6015625, 0.590625, 0.746875, 0.74375, 0.26875, 0.571875, 0.671875, 0.565625, 0.9046875, 0.7546875, 0.765625, 0.6390625, 0.765625, 0.64375, 0.6421875, 0.646875, 0.7453125, 0.690625, 0.9859375, 0.6828125, 0.6796875, 0.6296875, 0.365625, 0.3609375, 0.365625, 0.471875, 0.45625, 0.3234375, 0.5625, 0.6125, 0.571875, 0.6125, 0.584375, 0.3703125, 0.6140625, 0.5921875, 0.2421875, 0.2548828125, 0.55, 0.2421875, 0.8765625, 0.5921875, 0.6, 0.6125, 0.6125, 0.3765625, 0.528125, 0.328125, 0.5921875, 0.5625, 0.81875, 0.546875, 0.5625, 0.553125, 0.4265625, 0.3328125, 0.4265625, 0.6625],
|
|
76
|
+
avg: 0.5624362664473683
|
|
77
|
+
},
|
|
73
78
|
"Montserrat": {
|
|
74
79
|
widths: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.2625, 0.2609375, 0.3734375, 0.696875, 0.615625, 0.8296875, 0.6703125, 0.203125, 0.3296875, 0.3296875, 0.3875, 0.575, 0.2125, 0.3828125, 0.2125, 0.3953125, 0.6625, 0.3625, 0.56875, 0.5640625, 0.6625, 0.5671875, 0.609375, 0.5890625, 0.6390625, 0.609375, 0.2125, 0.2125, 0.575, 0.575, 0.575, 0.5671875, 1.034375, 0.7171875, 0.7546875, 0.7203125, 0.8265625, 0.6703125, 0.634375, 0.7734375, 0.8140625, 0.303125, 0.5078125, 0.7125, 0.5890625, 0.95625, 0.8140625, 0.8390625, 0.71875, 0.8390625, 0.7234375, 0.615625, 0.575, 0.7921875, 0.6984375, 1.1125, 0.65625, 0.6359375, 0.6515625, 0.31875, 0.396875, 0.31875, 0.5765625, 0.5, 0.6, 0.590625, 0.678125, 0.5640625, 0.678125, 0.6046875, 0.375, 0.6875, 0.678125, 0.2703125, 0.365625, 0.6015625, 0.2703125, 1.0625, 0.678125, 0.628125, 0.678125, 0.678125, 0.4015625, 0.4890625, 0.40625, 0.6734375, 0.5421875, 0.8796875, 0.534375, 0.5671875, 0.5125, 0.334375, 0.2953125, 0.334375, 0.575],
|
|
75
80
|
avg: 0.571792763157895
|
|
@@ -14,9 +14,9 @@ export declare function getDomainFromChildren(props: any, axis: any, childCompon
|
|
|
14
14
|
export declare function getDomain(props: any, axis: any, childComponents: any): any;
|
|
15
15
|
export declare function getScale(props: any, axis: any, childComponents?: any): import("..").D3Scale<any>;
|
|
16
16
|
export declare function getAllEvents(props: any): any;
|
|
17
|
-
export declare function getColor(calculatedProps: any, child: any, index: any): any;
|
|
17
|
+
export declare function getColor(calculatedProps: any, child: any, index: any, theme: any): any;
|
|
18
18
|
export declare function getStyle(theme: any, style: any, role: any): any;
|
|
19
|
-
export declare function getChildStyle(child: any, index: any, calculatedProps: any): any;
|
|
19
|
+
export declare function getChildStyle(child: any, index: any, calculatedProps: any, theme: any): any;
|
|
20
20
|
export declare function getStringsFromCategories(childComponents: any, axis: any): any[];
|
|
21
21
|
export declare function getStringsFromData(childComponents: any): {
|
|
22
22
|
x: number[];
|
|
@@ -279,7 +279,9 @@ function getAllEvents(props) {
|
|
|
279
279
|
}
|
|
280
280
|
return events || [];
|
|
281
281
|
}
|
|
282
|
-
|
|
282
|
+
|
|
283
|
+
// eslint-disable-next-line max-params
|
|
284
|
+
function getColor(calculatedProps, child, index, theme) {
|
|
283
285
|
// check for styles first
|
|
284
286
|
const {
|
|
285
287
|
style
|
|
@@ -296,14 +298,16 @@ function getColor(calculatedProps, child, index) {
|
|
|
296
298
|
if (!colorScale && !color) {
|
|
297
299
|
return undefined;
|
|
298
300
|
}
|
|
299
|
-
const colors = Array.isArray(colorScale) ? colorScale : Style.getColorScale(colorScale);
|
|
301
|
+
const colors = Array.isArray(colorScale) ? colorScale : Style.getColorScale(colorScale, theme);
|
|
300
302
|
return color || colors[index % colors.length];
|
|
301
303
|
}
|
|
302
304
|
function getStyle(theme, style, role) {
|
|
303
305
|
const defaultStyle = theme && theme[role] && theme[role].style ? theme[role].style : {};
|
|
304
306
|
return Helpers.getStyles(style, defaultStyle);
|
|
305
307
|
}
|
|
306
|
-
|
|
308
|
+
|
|
309
|
+
// eslint-disable-next-line max-params
|
|
310
|
+
function getChildStyle(child, index, calculatedProps, theme) {
|
|
307
311
|
const {
|
|
308
312
|
style,
|
|
309
313
|
role
|
|
@@ -313,7 +317,7 @@ function getChildStyle(child, index, calculatedProps) {
|
|
|
313
317
|
return childStyle;
|
|
314
318
|
}
|
|
315
319
|
const childRole = child.type && child.type.role;
|
|
316
|
-
const defaultFill = childRole === "stack" ? undefined : getColor(calculatedProps, child, index);
|
|
320
|
+
const defaultFill = childRole === "stack" ? undefined : getColor(calculatedProps, child, index, theme);
|
|
317
321
|
const defaultColor = childRole === "line" ? {
|
|
318
322
|
fill: "none",
|
|
319
323
|
stroke: defaultFill
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "victory-core",
|
|
3
|
-
"version": "37.
|
|
3
|
+
"version": "37.2.0",
|
|
4
4
|
"description": "Victory Core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"data visualization",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"lodash": "^4.17.21",
|
|
24
24
|
"react-fast-compare": "^3.2.0",
|
|
25
|
-
"victory-vendor": "37.
|
|
25
|
+
"victory-vendor": "37.2.0"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"react": ">=16.6.0"
|
package/src/types/prop-types.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { defaults } from "lodash";
|
|
2
|
+
import { defaults, uniqueId } from "lodash";
|
|
3
3
|
import * as Log from "../victory-util/log";
|
|
4
4
|
import * as Helpers from "../victory-util/helpers";
|
|
5
5
|
import { usePortalContext } from "./portal-context";
|
|
@@ -15,7 +15,7 @@ const defaultProps: Partial<VictoryPortalProps> = {
|
|
|
15
15
|
|
|
16
16
|
export const VictoryPortal = (initialProps: VictoryPortalProps) => {
|
|
17
17
|
const props = { ...defaultProps, ...initialProps };
|
|
18
|
-
const id =
|
|
18
|
+
const id = uniqueId();
|
|
19
19
|
const portalContext = usePortalContext();
|
|
20
20
|
|
|
21
21
|
if (!portalContext) {
|