@antv/g2 5.0.15 → 5.0.17
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/g2-lite.min.js +3 -3
- package/dist/g2.min.js +3 -3
- package/esm/animation/morphing.js +2 -0
- package/esm/animation/morphing.js.map +1 -1
- package/esm/api/chart.js +5 -1
- package/esm/api/chart.js.map +1 -1
- package/esm/api/mark/types.d.ts +2 -2
- package/esm/component/legendCategory.js +23 -21
- package/esm/component/legendCategory.js.map +1 -1
- package/esm/component/legendContinuous.js +1 -1
- package/esm/component/legendContinuous.js.map +1 -1
- package/esm/component/title.js +2 -4
- package/esm/component/title.js.map +1 -1
- package/esm/component/utils.js +1 -0
- package/esm/component/utils.js.map +1 -1
- package/esm/interaction/event.js +17 -4
- package/esm/interaction/event.js.map +1 -1
- package/esm/mark/point.js +1 -1
- package/esm/mark/point.js.map +1 -1
- package/esm/runtime/component.d.ts +3 -2
- package/esm/runtime/component.js +62 -22
- package/esm/runtime/component.js.map +1 -1
- package/esm/runtime/layout.js +3 -3
- package/esm/runtime/layout.js.map +1 -1
- package/esm/runtime/mark.js +3 -2
- package/esm/runtime/mark.js.map +1 -1
- package/esm/runtime/plot.js +24 -16
- package/esm/runtime/plot.js.map +1 -1
- package/esm/runtime/scale.d.ts +4 -3
- package/esm/runtime/scale.js +48 -14
- package/esm/runtime/scale.js.map +1 -1
- package/esm/runtime/types/common.d.ts +12 -14
- package/esm/runtime/types/theme.d.ts +9 -13
- package/esm/shape/label/position/default.js +7 -2
- package/esm/shape/label/position/default.js.map +1 -1
- package/esm/shape/text/advance.js +5 -2
- package/esm/shape/text/advance.js.map +1 -1
- package/esm/spec/component.d.ts +11 -12
- package/esm/spec/composition.d.ts +1 -1
- package/esm/spec/index.d.ts +2 -1
- package/esm/spec/index.js.map +1 -1
- package/esm/spec/interaction.d.ts +1 -2
- package/esm/spec/mark.d.ts +1 -1
- package/esm/theme/academy.js +11 -32
- package/esm/theme/academy.js.map +1 -1
- package/esm/theme/classic.js +12 -33
- package/esm/theme/classic.js.map +1 -1
- package/esm/theme/classicDark.js +11 -32
- package/esm/theme/classicDark.js.map +1 -1
- package/lib/animation/morphing.js +2 -0
- package/lib/animation/morphing.js.map +1 -1
- package/lib/api/chart.js +5 -1
- package/lib/api/chart.js.map +1 -1
- package/lib/api/mark/types.d.ts +2 -2
- package/lib/component/legendCategory.js +23 -21
- package/lib/component/legendCategory.js.map +1 -1
- package/lib/component/legendContinuous.js +1 -1
- package/lib/component/legendContinuous.js.map +1 -1
- package/lib/component/title.js +2 -4
- package/lib/component/title.js.map +1 -1
- package/lib/component/utils.js +1 -0
- package/lib/component/utils.js.map +1 -1
- package/lib/interaction/event.js +17 -4
- package/lib/interaction/event.js.map +1 -1
- package/lib/mark/point.js +1 -1
- package/lib/mark/point.js.map +1 -1
- package/lib/runtime/component.d.ts +3 -2
- package/lib/runtime/component.js +64 -23
- package/lib/runtime/component.js.map +1 -1
- package/lib/runtime/layout.js +3 -3
- package/lib/runtime/layout.js.map +1 -1
- package/lib/runtime/mark.js +3 -2
- package/lib/runtime/mark.js.map +1 -1
- package/lib/runtime/plot.js +22 -14
- package/lib/runtime/plot.js.map +1 -1
- package/lib/runtime/scale.d.ts +4 -3
- package/lib/runtime/scale.js +49 -14
- package/lib/runtime/scale.js.map +1 -1
- package/lib/runtime/types/common.d.ts +12 -14
- package/lib/runtime/types/theme.d.ts +9 -13
- package/lib/shape/label/position/default.js +7 -2
- package/lib/shape/label/position/default.js.map +1 -1
- package/lib/shape/text/advance.js +5 -2
- package/lib/shape/text/advance.js.map +1 -1
- package/lib/spec/component.d.ts +11 -12
- package/lib/spec/composition.d.ts +1 -1
- package/lib/spec/index.d.ts +2 -1
- package/lib/spec/index.js.map +1 -1
- package/lib/spec/interaction.d.ts +1 -2
- package/lib/spec/mark.d.ts +1 -1
- package/lib/theme/academy.js +11 -32
- package/lib/theme/academy.js.map +1 -1
- package/lib/theme/classic.js +12 -33
- package/lib/theme/classic.js.map +1 -1
- package/lib/theme/classicDark.js +11 -32
- package/lib/theme/classicDark.js.map +1 -1
- package/package.json +9 -6
- package/src/animation/morphing.ts +2 -0
- package/src/api/chart.ts +10 -1
- package/src/api/mark/types.ts +5 -2
- package/src/component/legendCategory.ts +26 -32
- package/src/component/legendContinuous.ts +1 -1
- package/src/component/title.ts +11 -15
- package/src/component/utils.ts +1 -0
- package/src/interaction/event.ts +15 -4
- package/src/mark/point.ts +1 -1
- package/src/runtime/component.ts +76 -29
- package/src/runtime/layout.ts +3 -3
- package/src/runtime/mark.ts +10 -1
- package/src/runtime/plot.ts +34 -27
- package/src/runtime/scale.ts +58 -16
- package/src/runtime/types/common.ts +16 -18
- package/src/runtime/types/theme.ts +13 -17
- package/src/shape/label/position/default.ts +8 -2
- package/src/shape/text/advance.ts +7 -2
- package/src/spec/component.ts +11 -12
- package/src/spec/composition.ts +1 -1
- package/src/spec/index.ts +2 -1
- package/src/spec/interaction.ts +1 -2
- package/src/spec/mark.ts +1 -1
- package/src/theme/academy.ts +12 -32
- package/src/theme/classic.ts +13 -33
- package/src/theme/classicDark.ts +12 -32
package/src/runtime/scale.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Linear, createInterpolateValue } from '@antv/scale';
|
|
2
|
-
import { extent } from 'd3-array';
|
|
2
|
+
import { extent, max } from 'd3-array';
|
|
3
3
|
import * as d3ScaleChromatic from 'd3-scale-chromatic';
|
|
4
4
|
import { deepMix, omit, upperFirst } from '@antv/util';
|
|
5
5
|
import { firstOf, lastOf, unique } from '../utils/array';
|
|
@@ -23,7 +23,14 @@ import { isTheta } from './coordinate';
|
|
|
23
23
|
import { useLibrary } from './library';
|
|
24
24
|
import { MarkChannel } from './types/mark';
|
|
25
25
|
|
|
26
|
-
export function inferScale(
|
|
26
|
+
export function inferScale(
|
|
27
|
+
name: string,
|
|
28
|
+
values: Primitive[][],
|
|
29
|
+
options: Record<string, any>,
|
|
30
|
+
coordinates: G2CoordinateOptions[],
|
|
31
|
+
theme: G2Theme,
|
|
32
|
+
library: G2Library,
|
|
33
|
+
) {
|
|
27
34
|
const { guide = {} } = options;
|
|
28
35
|
const type = inferScaleType(name, values, options);
|
|
29
36
|
if (typeof type !== 'string') return options;
|
|
@@ -161,6 +168,33 @@ export function useRelation(
|
|
|
161
168
|
return [conditionalize, deconditionalize];
|
|
162
169
|
}
|
|
163
170
|
|
|
171
|
+
export function assignScale(
|
|
172
|
+
target: Record<string, Scale>,
|
|
173
|
+
source: Record<string, Scale>,
|
|
174
|
+
): Record<string, Scale> {
|
|
175
|
+
const keys = Object.keys(target);
|
|
176
|
+
for (const scale of Object.values(source)) {
|
|
177
|
+
const { name, key } = scale.getOptions();
|
|
178
|
+
if (typeof key === 'string') {
|
|
179
|
+
if (!(key in target)) target[key] = scale;
|
|
180
|
+
} else {
|
|
181
|
+
// For scale.key = Symbol('independent')
|
|
182
|
+
if (!(name in target)) target[name] = scale;
|
|
183
|
+
else {
|
|
184
|
+
const I = keys
|
|
185
|
+
.filter((d) => d.startsWith(name))
|
|
186
|
+
// Reg is for extract `1` from `x1`;
|
|
187
|
+
.map((d) => +(d.replace(name, '') || 0));
|
|
188
|
+
const index = max(I) + 1;
|
|
189
|
+
const newKey = `${name}${index}`;
|
|
190
|
+
target[newKey] = scale;
|
|
191
|
+
scale.getOptions().key = newKey;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
return target;
|
|
196
|
+
}
|
|
197
|
+
|
|
164
198
|
export function useRelationScale(
|
|
165
199
|
options: Record<string, any>,
|
|
166
200
|
library: G2Library,
|
|
@@ -265,19 +299,19 @@ function inferScaleType(
|
|
|
265
299
|
values: Primitive[][],
|
|
266
300
|
options: G2ScaleOptions,
|
|
267
301
|
): string | ScaleComponent {
|
|
268
|
-
const { type, domain, range } = options;
|
|
302
|
+
const { type, domain, range, quantitative, ordinal } = options;
|
|
269
303
|
if (type !== undefined) return type;
|
|
270
304
|
if (isObject(values)) return 'identity';
|
|
271
305
|
if (typeof range === 'string') return 'linear';
|
|
272
|
-
if ((domain || range || []).length > 2) return asOrdinalType(name);
|
|
306
|
+
if ((domain || range || []).length > 2) return asOrdinalType(name, ordinal);
|
|
273
307
|
if (domain !== undefined) {
|
|
274
|
-
if (isOrdinal([domain])) return asOrdinalType(name);
|
|
308
|
+
if (isOrdinal([domain])) return asOrdinalType(name, ordinal);
|
|
275
309
|
if (isTemporal(values)) return 'time';
|
|
276
|
-
return asQuantitativeType(name, range);
|
|
310
|
+
return asQuantitativeType(name, range, quantitative);
|
|
277
311
|
}
|
|
278
|
-
if (isOrdinal(values)) return asOrdinalType(name);
|
|
312
|
+
if (isOrdinal(values)) return asOrdinalType(name, ordinal);
|
|
279
313
|
if (isTemporal(values)) return 'time';
|
|
280
|
-
return asQuantitativeType(name, range);
|
|
314
|
+
return asQuantitativeType(name, range, quantitative);
|
|
281
315
|
}
|
|
282
316
|
|
|
283
317
|
function inferScaleDomain(
|
|
@@ -334,8 +368,11 @@ function inferScaleRange(
|
|
|
334
368
|
return [rangeMin || r0, rangeMax || r1];
|
|
335
369
|
}
|
|
336
370
|
case 'band':
|
|
337
|
-
case 'point':
|
|
338
|
-
|
|
371
|
+
case 'point': {
|
|
372
|
+
const min = name === 'size' ? 5 : 0;
|
|
373
|
+
const max = name === 'size' ? 10 : 1;
|
|
374
|
+
return [rangeMin || min, rangeMax || max];
|
|
375
|
+
}
|
|
339
376
|
case 'ordinal': {
|
|
340
377
|
return categoricalColors(values, options, domain, theme, library);
|
|
341
378
|
}
|
|
@@ -383,7 +420,7 @@ function categoricalColors(
|
|
|
383
420
|
'palette',
|
|
384
421
|
library,
|
|
385
422
|
);
|
|
386
|
-
const {
|
|
423
|
+
const { category10: c10, category20: c20 } = theme;
|
|
387
424
|
const defaultPalette = unique(values.flat()).length <= c10.length ? c10 : c20;
|
|
388
425
|
const { palette = defaultPalette, offset } = options;
|
|
389
426
|
// Built-in palettes have higher priority.
|
|
@@ -478,20 +515,25 @@ function inferPadding(
|
|
|
478
515
|
// The scale for enterDelay and enterDuration should has zero padding by default.
|
|
479
516
|
// Because there is no need to add extra delay for the start and the end.
|
|
480
517
|
if (name === 'enterDelay' || name === 'enterDuration') return 0;
|
|
481
|
-
if (
|
|
482
|
-
|
|
483
|
-
}
|
|
518
|
+
if (name === 'size') return 0;
|
|
519
|
+
if (type === 'band') return isTheta(coordinates) ? 0 : 0.1;
|
|
484
520
|
// Point scale need 0.5 padding to make interval between first and last point
|
|
485
521
|
// equal to other intervals in polar coordinate.
|
|
486
522
|
if (type === 'point') return 0.5;
|
|
487
523
|
return 0;
|
|
488
524
|
}
|
|
489
525
|
|
|
490
|
-
function asOrdinalType(name: string) {
|
|
526
|
+
function asOrdinalType(name: string, defaults: string) {
|
|
527
|
+
if (defaults) return defaults;
|
|
491
528
|
return isQuantitative(name) ? 'point' : 'ordinal';
|
|
492
529
|
}
|
|
493
530
|
|
|
494
|
-
function asQuantitativeType(
|
|
531
|
+
function asQuantitativeType(
|
|
532
|
+
name: string,
|
|
533
|
+
range: Primitive[],
|
|
534
|
+
defaults: string,
|
|
535
|
+
) {
|
|
536
|
+
if (defaults) return defaults;
|
|
495
537
|
if (name !== 'color') return 'linear';
|
|
496
538
|
return range ? 'linear' : 'sequential';
|
|
497
539
|
}
|
|
@@ -20,24 +20,20 @@ export type G2Title = {
|
|
|
20
20
|
* Text of subtitle.
|
|
21
21
|
*/
|
|
22
22
|
subtitle?: string | null;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
*/
|
|
38
|
-
spacing?: number;
|
|
39
|
-
};
|
|
40
|
-
};
|
|
23
|
+
} & WithPrefix<Omit<TextStyleProps, 'x' | 'y' | 'text'>, 'title'> & // G.Text style for title.
|
|
24
|
+
WithPrefix<Omit<TextStyleProps, 'x' | 'y' | 'text'>, 'subtitle'> & {
|
|
25
|
+
// G.Text style for subtitle.
|
|
26
|
+
titleAlign?: 'left' | 'center' | 'right';
|
|
27
|
+
subtitleAlign?: 'left' | 'center' | 'right';
|
|
28
|
+
/**
|
|
29
|
+
* Align method for title.
|
|
30
|
+
*/
|
|
31
|
+
align?: 'left' | 'center' | 'right';
|
|
32
|
+
/**
|
|
33
|
+
* The vertical spacing between title and subtitle, default is 2.
|
|
34
|
+
*/
|
|
35
|
+
spacing?: number;
|
|
36
|
+
};
|
|
41
37
|
|
|
42
38
|
export type G2ViewDescriptor = {
|
|
43
39
|
scale: Record<string, Scale>;
|
|
@@ -116,6 +112,8 @@ export type ChannelValue = MaybeArray<Primitive>[];
|
|
|
116
112
|
export type Channel = {
|
|
117
113
|
name?: string;
|
|
118
114
|
scale?: string;
|
|
115
|
+
quantitative?: string;
|
|
116
|
+
ordinal?: string;
|
|
119
117
|
scaleName?: string;
|
|
120
118
|
required?: boolean;
|
|
121
119
|
value?: Primitive[];
|
|
@@ -59,13 +59,11 @@ type MarkTheme = NestUnion<'interval', ['rect', 'hollowRect'], ElementStyle> &
|
|
|
59
59
|
}
|
|
60
60
|
>;
|
|
61
61
|
|
|
62
|
+
// @todo
|
|
62
63
|
type InteractionTheme = {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
selected: MarkTheme;
|
|
67
|
-
disabled: MarkTheme;
|
|
68
|
-
};
|
|
64
|
+
tooltip?: Record<string, unknown>;
|
|
65
|
+
elementHighlight?: Record<string, unknown>;
|
|
66
|
+
elementSelect?: Record<string, unknown>;
|
|
69
67
|
};
|
|
70
68
|
|
|
71
69
|
type ComponentTheme = {
|
|
@@ -113,17 +111,15 @@ type AreaTheme = {
|
|
|
113
111
|
};
|
|
114
112
|
|
|
115
113
|
export type G2Theme = {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
114
|
+
color?: string;
|
|
115
|
+
category10?: string;
|
|
116
|
+
category20?: string;
|
|
117
|
+
size?: number;
|
|
118
|
+
view?: WithPrefix<AreaTheme, 'view'> &
|
|
119
|
+
WithPrefix<AreaTheme, 'plot'> &
|
|
120
|
+
WithPrefix<AreaTheme, 'main'> &
|
|
121
|
+
WithPrefix<AreaTheme, 'content'>;
|
|
122
122
|
} & MarkTheme &
|
|
123
123
|
ComponentTheme &
|
|
124
124
|
AnimationTheme &
|
|
125
|
-
InteractionTheme
|
|
126
|
-
WithPrefix<AreaTheme, 'view'> &
|
|
127
|
-
WithPrefix<AreaTheme, 'plot'> &
|
|
128
|
-
WithPrefix<AreaTheme, 'main'> &
|
|
129
|
-
WithPrefix<AreaTheme, 'content'>;
|
|
125
|
+
InteractionTheme;
|
|
@@ -145,12 +145,18 @@ function inferInnerCircularStyle(
|
|
|
145
145
|
};
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
+
// Set to null will not be set with default value as below.
|
|
149
|
+
// const { x = 0 } = options;
|
|
150
|
+
function maybeUndefined(d) {
|
|
151
|
+
return d === undefined ? null : d;
|
|
152
|
+
}
|
|
153
|
+
|
|
148
154
|
export function inferIdentityStyle(position, points, value, coordinate) {
|
|
149
155
|
const { bounds } = value;
|
|
150
156
|
const [p] = bounds;
|
|
151
157
|
return {
|
|
152
|
-
x: p[0],
|
|
153
|
-
y: p[1],
|
|
158
|
+
x: maybeUndefined(p[0]),
|
|
159
|
+
y: maybeUndefined(p[1]),
|
|
154
160
|
};
|
|
155
161
|
}
|
|
156
162
|
|
|
@@ -143,8 +143,13 @@ export const Advance = createElement((g) => {
|
|
|
143
143
|
coordCenter,
|
|
144
144
|
...rest
|
|
145
145
|
} = g.attributes as TextShapeStyleProps;
|
|
146
|
-
|
|
147
|
-
|
|
146
|
+
|
|
147
|
+
// Position is invalid, do not render the UI,
|
|
148
|
+
// or clear previous elements.
|
|
149
|
+
if ([x, y, x0, y0].some((v) => !isNumber(v))) {
|
|
150
|
+
g.children.forEach((d) => d.remove());
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
148
153
|
|
|
149
154
|
const { padding, ...backgroundStyle } = subObject(rest, 'background');
|
|
150
155
|
const { points = [], ...connectorStyle } = subObject(rest, 'connector');
|
package/src/spec/component.ts
CHANGED
|
@@ -23,21 +23,17 @@ export type TitleComponent = {
|
|
|
23
23
|
*/
|
|
24
24
|
subtitle?: string | null;
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
26
|
+
* Align method for title.
|
|
27
27
|
*/
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
* The vertical spacing between title and subtitle, default is 2.
|
|
35
|
-
*/
|
|
36
|
-
spacing?: number;
|
|
37
|
-
};
|
|
38
|
-
};
|
|
28
|
+
align?: 'left' | 'center' | 'right';
|
|
29
|
+
/**
|
|
30
|
+
* The vertical spacing between title and subtitle, default is 2.
|
|
31
|
+
*/
|
|
32
|
+
spacing?: number;
|
|
33
|
+
} & UsePrefix<'title' | 'subtitle', Record<string, any>>;
|
|
39
34
|
|
|
40
35
|
export type AxisComponent = {
|
|
36
|
+
type?: 'axisX' | 'axisY';
|
|
41
37
|
tickCount?: number;
|
|
42
38
|
labelFormatter?: any;
|
|
43
39
|
tickFilter?: any;
|
|
@@ -48,10 +44,12 @@ export type AxisComponent = {
|
|
|
48
44
|
Record<string, any>
|
|
49
45
|
>
|
|
50
46
|
>;
|
|
47
|
+
scale?: Record<string, any>; //@todo
|
|
51
48
|
[key: string]: any; // @todo
|
|
52
49
|
};
|
|
53
50
|
|
|
54
51
|
export type LegendComponent = {
|
|
52
|
+
type?: 'legends';
|
|
55
53
|
tickCount?: number;
|
|
56
54
|
labelFormatter?: any;
|
|
57
55
|
tickFilter?: any;
|
|
@@ -63,6 +61,7 @@ export type LegendComponent = {
|
|
|
63
61
|
Record<string, any>
|
|
64
62
|
>
|
|
65
63
|
>;
|
|
64
|
+
scale?: Record<string, any>; //@todo
|
|
66
65
|
[key: string]: any; // @todo
|
|
67
66
|
};
|
|
68
67
|
|
package/src/spec/composition.ts
CHANGED
|
@@ -66,7 +66,7 @@ export type ViewComposition = {
|
|
|
66
66
|
interaction?: Literal2Object<Interaction>;
|
|
67
67
|
transform?: Transform[];
|
|
68
68
|
theme?: Theme;
|
|
69
|
-
children?: Mark[];
|
|
69
|
+
children?: (Mark | AxisComponent | LegendComponent)[];
|
|
70
70
|
scale?: Record<string, Scale>;
|
|
71
71
|
frame?: boolean;
|
|
72
72
|
labelTransform?: LabelTransform[];
|
package/src/spec/index.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { AxisComponent, LegendComponent } from './component';
|
|
1
2
|
import { Composition } from './composition';
|
|
2
3
|
import { Mark } from './mark';
|
|
3
4
|
|
|
4
|
-
export type G2Spec = (Mark | Composition) & {
|
|
5
|
+
export type G2Spec = (Mark | Composition | AxisComponent | LegendComponent) & {
|
|
5
6
|
width?: number;
|
|
6
7
|
height?: number;
|
|
7
8
|
};
|
package/src/spec/interaction.ts
CHANGED
|
@@ -184,8 +184,7 @@ export type TooltipInteraction = {
|
|
|
184
184
|
event, // @todo
|
|
185
185
|
options: { title: 'string'; items: TooltipItemValue[] },
|
|
186
186
|
) => HTMLElement | string;
|
|
187
|
-
|
|
188
|
-
};
|
|
187
|
+
} & Record<`crosshairs${any}`, any>;
|
|
189
188
|
|
|
190
189
|
export type FisheyeInteraction = {
|
|
191
190
|
type?: 'fisheye';
|
package/src/spec/mark.ts
CHANGED
|
@@ -280,7 +280,7 @@ export type SankeyMark = BaseMark<
|
|
|
280
280
|
linkLabels: Record<string, any>[];
|
|
281
281
|
};
|
|
282
282
|
|
|
283
|
-
export type PathMark = BaseMark<'path', ChannelTypes>;
|
|
283
|
+
export type PathMark = BaseMark<'path', ChannelTypes | 'd'>;
|
|
284
284
|
|
|
285
285
|
export type TreemapMark = BaseMark<'treemap', 'value' | ChannelTypes> & {
|
|
286
286
|
layout?: Record<string, any>;
|
package/src/theme/academy.ts
CHANGED
|
@@ -10,14 +10,14 @@ const COLORS = {
|
|
|
10
10
|
|
|
11
11
|
const BACKGROUND_COLOR = 'transparent';
|
|
12
12
|
|
|
13
|
+
const DEFAULT_COLOR = '#4e79a7';
|
|
14
|
+
|
|
13
15
|
export const Academy: TC<AcademyOptions> = (options) => {
|
|
14
|
-
const DEFAULT_COLOR = '#4e79a7';
|
|
15
16
|
const defaultOptions: Theme = {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
elementActiveStroke: COLORS.BLACK,
|
|
17
|
+
color: DEFAULT_COLOR,
|
|
18
|
+
size: 1,
|
|
19
|
+
category10: 'tableau10',
|
|
20
|
+
category20: 'tableau10',
|
|
21
21
|
enter: {
|
|
22
22
|
duration: 300,
|
|
23
23
|
fill: 'both',
|
|
@@ -33,12 +33,12 @@ export const Academy: TC<AcademyOptions> = (options) => {
|
|
|
33
33
|
fill: 'both',
|
|
34
34
|
delay: 0,
|
|
35
35
|
},
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
view: {
|
|
37
|
+
viewFill: BACKGROUND_COLOR,
|
|
38
|
+
plotFill: 'transparent',
|
|
39
|
+
mainFill: 'transparent',
|
|
40
|
+
contentFill: 'transparent',
|
|
41
|
+
},
|
|
42
42
|
line: {
|
|
43
43
|
line: {
|
|
44
44
|
fill: '',
|
|
@@ -198,26 +198,6 @@ export const Academy: TC<AcademyOptions> = (options) => {
|
|
|
198
198
|
endMarkerFillOpacity: 0.95,
|
|
199
199
|
},
|
|
200
200
|
},
|
|
201
|
-
interaction: {
|
|
202
|
-
active: {
|
|
203
|
-
line: {
|
|
204
|
-
line: { lineWidth: 3 },
|
|
205
|
-
},
|
|
206
|
-
interval: {
|
|
207
|
-
rect: { stroke: COLORS.BLACK },
|
|
208
|
-
},
|
|
209
|
-
area: {
|
|
210
|
-
area: { fillOpacity: 0.5 },
|
|
211
|
-
},
|
|
212
|
-
},
|
|
213
|
-
inactive: {
|
|
214
|
-
area: {
|
|
215
|
-
area: { fillOpacity: 0.3 },
|
|
216
|
-
},
|
|
217
|
-
},
|
|
218
|
-
selected: {},
|
|
219
|
-
disabled: {},
|
|
220
|
-
},
|
|
221
201
|
axis: {
|
|
222
202
|
arrow: false,
|
|
223
203
|
gridLineDash: [0, 0],
|
package/src/theme/classic.ts
CHANGED
|
@@ -10,17 +10,17 @@ const COLORS = {
|
|
|
10
10
|
|
|
11
11
|
const BACKGROUND_COLOR = 'transparent';
|
|
12
12
|
|
|
13
|
+
const DEFAULT_COLOR = '#5B8FF9';
|
|
14
|
+
|
|
13
15
|
/**
|
|
14
16
|
* Default theme.
|
|
15
17
|
*/
|
|
16
18
|
export const Classic: TC<ClassicOptions> = (options) => {
|
|
17
|
-
const DEFAULT_COLOR = '#5B8FF9';
|
|
18
19
|
const defaultOptions: Theme = {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
elementActiveStroke: COLORS.BLACK,
|
|
20
|
+
color: DEFAULT_COLOR,
|
|
21
|
+
size: 1,
|
|
22
|
+
category10: 'category10',
|
|
23
|
+
category20: 'category20',
|
|
24
24
|
enter: {
|
|
25
25
|
duration: 300,
|
|
26
26
|
fill: 'both',
|
|
@@ -36,12 +36,12 @@ export const Classic: TC<ClassicOptions> = (options) => {
|
|
|
36
36
|
fill: 'both',
|
|
37
37
|
delay: 0,
|
|
38
38
|
},
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
view: {
|
|
40
|
+
viewFill: BACKGROUND_COLOR,
|
|
41
|
+
plotFill: 'transparent',
|
|
42
|
+
mainFill: 'transparent',
|
|
43
|
+
contentFill: 'transparent',
|
|
44
|
+
},
|
|
45
45
|
line: {
|
|
46
46
|
line: {
|
|
47
47
|
fill: '',
|
|
@@ -132,7 +132,6 @@ export const Classic: TC<ClassicOptions> = (options) => {
|
|
|
132
132
|
},
|
|
133
133
|
text: {
|
|
134
134
|
text: {
|
|
135
|
-
// fill: COLORS.BLACK,fillOpacity: 0.65,
|
|
136
135
|
fill: '#1D2129',
|
|
137
136
|
fontSize: 12,
|
|
138
137
|
strokeWidth: 0,
|
|
@@ -199,26 +198,6 @@ export const Classic: TC<ClassicOptions> = (options) => {
|
|
|
199
198
|
endMarkerFillOpacity: 0.95,
|
|
200
199
|
},
|
|
201
200
|
},
|
|
202
|
-
interaction: {
|
|
203
|
-
active: {
|
|
204
|
-
line: {
|
|
205
|
-
line: { lineWidth: 3 },
|
|
206
|
-
},
|
|
207
|
-
interval: {
|
|
208
|
-
rect: { stroke: COLORS.BLACK },
|
|
209
|
-
},
|
|
210
|
-
area: {
|
|
211
|
-
area: { fillOpacity: 0.5 },
|
|
212
|
-
},
|
|
213
|
-
},
|
|
214
|
-
inactive: {
|
|
215
|
-
area: {
|
|
216
|
-
area: { fillOpacity: 0.3 },
|
|
217
|
-
},
|
|
218
|
-
},
|
|
219
|
-
selected: {},
|
|
220
|
-
disabled: {},
|
|
221
|
-
},
|
|
222
201
|
axis: {
|
|
223
202
|
arrow: false,
|
|
224
203
|
gridLineDash: [0, 0],
|
|
@@ -429,6 +408,7 @@ export const Classic: TC<ClassicOptions> = (options) => {
|
|
|
429
408
|
thumbHighlightedFillOpacity: 0.2,
|
|
430
409
|
},
|
|
431
410
|
title: {
|
|
411
|
+
spacing: 8,
|
|
432
412
|
titleFill: COLORS.BLACK,
|
|
433
413
|
titleFillOpacity: 0.85,
|
|
434
414
|
titleFontSize: 14,
|
package/src/theme/classicDark.ts
CHANGED
|
@@ -10,17 +10,17 @@ const COLORS = {
|
|
|
10
10
|
|
|
11
11
|
const BACKGROUND_COLOR = '#141414';
|
|
12
12
|
|
|
13
|
+
const DEFAULT_COLOR = '#5B8FF9';
|
|
14
|
+
|
|
13
15
|
/**
|
|
14
16
|
* Dark theme.
|
|
15
17
|
*/
|
|
16
18
|
export const ClassicDark: TC<ClassicDarkOptions> = (options) => {
|
|
17
|
-
const DEFAULT_COLOR = '#5B8FF9';
|
|
18
19
|
const defaultOptions: Theme = {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
elementActiveStroke: COLORS.BLACK,
|
|
20
|
+
color: DEFAULT_COLOR,
|
|
21
|
+
category10: 'category10',
|
|
22
|
+
category20: 'category20',
|
|
23
|
+
size: 1,
|
|
24
24
|
enter: {
|
|
25
25
|
duration: 300,
|
|
26
26
|
fill: 'both',
|
|
@@ -36,12 +36,12 @@ export const ClassicDark: TC<ClassicDarkOptions> = (options) => {
|
|
|
36
36
|
fill: 'both',
|
|
37
37
|
delay: 0,
|
|
38
38
|
},
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
view: {
|
|
40
|
+
viewFill: BACKGROUND_COLOR,
|
|
41
|
+
plotFill: 'transparent',
|
|
42
|
+
mainFill: 'transparent',
|
|
43
|
+
contentFill: 'transparent',
|
|
44
|
+
},
|
|
45
45
|
line: {
|
|
46
46
|
line: {
|
|
47
47
|
fill: '',
|
|
@@ -199,26 +199,6 @@ export const ClassicDark: TC<ClassicDarkOptions> = (options) => {
|
|
|
199
199
|
endMarkerFillOpacity: 0.95,
|
|
200
200
|
},
|
|
201
201
|
},
|
|
202
|
-
interaction: {
|
|
203
|
-
active: {
|
|
204
|
-
line: {
|
|
205
|
-
line: { lineWidth: 3 },
|
|
206
|
-
},
|
|
207
|
-
interval: {
|
|
208
|
-
rect: { stroke: COLORS.BLACK },
|
|
209
|
-
},
|
|
210
|
-
area: {
|
|
211
|
-
area: { fillOpacity: 0.5 },
|
|
212
|
-
},
|
|
213
|
-
},
|
|
214
|
-
inactive: {
|
|
215
|
-
area: {
|
|
216
|
-
area: { fillOpacity: 0.3 },
|
|
217
|
-
},
|
|
218
|
-
},
|
|
219
|
-
selected: {},
|
|
220
|
-
disabled: {},
|
|
221
|
-
},
|
|
222
202
|
axis: {
|
|
223
203
|
arrow: false,
|
|
224
204
|
gridLineDash: [0, 0],
|