victory-core 37.1.1 → 37.1.2

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.
@@ -0,0 +1,411 @@
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["500"],
78
+ pink["500"],
79
+ teal["500"],
80
+ purple["500"],
81
+ green["500"],
82
+ orange["500"],
83
+ cyan["500"],
84
+ red["500"],
85
+ yellow["500"],
86
+ ];
87
+ // *
88
+ // * Typography
89
+ // *
90
+ const sansSerif =
91
+ "'Inter', 'Helvetica Neue', 'Seravek', 'Helvetica', sans-serif";
92
+ const letterSpacing = "normal";
93
+ const fontSize = 12;
94
+ // *
95
+ // * Layout
96
+ // *
97
+ const padding = 8;
98
+ const baseProps = {
99
+ width: 450,
100
+ height: 300,
101
+ padding: 50,
102
+ colorScale: colors,
103
+ };
104
+ // *
105
+ // * Labels
106
+ // *
107
+ const baseLabelStyles = {
108
+ fontFamily: sansSerif,
109
+ fontSize,
110
+ fontWeight: 300,
111
+ letterSpacing,
112
+ padding,
113
+ fill: gray["900"],
114
+ stroke: "transparent",
115
+ };
116
+
117
+ const centeredLabelStyles = Object.assign(
118
+ { textAnchor: "middle" },
119
+ baseLabelStyles,
120
+ );
121
+
122
+ // *
123
+ // * Strokes
124
+ // *
125
+ const strokeDasharray = "10, 5";
126
+ const strokeLinecap = "round";
127
+ const strokeLinejoin = "round";
128
+ const borderRadius = 1;
129
+ // *
130
+ // * Theme
131
+ // *
132
+ export const clean: VictoryThemeDefinition = {
133
+ area: Object.assign(
134
+ {
135
+ style: {
136
+ data: {
137
+ fill: cyan["500"],
138
+ },
139
+ labels: baseLabelStyles,
140
+ },
141
+ },
142
+ baseProps,
143
+ ),
144
+ axis: Object.assign(
145
+ {
146
+ style: {
147
+ axis: {
148
+ fill: "transparent",
149
+ stroke: gray["300"],
150
+ strokeWidth: 1,
151
+ strokeLinecap,
152
+ strokeLinejoin,
153
+ },
154
+ axisLabel: Object.assign({}, centeredLabelStyles, {
155
+ padding,
156
+ stroke: "transparent",
157
+ }),
158
+ grid: {
159
+ fill: "none",
160
+ stroke: "none",
161
+ painterEvents: "painted",
162
+ },
163
+ ticks: {
164
+ fill: "transparent",
165
+ size: 5,
166
+ stroke: "transparent",
167
+ },
168
+ tickLabels: baseLabelStyles,
169
+ },
170
+ },
171
+ baseProps,
172
+ ),
173
+ polarAxis: Object.assign({
174
+ style: {
175
+ axis: {
176
+ stroke: gray["300"],
177
+ },
178
+ grid: {
179
+ stroke: gray["200"],
180
+ strokeDasharray,
181
+ strokeLinecap,
182
+ strokeLinejoin,
183
+ pointerEvents: "painted",
184
+ },
185
+ ticks: {
186
+ fill: "transparent",
187
+ size: 5,
188
+ stroke: gray["200"],
189
+ strokeWidth: 1,
190
+ strokeLinecap,
191
+ strokeLinejoin,
192
+ },
193
+ tickLabels: baseLabelStyles,
194
+ },
195
+ }),
196
+ polarDependentAxis: Object.assign({
197
+ style: {
198
+ axis: {
199
+ stroke: gray["300"],
200
+ },
201
+ grid: {
202
+ stroke: gray["200"],
203
+ strokeDasharray,
204
+ strokeLinecap,
205
+ strokeLinejoin,
206
+ pointerEvents: "painted",
207
+ },
208
+ ticks: {
209
+ fill: "transparent",
210
+ size: 5,
211
+ stroke: gray["200"],
212
+ strokeWidth: 1,
213
+ strokeLinecap,
214
+ strokeLinejoin,
215
+ },
216
+ tickLabels: baseLabelStyles,
217
+ },
218
+ }),
219
+ bar: Object.assign(
220
+ {
221
+ style: {
222
+ data: {
223
+ fill: blue["500"],
224
+ padding,
225
+ strokeWidth: 0,
226
+ },
227
+ labels: baseLabelStyles,
228
+ },
229
+ cornerRadius: { top: borderRadius },
230
+ },
231
+ baseProps,
232
+ ),
233
+ boxplot: Object.assign(
234
+ {
235
+ style: {
236
+ max: { padding, stroke: gray["400"], strokeWidth: 2 },
237
+ maxLabels: Object.assign({}, baseLabelStyles, { padding: 3 }),
238
+ median: { padding, stroke: gray.white, strokeWidth: 2 },
239
+ medianLabels: Object.assign({}, baseLabelStyles, { padding: 3 }),
240
+ min: { padding, stroke: gray["400"], strokeWidth: 2 },
241
+ minLabels: Object.assign({}, baseLabelStyles, { padding: 3 }),
242
+ q1: { padding, fill: teal["500"], rx: borderRadius },
243
+ q1Labels: Object.assign({}, baseLabelStyles, { padding: 3 }),
244
+ q3: { padding, fill: teal["500"], rx: borderRadius },
245
+ q3Labels: Object.assign({}, baseLabelStyles, { padding: 3 }),
246
+ },
247
+ boxWidth: 20,
248
+ },
249
+ baseProps,
250
+ ),
251
+ candlestick: Object.assign(
252
+ {
253
+ style: {
254
+ data: {
255
+ stroke: gray["300"],
256
+ strokeWidth: 0,
257
+ rx: borderRadius,
258
+ },
259
+ labels: Object.assign({}, baseLabelStyles, { padding: 5 }),
260
+ },
261
+ candleColors: {
262
+ positive: teal["500"],
263
+ negative: orange["500"],
264
+ },
265
+ wickStrokeWidth: 2,
266
+ },
267
+ baseProps,
268
+ ),
269
+ chart: baseProps,
270
+ errorbar: Object.assign(
271
+ {
272
+ borderWidth: 8,
273
+ style: {
274
+ data: {
275
+ fill: "transparent",
276
+ opacity: 1,
277
+ stroke: gray["700"],
278
+ strokeWidth: 2,
279
+ strokeLinecap,
280
+ },
281
+ labels: baseLabelStyles,
282
+ },
283
+ },
284
+ baseProps,
285
+ ),
286
+ group: Object.assign(
287
+ {
288
+ colorScale: colors,
289
+ },
290
+ baseProps,
291
+ ),
292
+ histogram: Object.assign(
293
+ {
294
+ style: {
295
+ data: {
296
+ fill: cyan["500"],
297
+ stroke: "transparent",
298
+ strokeWidth: 0,
299
+ },
300
+ labels: baseLabelStyles,
301
+ },
302
+ binSpacing: 4,
303
+ cornerRadius: { top: borderRadius },
304
+ },
305
+ baseProps,
306
+ ),
307
+ label: baseLabelStyles,
308
+ legend: {
309
+ colorScale: colors,
310
+ gutter: 10,
311
+ orientation: "vertical",
312
+ titleOrientation: "top",
313
+ style: {
314
+ data: {
315
+ type: "circle",
316
+ },
317
+ labels: { ...baseLabelStyles, fontSize: 14 },
318
+ title: Object.assign({}, baseLabelStyles, { padding, fontSize: 20 }),
319
+ border: { stroke: gray["200"], strokeWidth: 2, padding: 16 },
320
+ },
321
+ },
322
+ line: Object.assign(
323
+ {
324
+ style: {
325
+ data: {
326
+ fill: "transparent",
327
+ opacity: 1,
328
+ stroke: pink["500"],
329
+ strokeWidth: 2,
330
+ strokeLinecap,
331
+ strokeLinejoin,
332
+ },
333
+ labels: baseLabelStyles,
334
+ },
335
+ },
336
+ baseProps,
337
+ ),
338
+ pie: Object.assign(
339
+ {
340
+ style: {
341
+ data: {
342
+ padding,
343
+ stroke: gray.white,
344
+ strokeWidth: 1,
345
+ },
346
+ labels: Object.assign({}, baseLabelStyles, { padding: 20 }),
347
+ },
348
+ colorScale: colors,
349
+ cornerRadius: borderRadius,
350
+ },
351
+ baseProps,
352
+ ),
353
+ scatter: Object.assign(
354
+ {
355
+ style: {
356
+ data: {
357
+ fill: purple["500"],
358
+ opacity: 1,
359
+ stroke: "transparent",
360
+ strokeWidth: 0,
361
+ },
362
+ labels: baseLabelStyles,
363
+ },
364
+ },
365
+ baseProps,
366
+ ),
367
+ stack: Object.assign(
368
+ {
369
+ colorScale: colors,
370
+ },
371
+ baseProps,
372
+ ),
373
+ tooltip: {
374
+ style: Object.assign({}, baseLabelStyles, {
375
+ padding: 0,
376
+ pointerEvents: "none",
377
+ }),
378
+ flyoutStyle: {
379
+ stroke: gray["500"],
380
+ strokeWidth: 2,
381
+ fill: gray.white,
382
+ pointerEvents: "none",
383
+ },
384
+ flyoutPadding: { top: 8, bottom: 8, left: 16, right: 16 },
385
+ cornerRadius: borderRadius,
386
+ pointerLength: 4,
387
+ },
388
+ voronoi: Object.assign(
389
+ {
390
+ style: {
391
+ data: {
392
+ fill: red["100"],
393
+ stroke: red["500"],
394
+ strokeWidth: 2,
395
+ },
396
+ labels: Object.assign({}, baseLabelStyles, {
397
+ padding: 5,
398
+ pointerEvents: "none",
399
+ }),
400
+ flyout: {
401
+ stroke: gray["900"],
402
+ strokeWidth: 1,
403
+ fill: gray["100"],
404
+ pointerEvents: "none",
405
+ },
406
+ padding: { left: 2, bottom: 2 },
407
+ },
408
+ },
409
+ baseProps,
410
+ ),
411
+ };
@@ -167,6 +167,7 @@ export interface VictoryThemeDefinition {
167
167
  offsetY?: number;
168
168
  orientation?: OrientationTypes;
169
169
  } & VictoryCommonThemeProps;
170
+ label?: VictoryLabelStyleObject | VictoryLabelStyleObject[];
170
171
  legend?: {
171
172
  gutter?: number | BlockProps;
172
173
  rowGutter?: number | BlockProps;
@@ -1,5 +1,7 @@
1
1
  import { grayscale } from "./grayscale";
2
2
  import { material } from "./material";
3
+ import { clean } from "./clean";
4
+
3
5
  export * from "./types";
4
6
 
5
- export const VictoryTheme = { grayscale, material };
7
+ export const VictoryTheme = { grayscale, material, clean };
@@ -4,6 +4,7 @@ import { defaults, memoize } from "lodash";
4
4
 
5
5
  // Based on measuring specific character widths
6
6
  // as in the following example https://bl.ocks.org/tophtucker/62f93a4658387bb61e4510c37e2e97cf
7
+ // For new fonts: pull gist, open index.html locally, add font files (if not generic), enter font name in `font-family` input
7
8
  // prettier-ignore
8
9
  const fonts = {
9
10
  "American Typewriter": {
@@ -62,6 +63,10 @@ const fonts = {
62
63
  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],
63
64
  avg: 0.5116447368421051
64
65
  },
66
+ "Inter": {
67
+ 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],
68
+ avg: 0.5624362664473683
69
+ },
65
70
  "Montserrat": {
66
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.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],
67
72
  avg: 0.571792763157895