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
|
@@ -0,0 +1,448 @@
|
|
|
1
|
+
import { VictoryThemeDefinition } from "./victory-theme";
|
|
2
|
+
|
|
3
|
+
// *
|
|
4
|
+
// * Colors
|
|
5
|
+
// *
|
|
6
|
+
|
|
7
|
+
const gray = {
|
|
8
|
+
white: "#FFFFFF",
|
|
9
|
+
"50": "#FAFAFA",
|
|
10
|
+
"100": "#F2F2F2",
|
|
11
|
+
"200": "#E8E8E8",
|
|
12
|
+
"300": "#E0E0E0",
|
|
13
|
+
"400": "#D1D1D1",
|
|
14
|
+
"500": "#757575",
|
|
15
|
+
"600": "#5C5C5C",
|
|
16
|
+
"700": "#424242",
|
|
17
|
+
"800": "#333333",
|
|
18
|
+
"900": "#292929",
|
|
19
|
+
black: "#0F0F0F",
|
|
20
|
+
};
|
|
21
|
+
const yellow = {
|
|
22
|
+
"100": "#FFEAB6",
|
|
23
|
+
"300": "#FFD66E",
|
|
24
|
+
"500": "#FCB400",
|
|
25
|
+
"900": "#B87503",
|
|
26
|
+
};
|
|
27
|
+
const orange = {
|
|
28
|
+
"100": "#FEE2D5",
|
|
29
|
+
"300": "#FFA981",
|
|
30
|
+
"500": "#FF6F2C",
|
|
31
|
+
"900": "#D74D26",
|
|
32
|
+
};
|
|
33
|
+
const red = {
|
|
34
|
+
"100": "#FFDCE5",
|
|
35
|
+
"300": "#FF9EB7",
|
|
36
|
+
"500": "#F82B60",
|
|
37
|
+
"900": "#BA1E45",
|
|
38
|
+
};
|
|
39
|
+
const pink = {
|
|
40
|
+
"100": "#FFDAF6",
|
|
41
|
+
"300": "#F99DE2",
|
|
42
|
+
"500": "#FF08C2",
|
|
43
|
+
"900": "#B2158B",
|
|
44
|
+
};
|
|
45
|
+
const purple = {
|
|
46
|
+
"100": "#EDE3FE",
|
|
47
|
+
"300": "#CDB0FF",
|
|
48
|
+
"500": "#8B46FF",
|
|
49
|
+
"900": "#6B1CB0",
|
|
50
|
+
};
|
|
51
|
+
const blue = {
|
|
52
|
+
"100": "#CFDFFF",
|
|
53
|
+
"300": "#9CC7FF",
|
|
54
|
+
"500": "#2D7FF9",
|
|
55
|
+
"900": "#2750AE",
|
|
56
|
+
};
|
|
57
|
+
const cyan = {
|
|
58
|
+
"100": "#D0F0FD",
|
|
59
|
+
"300": "#77D1F3",
|
|
60
|
+
"500": "#18BFFF",
|
|
61
|
+
"900": "#0B76B7",
|
|
62
|
+
};
|
|
63
|
+
const teal = {
|
|
64
|
+
"100": "#C2F5E9",
|
|
65
|
+
"300": "#72DDC3",
|
|
66
|
+
"500": "#20D9D2",
|
|
67
|
+
"900": "#06A09B",
|
|
68
|
+
};
|
|
69
|
+
const green = {
|
|
70
|
+
"100": "#D1F7C4",
|
|
71
|
+
"300": "#93E088",
|
|
72
|
+
"500": "#20C933",
|
|
73
|
+
"900": "#338A17",
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const colors = {
|
|
77
|
+
blue: blue["500"],
|
|
78
|
+
pink: pink["500"],
|
|
79
|
+
teal: teal["500"],
|
|
80
|
+
purple: purple["500"],
|
|
81
|
+
green: green["500"],
|
|
82
|
+
orange: orange["500"],
|
|
83
|
+
cyan: cyan["500"],
|
|
84
|
+
red: red["500"],
|
|
85
|
+
yellow: yellow["500"],
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const colorScale = Object.values(colors);
|
|
89
|
+
const grayscale = [gray["200"], gray["400"], gray["600"], gray["900"]];
|
|
90
|
+
const warm = [yellow["500"], orange["500"], red["500"], pink["500"]];
|
|
91
|
+
const cool = [cyan["500"], teal["500"], blue["500"], purple["500"]];
|
|
92
|
+
const heatmap = [green["500"], yellow["500"], red["500"]];
|
|
93
|
+
const redPalette = [red["500"], red["300"], red["100"]];
|
|
94
|
+
const greenPalette = [green["500"], green["300"], green["100"]];
|
|
95
|
+
const bluePalette = [blue["500"], blue["300"], blue["100"]];
|
|
96
|
+
|
|
97
|
+
// *
|
|
98
|
+
// * Typography
|
|
99
|
+
// *
|
|
100
|
+
const sansSerif =
|
|
101
|
+
"'Inter', 'Helvetica Neue', 'Seravek', 'Helvetica', sans-serif";
|
|
102
|
+
const letterSpacing = "normal";
|
|
103
|
+
const fontSize = 12;
|
|
104
|
+
// *
|
|
105
|
+
// * Layout
|
|
106
|
+
// *
|
|
107
|
+
const padding = 8;
|
|
108
|
+
const baseProps = {
|
|
109
|
+
width: 450,
|
|
110
|
+
height: 300,
|
|
111
|
+
padding: 50,
|
|
112
|
+
colorScale,
|
|
113
|
+
};
|
|
114
|
+
// *
|
|
115
|
+
// * Labels
|
|
116
|
+
// *
|
|
117
|
+
const baseLabelStyles = {
|
|
118
|
+
fontFamily: sansSerif,
|
|
119
|
+
fontSize,
|
|
120
|
+
fontWeight: 300,
|
|
121
|
+
letterSpacing,
|
|
122
|
+
padding,
|
|
123
|
+
fill: gray["900"],
|
|
124
|
+
stroke: "transparent",
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
const centeredLabelStyles = Object.assign(
|
|
128
|
+
{ textAnchor: "middle" },
|
|
129
|
+
baseLabelStyles,
|
|
130
|
+
);
|
|
131
|
+
|
|
132
|
+
// *
|
|
133
|
+
// * Strokes
|
|
134
|
+
// *
|
|
135
|
+
const strokeDasharray = "10, 5";
|
|
136
|
+
const strokeLinecap = "round";
|
|
137
|
+
const strokeLinejoin = "round";
|
|
138
|
+
const borderRadius = 1;
|
|
139
|
+
// *
|
|
140
|
+
// * Theme
|
|
141
|
+
// *
|
|
142
|
+
export const clean: VictoryThemeDefinition = {
|
|
143
|
+
palette: {
|
|
144
|
+
colors,
|
|
145
|
+
grayscale,
|
|
146
|
+
qualitative: colorScale,
|
|
147
|
+
heatmap,
|
|
148
|
+
warm,
|
|
149
|
+
cool,
|
|
150
|
+
red: redPalette,
|
|
151
|
+
green: greenPalette,
|
|
152
|
+
blue: bluePalette,
|
|
153
|
+
},
|
|
154
|
+
area: Object.assign(
|
|
155
|
+
{
|
|
156
|
+
style: {
|
|
157
|
+
data: {
|
|
158
|
+
fill: blue["500"],
|
|
159
|
+
strokeWidth: 2,
|
|
160
|
+
fillOpacity: 0.5,
|
|
161
|
+
},
|
|
162
|
+
labels: baseLabelStyles,
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
baseProps,
|
|
166
|
+
),
|
|
167
|
+
axis: Object.assign(
|
|
168
|
+
{
|
|
169
|
+
style: {
|
|
170
|
+
axis: {
|
|
171
|
+
fill: "transparent",
|
|
172
|
+
stroke: gray["500"],
|
|
173
|
+
strokeWidth: 1,
|
|
174
|
+
strokeLinecap,
|
|
175
|
+
strokeLinejoin,
|
|
176
|
+
},
|
|
177
|
+
axisLabel: Object.assign({}, centeredLabelStyles, {
|
|
178
|
+
padding,
|
|
179
|
+
stroke: "transparent",
|
|
180
|
+
}),
|
|
181
|
+
grid: {
|
|
182
|
+
fill: "none",
|
|
183
|
+
stroke: "none",
|
|
184
|
+
painterEvents: "painted",
|
|
185
|
+
},
|
|
186
|
+
ticks: {
|
|
187
|
+
fill: "transparent",
|
|
188
|
+
size: 5,
|
|
189
|
+
stroke: "transparent",
|
|
190
|
+
},
|
|
191
|
+
tickLabels: baseLabelStyles,
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
baseProps,
|
|
195
|
+
),
|
|
196
|
+
polarAxis: Object.assign({
|
|
197
|
+
style: {
|
|
198
|
+
axis: {
|
|
199
|
+
stroke: gray["500"],
|
|
200
|
+
},
|
|
201
|
+
grid: {
|
|
202
|
+
stroke: gray["400"],
|
|
203
|
+
strokeDasharray,
|
|
204
|
+
strokeLinecap,
|
|
205
|
+
strokeLinejoin,
|
|
206
|
+
pointerEvents: "painted",
|
|
207
|
+
},
|
|
208
|
+
ticks: {
|
|
209
|
+
fill: "transparent",
|
|
210
|
+
size: 5,
|
|
211
|
+
stroke: gray["400"],
|
|
212
|
+
strokeWidth: 1,
|
|
213
|
+
strokeLinecap,
|
|
214
|
+
strokeLinejoin,
|
|
215
|
+
},
|
|
216
|
+
tickLabels: baseLabelStyles,
|
|
217
|
+
},
|
|
218
|
+
}),
|
|
219
|
+
polarDependentAxis: Object.assign({
|
|
220
|
+
style: {
|
|
221
|
+
axis: {
|
|
222
|
+
stroke: gray["500"],
|
|
223
|
+
},
|
|
224
|
+
grid: {
|
|
225
|
+
stroke: gray["400"],
|
|
226
|
+
strokeDasharray,
|
|
227
|
+
strokeLinecap,
|
|
228
|
+
strokeLinejoin,
|
|
229
|
+
pointerEvents: "painted",
|
|
230
|
+
},
|
|
231
|
+
ticks: {
|
|
232
|
+
fill: "transparent",
|
|
233
|
+
size: 5,
|
|
234
|
+
stroke: gray["300"],
|
|
235
|
+
strokeWidth: 1,
|
|
236
|
+
strokeLinecap,
|
|
237
|
+
strokeLinejoin,
|
|
238
|
+
},
|
|
239
|
+
tickLabels: baseLabelStyles,
|
|
240
|
+
},
|
|
241
|
+
}),
|
|
242
|
+
bar: Object.assign(
|
|
243
|
+
{
|
|
244
|
+
style: {
|
|
245
|
+
data: {
|
|
246
|
+
fill: blue["500"],
|
|
247
|
+
padding,
|
|
248
|
+
strokeWidth: 1,
|
|
249
|
+
fillOpacity: 0.5,
|
|
250
|
+
},
|
|
251
|
+
labels: baseLabelStyles,
|
|
252
|
+
},
|
|
253
|
+
cornerRadius: { top: borderRadius },
|
|
254
|
+
},
|
|
255
|
+
baseProps,
|
|
256
|
+
),
|
|
257
|
+
boxplot: Object.assign(
|
|
258
|
+
{
|
|
259
|
+
style: {
|
|
260
|
+
max: { padding, stroke: gray["400"], strokeWidth: 2 },
|
|
261
|
+
maxLabels: Object.assign({}, baseLabelStyles, { padding: 3 }),
|
|
262
|
+
median: { padding, stroke: gray.white, strokeWidth: 2 },
|
|
263
|
+
medianLabels: Object.assign({}, baseLabelStyles, { padding: 3 }),
|
|
264
|
+
min: { padding, stroke: gray["400"], strokeWidth: 2 },
|
|
265
|
+
minLabels: Object.assign({}, baseLabelStyles, { padding: 3 }),
|
|
266
|
+
q1: { padding, fill: teal["500"], rx: borderRadius, strokeWidth: 2 },
|
|
267
|
+
q1Labels: Object.assign({}, baseLabelStyles, { padding: 3 }),
|
|
268
|
+
q3: { padding, fill: cyan["500"], rx: borderRadius },
|
|
269
|
+
q3Labels: Object.assign({}, baseLabelStyles, { padding: 3 }),
|
|
270
|
+
},
|
|
271
|
+
boxWidth: 20,
|
|
272
|
+
},
|
|
273
|
+
baseProps,
|
|
274
|
+
),
|
|
275
|
+
candlestick: Object.assign(
|
|
276
|
+
{
|
|
277
|
+
style: {
|
|
278
|
+
data: {
|
|
279
|
+
stroke: gray["300"],
|
|
280
|
+
strokeWidth: 0,
|
|
281
|
+
rx: borderRadius,
|
|
282
|
+
},
|
|
283
|
+
labels: Object.assign({}, baseLabelStyles, { padding: 5 }),
|
|
284
|
+
},
|
|
285
|
+
candleColors: {
|
|
286
|
+
positive: teal["500"],
|
|
287
|
+
negative: orange["500"],
|
|
288
|
+
},
|
|
289
|
+
wickStrokeWidth: 2,
|
|
290
|
+
},
|
|
291
|
+
baseProps,
|
|
292
|
+
),
|
|
293
|
+
chart: baseProps,
|
|
294
|
+
errorbar: Object.assign(
|
|
295
|
+
{
|
|
296
|
+
borderWidth: 8,
|
|
297
|
+
style: {
|
|
298
|
+
data: {
|
|
299
|
+
fill: "transparent",
|
|
300
|
+
opacity: 1,
|
|
301
|
+
stroke: gray["700"],
|
|
302
|
+
strokeWidth: 2,
|
|
303
|
+
strokeLinecap,
|
|
304
|
+
},
|
|
305
|
+
labels: baseLabelStyles,
|
|
306
|
+
},
|
|
307
|
+
},
|
|
308
|
+
baseProps,
|
|
309
|
+
),
|
|
310
|
+
group: Object.assign(
|
|
311
|
+
{
|
|
312
|
+
colorScale,
|
|
313
|
+
},
|
|
314
|
+
baseProps,
|
|
315
|
+
),
|
|
316
|
+
histogram: Object.assign(
|
|
317
|
+
{
|
|
318
|
+
style: {
|
|
319
|
+
data: {
|
|
320
|
+
fill: cyan["500"],
|
|
321
|
+
fillOpacity: 0.5,
|
|
322
|
+
},
|
|
323
|
+
labels: baseLabelStyles,
|
|
324
|
+
},
|
|
325
|
+
binSpacing: 4,
|
|
326
|
+
cornerRadius: { top: borderRadius },
|
|
327
|
+
},
|
|
328
|
+
baseProps,
|
|
329
|
+
),
|
|
330
|
+
label: baseLabelStyles,
|
|
331
|
+
legend: {
|
|
332
|
+
colorScale,
|
|
333
|
+
gutter: 24,
|
|
334
|
+
borderPadding: 10,
|
|
335
|
+
orientation: "horizontal",
|
|
336
|
+
titleOrientation: "top",
|
|
337
|
+
centerTitle: true,
|
|
338
|
+
style: {
|
|
339
|
+
data: {
|
|
340
|
+
type: "circle",
|
|
341
|
+
},
|
|
342
|
+
labels: { ...baseLabelStyles, fontSize: 12 },
|
|
343
|
+
title: Object.assign({}, baseLabelStyles, { padding, fontSize: 16 }),
|
|
344
|
+
border: { stroke: gray["200"], strokeWidth: 2, padding: 16 },
|
|
345
|
+
},
|
|
346
|
+
},
|
|
347
|
+
line: Object.assign(
|
|
348
|
+
{
|
|
349
|
+
style: {
|
|
350
|
+
data: {
|
|
351
|
+
fill: "transparent",
|
|
352
|
+
opacity: 1,
|
|
353
|
+
stroke: blue["500"],
|
|
354
|
+
strokeWidth: 2,
|
|
355
|
+
strokeLinecap,
|
|
356
|
+
strokeLinejoin,
|
|
357
|
+
},
|
|
358
|
+
labels: baseLabelStyles,
|
|
359
|
+
},
|
|
360
|
+
},
|
|
361
|
+
baseProps,
|
|
362
|
+
),
|
|
363
|
+
pie: Object.assign(
|
|
364
|
+
{
|
|
365
|
+
style: {
|
|
366
|
+
parent: {
|
|
367
|
+
backgroundColor: gray.white,
|
|
368
|
+
},
|
|
369
|
+
data: {
|
|
370
|
+
padding,
|
|
371
|
+
stroke: gray.white,
|
|
372
|
+
strokeWidth: 1,
|
|
373
|
+
},
|
|
374
|
+
labels: {
|
|
375
|
+
...baseLabelStyles,
|
|
376
|
+
padding: 20,
|
|
377
|
+
fill: gray["600"],
|
|
378
|
+
fontSize: 10,
|
|
379
|
+
},
|
|
380
|
+
},
|
|
381
|
+
colorScale,
|
|
382
|
+
cornerRadius: borderRadius,
|
|
383
|
+
},
|
|
384
|
+
baseProps,
|
|
385
|
+
),
|
|
386
|
+
scatter: Object.assign(
|
|
387
|
+
{
|
|
388
|
+
style: {
|
|
389
|
+
data: {
|
|
390
|
+
fill: purple["500"],
|
|
391
|
+
opacity: 1,
|
|
392
|
+
stroke: "transparent",
|
|
393
|
+
strokeWidth: 0,
|
|
394
|
+
},
|
|
395
|
+
labels: {
|
|
396
|
+
...baseLabelStyles,
|
|
397
|
+
padding: 20,
|
|
398
|
+
},
|
|
399
|
+
},
|
|
400
|
+
},
|
|
401
|
+
baseProps,
|
|
402
|
+
),
|
|
403
|
+
stack: Object.assign(
|
|
404
|
+
{
|
|
405
|
+
colorScale,
|
|
406
|
+
},
|
|
407
|
+
baseProps,
|
|
408
|
+
),
|
|
409
|
+
tooltip: {
|
|
410
|
+
style: Object.assign({}, baseLabelStyles, {
|
|
411
|
+
padding: 0,
|
|
412
|
+
pointerEvents: "none",
|
|
413
|
+
}),
|
|
414
|
+
flyoutStyle: {
|
|
415
|
+
stroke: gray["300"],
|
|
416
|
+
strokeWidth: 2,
|
|
417
|
+
fill: gray.white,
|
|
418
|
+
pointerEvents: "none",
|
|
419
|
+
},
|
|
420
|
+
flyoutPadding: { top: 8, bottom: 8, left: 16, right: 16 },
|
|
421
|
+
cornerRadius: borderRadius,
|
|
422
|
+
pointerLength: 4,
|
|
423
|
+
},
|
|
424
|
+
voronoi: Object.assign(
|
|
425
|
+
{
|
|
426
|
+
style: {
|
|
427
|
+
data: {
|
|
428
|
+
fill: blue["100"],
|
|
429
|
+
stroke: blue["500"],
|
|
430
|
+
strokeWidth: 2,
|
|
431
|
+
opacity: 0.4,
|
|
432
|
+
},
|
|
433
|
+
labels: Object.assign({}, baseLabelStyles, {
|
|
434
|
+
padding: 5,
|
|
435
|
+
pointerEvents: "none",
|
|
436
|
+
}),
|
|
437
|
+
flyout: {
|
|
438
|
+
stroke: gray["900"],
|
|
439
|
+
strokeWidth: 1,
|
|
440
|
+
fill: gray["100"],
|
|
441
|
+
pointerEvents: "none",
|
|
442
|
+
},
|
|
443
|
+
padding: { left: 2, bottom: 2 },
|
|
444
|
+
},
|
|
445
|
+
},
|
|
446
|
+
baseProps,
|
|
447
|
+
),
|
|
448
|
+
};
|
|
@@ -3,7 +3,19 @@ import { VictoryThemeDefinition } from "./types";
|
|
|
3
3
|
// *
|
|
4
4
|
// * Colors
|
|
5
5
|
// *
|
|
6
|
-
const colors =
|
|
6
|
+
const colors = {
|
|
7
|
+
blue: "#4F7DA1",
|
|
8
|
+
pink: "#E2A37F",
|
|
9
|
+
teal: "#00796B",
|
|
10
|
+
purple: "#DF948A",
|
|
11
|
+
green: "#8BC34A",
|
|
12
|
+
orange: "#F4511E",
|
|
13
|
+
cyan: "#006064",
|
|
14
|
+
red: "#DF5A49",
|
|
15
|
+
yellow: "#FFF59D",
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const colorScale = [
|
|
7
19
|
"#252525",
|
|
8
20
|
"#525252",
|
|
9
21
|
"#737373",
|
|
@@ -15,6 +27,26 @@ const colors = [
|
|
|
15
27
|
|
|
16
28
|
const charcoal = "#252525";
|
|
17
29
|
const grey = "#969696";
|
|
30
|
+
|
|
31
|
+
const qualitative = [
|
|
32
|
+
"#334D5C",
|
|
33
|
+
"#45B29D",
|
|
34
|
+
"#EFC94C",
|
|
35
|
+
"#E27A3F",
|
|
36
|
+
"#DF5A49",
|
|
37
|
+
"#4F7DA1",
|
|
38
|
+
"#55DBC1",
|
|
39
|
+
"#EFDA97",
|
|
40
|
+
"#E2A37F",
|
|
41
|
+
"#DF948A",
|
|
42
|
+
];
|
|
43
|
+
const heatmap = ["#428517", "#77D200", "#D6D305", "#EC8E19", "#C92B05"];
|
|
44
|
+
const warm = ["#940031", "#C43343", "#DC5429", "#FF821D", "#FFAF55"];
|
|
45
|
+
const cool = ["#2746B9", "#0B69D4", "#2794DB", "#31BB76", "#60E83B"];
|
|
46
|
+
const red = ["#FCAE91", "#FB6A4A", "#DE2D26", "#A50F15", "#750B0E"];
|
|
47
|
+
const green = ["#354722", "#466631", "#649146", "#8AB25C", "#A9C97E"];
|
|
48
|
+
const blue = ["#002C61", "#004B8F", "#006BC9", "#3795E5", "#65B4F4"];
|
|
49
|
+
|
|
18
50
|
// *
|
|
19
51
|
// * Typography
|
|
20
52
|
// *
|
|
@@ -28,7 +60,7 @@ const baseProps = {
|
|
|
28
60
|
width: 450,
|
|
29
61
|
height: 300,
|
|
30
62
|
padding: 50,
|
|
31
|
-
colorScale
|
|
63
|
+
colorScale,
|
|
32
64
|
};
|
|
33
65
|
// *
|
|
34
66
|
// * Labels
|
|
@@ -53,6 +85,17 @@ const strokeLinecap = "round";
|
|
|
53
85
|
const strokeLinejoin = "round";
|
|
54
86
|
|
|
55
87
|
export const grayscale: VictoryThemeDefinition = {
|
|
88
|
+
palette: {
|
|
89
|
+
colors,
|
|
90
|
+
grayscale: colorScale,
|
|
91
|
+
qualitative,
|
|
92
|
+
heatmap,
|
|
93
|
+
warm,
|
|
94
|
+
cool,
|
|
95
|
+
red,
|
|
96
|
+
green,
|
|
97
|
+
blue,
|
|
98
|
+
},
|
|
56
99
|
area: Object.assign(
|
|
57
100
|
{
|
|
58
101
|
style: {
|
|
@@ -156,7 +199,7 @@ export const grayscale: VictoryThemeDefinition = {
|
|
|
156
199
|
),
|
|
157
200
|
group: Object.assign(
|
|
158
201
|
{
|
|
159
|
-
colorScale
|
|
202
|
+
colorScale,
|
|
160
203
|
},
|
|
161
204
|
baseProps,
|
|
162
205
|
),
|
|
@@ -174,7 +217,7 @@ export const grayscale: VictoryThemeDefinition = {
|
|
|
174
217
|
baseProps,
|
|
175
218
|
),
|
|
176
219
|
legend: {
|
|
177
|
-
colorScale
|
|
220
|
+
colorScale,
|
|
178
221
|
gutter: 10,
|
|
179
222
|
orientation: "vertical",
|
|
180
223
|
titleOrientation: "top",
|
|
@@ -208,7 +251,7 @@ export const grayscale: VictoryThemeDefinition = {
|
|
|
208
251
|
},
|
|
209
252
|
labels: Object.assign({}, baseLabelStyles, { padding: 20 }),
|
|
210
253
|
},
|
|
211
|
-
colorScale
|
|
254
|
+
colorScale,
|
|
212
255
|
width: 400,
|
|
213
256
|
height: 400,
|
|
214
257
|
padding: 50,
|
|
@@ -228,7 +271,7 @@ export const grayscale: VictoryThemeDefinition = {
|
|
|
228
271
|
),
|
|
229
272
|
stack: Object.assign(
|
|
230
273
|
{
|
|
231
|
-
colorScale
|
|
274
|
+
colorScale,
|
|
232
275
|
},
|
|
233
276
|
baseProps,
|
|
234
277
|
),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { VictoryThemeDefinition } from "./types";
|
|
1
|
+
import { VictoryThemeDefinition, VictoryThemePalette } from "./types";
|
|
2
2
|
|
|
3
3
|
// *
|
|
4
4
|
// * Colors
|
|
@@ -9,7 +9,7 @@ const lime300 = "#DCE775";
|
|
|
9
9
|
const lightGreen500 = "#8BC34A";
|
|
10
10
|
const teal700 = "#00796B";
|
|
11
11
|
const cyan900 = "#006064";
|
|
12
|
-
const
|
|
12
|
+
const colorScale = [
|
|
13
13
|
deepOrange600,
|
|
14
14
|
yellow200,
|
|
15
15
|
lime300,
|
|
@@ -21,6 +21,39 @@ const blueGrey50 = "#ECEFF1";
|
|
|
21
21
|
const blueGrey300 = "#90A4AE";
|
|
22
22
|
const blueGrey700 = "#455A64";
|
|
23
23
|
const grey900 = "#212121";
|
|
24
|
+
|
|
25
|
+
const colors: VictoryThemePalette = {
|
|
26
|
+
blue: "#4F7DA1",
|
|
27
|
+
pink: "#E2A37F",
|
|
28
|
+
teal: teal700,
|
|
29
|
+
purple: "#DF948A",
|
|
30
|
+
green: lightGreen500,
|
|
31
|
+
orange: deepOrange600,
|
|
32
|
+
cyan: cyan900,
|
|
33
|
+
red: "#DF5A49",
|
|
34
|
+
yellow: yellow200,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const grayscale = [blueGrey50, blueGrey300, blueGrey700, grey900];
|
|
38
|
+
const qualitative = [
|
|
39
|
+
"#334D5C",
|
|
40
|
+
"#45B29D",
|
|
41
|
+
"#EFC94C",
|
|
42
|
+
"#E27A3F",
|
|
43
|
+
"#DF5A49",
|
|
44
|
+
"#4F7DA1",
|
|
45
|
+
"#55DBC1",
|
|
46
|
+
"#EFDA97",
|
|
47
|
+
"#E2A37F",
|
|
48
|
+
"#DF948A",
|
|
49
|
+
];
|
|
50
|
+
const heatmap = ["#428517", "#77D200", "#D6D305", "#EC8E19", "#C92B05"];
|
|
51
|
+
const warm = ["#940031", "#C43343", "#DC5429", "#FF821D", "#FFAF55"];
|
|
52
|
+
const cool = ["#2746B9", "#0B69D4", "#2794DB", "#31BB76", "#60E83B"];
|
|
53
|
+
const red = ["#FCAE91", "#FB6A4A", "#DE2D26", "#A50F15", "#750B0E"];
|
|
54
|
+
const green = ["#354722", "#466631", "#649146", "#8AB25C", "#A9C97E"];
|
|
55
|
+
const blue = ["#002C61", "#004B8F", "#006BC9", "#3795E5", "#65B4F4"];
|
|
56
|
+
|
|
24
57
|
// *
|
|
25
58
|
// * Typography
|
|
26
59
|
// *
|
|
@@ -61,6 +94,17 @@ const strokeLinecap = "round";
|
|
|
61
94
|
const strokeLinejoin = "round";
|
|
62
95
|
|
|
63
96
|
export const material: VictoryThemeDefinition = {
|
|
97
|
+
palette: {
|
|
98
|
+
colors,
|
|
99
|
+
grayscale,
|
|
100
|
+
qualitative,
|
|
101
|
+
heatmap,
|
|
102
|
+
warm,
|
|
103
|
+
cool,
|
|
104
|
+
red,
|
|
105
|
+
green,
|
|
106
|
+
blue,
|
|
107
|
+
},
|
|
64
108
|
area: Object.assign(
|
|
65
109
|
{
|
|
66
110
|
style: {
|
|
@@ -182,7 +226,7 @@ export const material: VictoryThemeDefinition = {
|
|
|
182
226
|
),
|
|
183
227
|
group: Object.assign(
|
|
184
228
|
{
|
|
185
|
-
colorScale
|
|
229
|
+
colorScale,
|
|
186
230
|
},
|
|
187
231
|
baseProps,
|
|
188
232
|
),
|
|
@@ -200,7 +244,7 @@ export const material: VictoryThemeDefinition = {
|
|
|
200
244
|
baseProps,
|
|
201
245
|
),
|
|
202
246
|
legend: {
|
|
203
|
-
colorScale
|
|
247
|
+
colorScale,
|
|
204
248
|
gutter: 10,
|
|
205
249
|
orientation: "vertical",
|
|
206
250
|
titleOrientation: "top",
|
|
@@ -228,7 +272,7 @@ export const material: VictoryThemeDefinition = {
|
|
|
228
272
|
),
|
|
229
273
|
pie: Object.assign(
|
|
230
274
|
{
|
|
231
|
-
colorScale
|
|
275
|
+
colorScale,
|
|
232
276
|
style: {
|
|
233
277
|
data: {
|
|
234
278
|
padding,
|
|
@@ -256,7 +300,7 @@ export const material: VictoryThemeDefinition = {
|
|
|
256
300
|
),
|
|
257
301
|
stack: Object.assign(
|
|
258
302
|
{
|
|
259
|
-
colorScale
|
|
303
|
+
colorScale,
|
|
260
304
|
},
|
|
261
305
|
baseProps,
|
|
262
306
|
),
|
|
@@ -72,7 +72,33 @@ export interface VictoryAxisCommonProps {
|
|
|
72
72
|
export type VerticalAnchorType = "start" | "middle" | "end";
|
|
73
73
|
// #region Victory Theme
|
|
74
74
|
// Note: Many SVG attributes are missed in CSSProperties interface
|
|
75
|
+
type VictoryThemePaletteKeys =
|
|
76
|
+
| "blue"
|
|
77
|
+
| "pink"
|
|
78
|
+
| "teal"
|
|
79
|
+
| "purple"
|
|
80
|
+
| "green"
|
|
81
|
+
| "orange"
|
|
82
|
+
| "cyan"
|
|
83
|
+
| "red"
|
|
84
|
+
| "yellow";
|
|
85
|
+
|
|
86
|
+
export type VictoryThemePalette = {
|
|
87
|
+
[key in VictoryThemePaletteKeys]?: string;
|
|
88
|
+
};
|
|
89
|
+
|
|
75
90
|
export interface VictoryThemeDefinition {
|
|
91
|
+
palette?: {
|
|
92
|
+
colors?: VictoryThemePalette;
|
|
93
|
+
grayscale?: string[];
|
|
94
|
+
qualitative?: string[];
|
|
95
|
+
heatmap?: string[];
|
|
96
|
+
warm?: string[];
|
|
97
|
+
cool?: string[];
|
|
98
|
+
red?: string[];
|
|
99
|
+
blue?: string[];
|
|
100
|
+
green?: string[];
|
|
101
|
+
};
|
|
76
102
|
area?: {
|
|
77
103
|
style?: {
|
|
78
104
|
data?: VictoryStyleObject;
|
|
@@ -167,6 +193,7 @@ export interface VictoryThemeDefinition {
|
|
|
167
193
|
offsetY?: number;
|
|
168
194
|
orientation?: OrientationTypes;
|
|
169
195
|
} & VictoryCommonThemeProps;
|
|
196
|
+
label?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
|
|
170
197
|
legend?: {
|
|
171
198
|
gutter?: number | BlockProps;
|
|
172
199
|
rowGutter?: number | BlockProps;
|