victory-core 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 +24 -0
- package/dist/victory-core.js +293 -168
- package/dist/victory-core.min.js +1 -1
- package/es/types/prop-types.d.ts +1 -0
- package/es/victory-portal/victory-portal.js +3 -2
- package/es/victory-theme/clean.js +86 -44
- package/es/victory-theme/grayscale.js +36 -6
- package/es/victory-theme/material.js +36 -5
- package/es/victory-theme/types.d.ts +16 -0
- package/es/victory-util/style.d.ts +3 -1
- package/es/victory-util/style.js +29 -10
- package/es/victory-util/wrapper.d.ts +3 -3
- package/es/victory-util/wrapper.js +16 -15
- package/lib/types/prop-types.d.ts +1 -0
- package/lib/victory-portal/victory-portal.js +3 -2
- package/lib/victory-theme/clean.js +86 -44
- package/lib/victory-theme/grayscale.js +36 -6
- package/lib/victory-theme/material.js +36 -5
- package/lib/victory-theme/types.d.ts +16 -0
- package/lib/victory-util/style.d.ts +3 -1
- package/lib/victory-util/style.js +28 -10
- package/lib/victory-util/wrapper.d.ts +3 -3
- package/lib/victory-util/wrapper.js +17 -16
- package/package.json +2 -2
- package/src/types/prop-types.ts +1 -0
- package/src/victory-portal/victory-portal.tsx +3 -3
- package/src/victory-theme/clean.tsx +104 -45
- package/src/victory-theme/grayscale.tsx +49 -6
- package/src/victory-theme/material.tsx +50 -6
- package/src/victory-theme/types.ts +26 -0
- package/src/victory-util/style.ts +37 -22
- package/src/victory-util/wrapper.tsx +18 -27
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _isPlainObject from "lodash/isPlainObject";
|
|
2
1
|
import _uniqBy from "lodash/uniqBy";
|
|
3
2
|
import _groupBy from "lodash/groupBy";
|
|
4
3
|
import _uniq from "lodash/uniq";
|
|
@@ -254,7 +253,9 @@ export function getAllEvents(props) {
|
|
|
254
253
|
}
|
|
255
254
|
return events || [];
|
|
256
255
|
}
|
|
257
|
-
|
|
256
|
+
|
|
257
|
+
// eslint-disable-next-line max-params
|
|
258
|
+
export function getColor(calculatedProps, child, index, theme) {
|
|
258
259
|
// check for styles first
|
|
259
260
|
const {
|
|
260
261
|
style
|
|
@@ -271,14 +272,16 @@ export function getColor(calculatedProps, child, index) {
|
|
|
271
272
|
if (!colorScale && !color) {
|
|
272
273
|
return undefined;
|
|
273
274
|
}
|
|
274
|
-
const colors = Array.isArray(colorScale) ? colorScale : Style.getColorScale(colorScale);
|
|
275
|
+
const colors = Array.isArray(colorScale) ? colorScale : Style.getColorScale(colorScale, theme);
|
|
275
276
|
return color || colors[index % colors.length];
|
|
276
277
|
}
|
|
277
278
|
export function getStyle(theme, style, role) {
|
|
278
279
|
const defaultStyle = theme && theme[role] && theme[role].style ? theme[role].style : {};
|
|
279
280
|
return Helpers.getStyles(style, defaultStyle);
|
|
280
281
|
}
|
|
281
|
-
|
|
282
|
+
|
|
283
|
+
// eslint-disable-next-line max-params
|
|
284
|
+
export function getChildStyle(child, index, calculatedProps, theme) {
|
|
282
285
|
const {
|
|
283
286
|
style,
|
|
284
287
|
role
|
|
@@ -288,7 +291,7 @@ export function getChildStyle(child, index, calculatedProps) {
|
|
|
288
291
|
return childStyle;
|
|
289
292
|
}
|
|
290
293
|
const childRole = child.type && child.type.role;
|
|
291
|
-
const defaultFill = childRole === "stack" ? undefined : getColor(calculatedProps, child, index);
|
|
294
|
+
const defaultFill = childRole === "stack" ? undefined : getColor(calculatedProps, child, index, theme);
|
|
292
295
|
const defaultColor = childRole === "line" ? {
|
|
293
296
|
fill: "none",
|
|
294
297
|
stroke: defaultFill
|
|
@@ -307,15 +310,13 @@ export function getChildStyle(child, index, calculatedProps) {
|
|
|
307
310
|
labels: labelsStyle
|
|
308
311
|
};
|
|
309
312
|
}
|
|
310
|
-
export function
|
|
313
|
+
export function getStringsFromChildrenCategories(childComponents, axis) {
|
|
311
314
|
const iteratee = child => {
|
|
312
|
-
|
|
313
|
-
if (!Domain.isDomainComponent(child) || !childProps.categories) {
|
|
315
|
+
if (!Domain.isDomainComponent(child)) {
|
|
314
316
|
return null;
|
|
315
317
|
}
|
|
316
|
-
const
|
|
317
|
-
|
|
318
|
-
return categoryStrings ? Collection.removeUndefined(categoryStrings) : [];
|
|
318
|
+
const childProps = child.props || {};
|
|
319
|
+
return Data.getStringsFromCategories(childProps, axis);
|
|
319
320
|
};
|
|
320
321
|
return Helpers.reduceChildren(childComponents.slice(0), iteratee);
|
|
321
322
|
}
|
|
@@ -350,10 +351,10 @@ export function getStringsFromData(childComponents) {
|
|
|
350
351
|
return Helpers.reduceChildren(childComponents.slice(0), iteratee, {}, initialMemo, combine);
|
|
351
352
|
}
|
|
352
353
|
export function getCategoryAndAxisStringsFromChildren(props, axis, childComponents) {
|
|
353
|
-
const categories =
|
|
354
|
+
const categories = Data.getStringsFromCategories(props, axis);
|
|
354
355
|
const axisComponent = Axis.getAxisComponent(childComponents, axis);
|
|
355
356
|
const axisStrings = axisComponent ? Data.getStringsFromAxes(axisComponent.props, axis) : [];
|
|
356
|
-
const categoryStrings = categories
|
|
357
|
+
const categoryStrings = categories.length ? categories : getStringsFromChildrenCategories(childComponents, axis);
|
|
357
358
|
return _uniq([...categoryStrings, ...axisStrings].flat());
|
|
358
359
|
}
|
|
359
360
|
export function getStringsFromChildren(props, childComponents) {
|
|
@@ -367,8 +368,8 @@ export function getStringsFromChildren(props, childComponents) {
|
|
|
367
368
|
};
|
|
368
369
|
}
|
|
369
370
|
export function getCategories(props, childComponents, allStrings) {
|
|
370
|
-
const xPropCategories = props.categories &&
|
|
371
|
-
const yPropCategories = props.categories &&
|
|
371
|
+
const xPropCategories = props.categories && Data.getStringsFromCategories(props, "x");
|
|
372
|
+
const yPropCategories = props.categories && Data.getStringsFromCategories(props, "y");
|
|
372
373
|
const fallbackRequired = !xPropCategories || !yPropCategories;
|
|
373
374
|
const fallbackProps = fallbackRequired ? allStrings || getStringsFromChildren(props, childComponents) : {};
|
|
374
375
|
const xCategories = xPropCategories || fallbackProps.x;
|
|
@@ -4,8 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.VictoryPortal = void 0;
|
|
7
|
+
var _uniqueId2 = _interopRequireDefault(require("lodash/uniqueId"));
|
|
7
8
|
var _defaults2 = _interopRequireDefault(require("lodash/defaults"));
|
|
8
|
-
var _react =
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
10
|
var Log = _interopRequireWildcard(require("../victory-util/log"));
|
|
10
11
|
var Helpers = _interopRequireWildcard(require("../victory-util/helpers"));
|
|
11
12
|
var _portalContext = require("./portal-context");
|
|
@@ -20,7 +21,7 @@ const VictoryPortal = initialProps => {
|
|
|
20
21
|
...defaultProps,
|
|
21
22
|
...initialProps
|
|
22
23
|
};
|
|
23
|
-
const id = _react.default
|
|
24
|
+
const [id] = (0, _react.useState)((0, _uniqueId2.default)());
|
|
24
25
|
const portalContext = (0, _portalContext.usePortalContext)();
|
|
25
26
|
if (!portalContext) {
|
|
26
27
|
const msg = "`renderInPortal` is not supported outside of `VictoryContainer`. " + "Component will be rendered in place";
|
|
@@ -32,20 +32,16 @@ const orange = {
|
|
|
32
32
|
"100": "#FEE2D5",
|
|
33
33
|
"300": "#FFA981",
|
|
34
34
|
"500": "#FF6F2C",
|
|
35
|
+
"700": "#FF4E1B",
|
|
35
36
|
"900": "#D74D26"
|
|
36
37
|
};
|
|
37
38
|
const red = {
|
|
38
39
|
"100": "#FFDCE5",
|
|
39
40
|
"300": "#FF9EB7",
|
|
40
41
|
"500": "#F82B60",
|
|
42
|
+
"700": "#D31A3D",
|
|
41
43
|
"900": "#BA1E45"
|
|
42
44
|
};
|
|
43
|
-
const pink = {
|
|
44
|
-
"100": "#FFDAF6",
|
|
45
|
-
"300": "#F99DE2",
|
|
46
|
-
"500": "#FF08C2",
|
|
47
|
-
"900": "#B2158B"
|
|
48
|
-
};
|
|
49
45
|
const purple = {
|
|
50
46
|
"100": "#EDE3FE",
|
|
51
47
|
"300": "#CDB0FF",
|
|
@@ -56,6 +52,7 @@ const blue = {
|
|
|
56
52
|
"100": "#CFDFFF",
|
|
57
53
|
"300": "#9CC7FF",
|
|
58
54
|
"500": "#2D7FF9",
|
|
55
|
+
"700": "#0056B3",
|
|
59
56
|
"900": "#2750AE"
|
|
60
57
|
};
|
|
61
58
|
const cyan = {
|
|
@@ -74,9 +71,29 @@ const green = {
|
|
|
74
71
|
"100": "#D1F7C4",
|
|
75
72
|
"300": "#93E088",
|
|
76
73
|
"500": "#20C933",
|
|
74
|
+
"700": "#1B9B2A",
|
|
77
75
|
"900": "#338A17"
|
|
78
76
|
};
|
|
79
|
-
const colors =
|
|
77
|
+
const colors = {
|
|
78
|
+
blue: blue["500"],
|
|
79
|
+
cyan: cyan["500"],
|
|
80
|
+
green: green["500"],
|
|
81
|
+
yellow: yellow["500"],
|
|
82
|
+
orange: orange["500"],
|
|
83
|
+
red: red["500"],
|
|
84
|
+
purple: purple["500"],
|
|
85
|
+
teal: teal["500"]
|
|
86
|
+
};
|
|
87
|
+
const colorScale = Object.values(colors);
|
|
88
|
+
const grayscale = [gray["100"], gray["300"], gray["500"], gray["700"], gray["900"]];
|
|
89
|
+
const warm = [yellow["300"], yellow["500"], orange["500"], orange["900"], red["500"]];
|
|
90
|
+
const cool = [purple["500"], blue["500"], cyan["500"], teal["500"], green["500"]];
|
|
91
|
+
const heatmap = [green["900"], green["500"], yellow["500"], orange["500"], red["500"]];
|
|
92
|
+
const redPalette = Object.values(red);
|
|
93
|
+
const greenPalette = Object.values(green);
|
|
94
|
+
const bluePalette = Object.values(blue);
|
|
95
|
+
const defaultColor = blue["500"];
|
|
96
|
+
|
|
80
97
|
// *
|
|
81
98
|
// * Typography
|
|
82
99
|
// *
|
|
@@ -90,8 +107,8 @@ const padding = 8;
|
|
|
90
107
|
const baseProps = {
|
|
91
108
|
width: 450,
|
|
92
109
|
height: 300,
|
|
93
|
-
padding:
|
|
94
|
-
colorScale
|
|
110
|
+
padding: 60,
|
|
111
|
+
colorScale
|
|
95
112
|
};
|
|
96
113
|
// *
|
|
97
114
|
// * Labels
|
|
@@ -120,10 +137,23 @@ const borderRadius = 1;
|
|
|
120
137
|
// * Theme
|
|
121
138
|
// *
|
|
122
139
|
const clean = exports.clean = {
|
|
140
|
+
palette: {
|
|
141
|
+
colors,
|
|
142
|
+
grayscale,
|
|
143
|
+
qualitative: colorScale,
|
|
144
|
+
heatmap,
|
|
145
|
+
warm,
|
|
146
|
+
cool,
|
|
147
|
+
red: redPalette,
|
|
148
|
+
green: greenPalette,
|
|
149
|
+
blue: bluePalette
|
|
150
|
+
},
|
|
123
151
|
area: Object.assign({
|
|
124
152
|
style: {
|
|
125
153
|
data: {
|
|
126
|
-
fill:
|
|
154
|
+
fill: defaultColor,
|
|
155
|
+
strokeWidth: 2,
|
|
156
|
+
fillOpacity: 0.5
|
|
127
157
|
},
|
|
128
158
|
labels: baseLabelStyles
|
|
129
159
|
}
|
|
@@ -132,13 +162,13 @@ const clean = exports.clean = {
|
|
|
132
162
|
style: {
|
|
133
163
|
axis: {
|
|
134
164
|
fill: "transparent",
|
|
135
|
-
stroke: gray["
|
|
165
|
+
stroke: gray["500"],
|
|
136
166
|
strokeWidth: 1,
|
|
137
167
|
strokeLinecap,
|
|
138
168
|
strokeLinejoin
|
|
139
169
|
},
|
|
140
170
|
axisLabel: Object.assign({}, centeredLabelStyles, {
|
|
141
|
-
padding,
|
|
171
|
+
padding: 35,
|
|
142
172
|
stroke: "transparent"
|
|
143
173
|
}),
|
|
144
174
|
grid: {
|
|
@@ -157,10 +187,10 @@ const clean = exports.clean = {
|
|
|
157
187
|
polarAxis: Object.assign({
|
|
158
188
|
style: {
|
|
159
189
|
axis: {
|
|
160
|
-
stroke: gray["
|
|
190
|
+
stroke: gray["500"]
|
|
161
191
|
},
|
|
162
192
|
grid: {
|
|
163
|
-
stroke: gray["
|
|
193
|
+
stroke: gray["400"],
|
|
164
194
|
strokeDasharray,
|
|
165
195
|
strokeLinecap,
|
|
166
196
|
strokeLinejoin,
|
|
@@ -169,7 +199,7 @@ const clean = exports.clean = {
|
|
|
169
199
|
ticks: {
|
|
170
200
|
fill: "transparent",
|
|
171
201
|
size: 5,
|
|
172
|
-
stroke: gray["
|
|
202
|
+
stroke: gray["400"],
|
|
173
203
|
strokeWidth: 1,
|
|
174
204
|
strokeLinecap,
|
|
175
205
|
strokeLinejoin
|
|
@@ -180,10 +210,10 @@ const clean = exports.clean = {
|
|
|
180
210
|
polarDependentAxis: Object.assign({
|
|
181
211
|
style: {
|
|
182
212
|
axis: {
|
|
183
|
-
stroke: gray["
|
|
213
|
+
stroke: gray["500"]
|
|
184
214
|
},
|
|
185
215
|
grid: {
|
|
186
|
-
stroke: gray["
|
|
216
|
+
stroke: gray["400"],
|
|
187
217
|
strokeDasharray,
|
|
188
218
|
strokeLinecap,
|
|
189
219
|
strokeLinejoin,
|
|
@@ -192,7 +222,7 @@ const clean = exports.clean = {
|
|
|
192
222
|
ticks: {
|
|
193
223
|
fill: "transparent",
|
|
194
224
|
size: 5,
|
|
195
|
-
stroke: gray["
|
|
225
|
+
stroke: gray["300"],
|
|
196
226
|
strokeWidth: 1,
|
|
197
227
|
strokeLinecap,
|
|
198
228
|
strokeLinejoin
|
|
@@ -203,9 +233,10 @@ const clean = exports.clean = {
|
|
|
203
233
|
bar: Object.assign({
|
|
204
234
|
style: {
|
|
205
235
|
data: {
|
|
206
|
-
fill:
|
|
236
|
+
fill: defaultColor,
|
|
207
237
|
padding,
|
|
208
|
-
strokeWidth:
|
|
238
|
+
strokeWidth: 1,
|
|
239
|
+
fillOpacity: 0.5
|
|
209
240
|
},
|
|
210
241
|
labels: baseLabelStyles
|
|
211
242
|
},
|
|
@@ -241,15 +272,16 @@ const clean = exports.clean = {
|
|
|
241
272
|
}),
|
|
242
273
|
q1: {
|
|
243
274
|
padding,
|
|
244
|
-
fill:
|
|
245
|
-
rx: borderRadius
|
|
275
|
+
fill: colorScale[0],
|
|
276
|
+
rx: borderRadius,
|
|
277
|
+
strokeWidth: 2
|
|
246
278
|
},
|
|
247
279
|
q1Labels: Object.assign({}, baseLabelStyles, {
|
|
248
280
|
padding: 3
|
|
249
281
|
}),
|
|
250
282
|
q3: {
|
|
251
283
|
padding,
|
|
252
|
-
fill:
|
|
284
|
+
fill: colorScale[1],
|
|
253
285
|
rx: borderRadius
|
|
254
286
|
},
|
|
255
287
|
q3Labels: Object.assign({}, baseLabelStyles, {
|
|
@@ -270,8 +302,8 @@ const clean = exports.clean = {
|
|
|
270
302
|
})
|
|
271
303
|
},
|
|
272
304
|
candleColors: {
|
|
273
|
-
positive:
|
|
274
|
-
negative:
|
|
305
|
+
positive: green["500"],
|
|
306
|
+
negative: red["500"]
|
|
275
307
|
},
|
|
276
308
|
wickStrokeWidth: 2
|
|
277
309
|
}, baseProps),
|
|
@@ -290,14 +322,13 @@ const clean = exports.clean = {
|
|
|
290
322
|
}
|
|
291
323
|
}, baseProps),
|
|
292
324
|
group: Object.assign({
|
|
293
|
-
colorScale
|
|
325
|
+
colorScale
|
|
294
326
|
}, baseProps),
|
|
295
327
|
histogram: Object.assign({
|
|
296
328
|
style: {
|
|
297
329
|
data: {
|
|
298
330
|
fill: cyan["500"],
|
|
299
|
-
|
|
300
|
-
strokeWidth: 0
|
|
331
|
+
fillOpacity: 0.5
|
|
301
332
|
},
|
|
302
333
|
labels: baseLabelStyles
|
|
303
334
|
},
|
|
@@ -308,21 +339,23 @@ const clean = exports.clean = {
|
|
|
308
339
|
}, baseProps),
|
|
309
340
|
label: baseLabelStyles,
|
|
310
341
|
legend: {
|
|
311
|
-
colorScale
|
|
312
|
-
gutter:
|
|
313
|
-
|
|
342
|
+
colorScale,
|
|
343
|
+
gutter: 24,
|
|
344
|
+
borderPadding: 10,
|
|
345
|
+
orientation: "horizontal",
|
|
314
346
|
titleOrientation: "top",
|
|
347
|
+
centerTitle: true,
|
|
315
348
|
style: {
|
|
316
349
|
data: {
|
|
317
350
|
type: "circle"
|
|
318
351
|
},
|
|
319
352
|
labels: {
|
|
320
353
|
...baseLabelStyles,
|
|
321
|
-
fontSize:
|
|
354
|
+
fontSize: 12
|
|
322
355
|
},
|
|
323
356
|
title: Object.assign({}, baseLabelStyles, {
|
|
324
357
|
padding,
|
|
325
|
-
fontSize:
|
|
358
|
+
fontSize: 16
|
|
326
359
|
}),
|
|
327
360
|
border: {
|
|
328
361
|
stroke: gray["200"],
|
|
@@ -336,7 +369,7 @@ const clean = exports.clean = {
|
|
|
336
369
|
data: {
|
|
337
370
|
fill: "transparent",
|
|
338
371
|
opacity: 1,
|
|
339
|
-
stroke:
|
|
372
|
+
stroke: defaultColor,
|
|
340
373
|
strokeWidth: 2,
|
|
341
374
|
strokeLinecap,
|
|
342
375
|
strokeLinejoin
|
|
@@ -346,31 +379,40 @@ const clean = exports.clean = {
|
|
|
346
379
|
}, baseProps),
|
|
347
380
|
pie: Object.assign({
|
|
348
381
|
style: {
|
|
382
|
+
parent: {
|
|
383
|
+
backgroundColor: gray.white
|
|
384
|
+
},
|
|
349
385
|
data: {
|
|
350
386
|
padding,
|
|
351
387
|
stroke: gray.white,
|
|
352
388
|
strokeWidth: 1
|
|
353
389
|
},
|
|
354
|
-
labels:
|
|
355
|
-
|
|
356
|
-
|
|
390
|
+
labels: {
|
|
391
|
+
...baseLabelStyles,
|
|
392
|
+
padding: 20,
|
|
393
|
+
fill: gray["600"],
|
|
394
|
+
fontSize: 10
|
|
395
|
+
}
|
|
357
396
|
},
|
|
358
|
-
colorScale
|
|
397
|
+
colorScale,
|
|
359
398
|
cornerRadius: borderRadius
|
|
360
399
|
}, baseProps),
|
|
361
400
|
scatter: Object.assign({
|
|
362
401
|
style: {
|
|
363
402
|
data: {
|
|
364
|
-
fill:
|
|
403
|
+
fill: defaultColor,
|
|
365
404
|
opacity: 1,
|
|
366
405
|
stroke: "transparent",
|
|
367
406
|
strokeWidth: 0
|
|
368
407
|
},
|
|
369
|
-
labels:
|
|
408
|
+
labels: {
|
|
409
|
+
...baseLabelStyles,
|
|
410
|
+
padding: 20
|
|
411
|
+
}
|
|
370
412
|
}
|
|
371
413
|
}, baseProps),
|
|
372
414
|
stack: Object.assign({
|
|
373
|
-
colorScale
|
|
415
|
+
colorScale
|
|
374
416
|
}, baseProps),
|
|
375
417
|
tooltip: {
|
|
376
418
|
style: Object.assign({}, baseLabelStyles, {
|
|
@@ -378,7 +420,7 @@ const clean = exports.clean = {
|
|
|
378
420
|
pointerEvents: "none"
|
|
379
421
|
}),
|
|
380
422
|
flyoutStyle: {
|
|
381
|
-
stroke: gray["
|
|
423
|
+
stroke: gray["300"],
|
|
382
424
|
strokeWidth: 2,
|
|
383
425
|
fill: gray.white,
|
|
384
426
|
pointerEvents: "none"
|
|
@@ -395,8 +437,8 @@ const clean = exports.clean = {
|
|
|
395
437
|
voronoi: Object.assign({
|
|
396
438
|
style: {
|
|
397
439
|
data: {
|
|
398
|
-
fill:
|
|
399
|
-
stroke:
|
|
440
|
+
fill: blue["100"],
|
|
441
|
+
stroke: defaultColor,
|
|
400
442
|
strokeWidth: 2
|
|
401
443
|
},
|
|
402
444
|
labels: Object.assign({}, baseLabelStyles, {
|
|
@@ -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;
|
|
@@ -237,4 +252,5 @@ export interface VictoryThemeDefinition {
|
|
|
237
252
|
};
|
|
238
253
|
} & VictoryCommonThemeProps & VictoryDatableProps;
|
|
239
254
|
}
|
|
255
|
+
export {};
|
|
240
256
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -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
|