@antv/g2 5.0.0-beta.8 → 5.0.0-beta.9
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/dist/g2-lite.min.js +3 -3
- package/dist/g2.min.js +4 -4
- package/esm/animation/morphing.js +22 -2
- package/esm/animation/morphing.js.map +1 -1
- package/esm/api/chart.d.ts +3 -2
- package/esm/api/chart.js +6 -4
- package/esm/api/chart.js.map +1 -1
- package/esm/api/mark/base.d.ts +1 -1
- package/esm/api/mark/base.js +1 -1
- package/esm/api/mark/base.js.map +1 -1
- package/esm/component/axis.d.ts +5 -7
- package/esm/component/axis.js +126 -98
- package/esm/component/axis.js.map +1 -1
- package/esm/component/axisArc.d.ts +7 -0
- package/esm/component/axisArc.js +9 -0
- package/esm/component/axisArc.js.map +1 -0
- package/esm/component/axisRadar.d.ts +9 -0
- package/esm/component/axisRadar.js +46 -0
- package/esm/component/axisRadar.js.map +1 -0
- package/esm/component/axisX.d.ts +2 -1
- package/esm/component/axisX.js +5 -4
- package/esm/component/axisX.js.map +1 -1
- package/esm/component/axisY.d.ts +1 -1
- package/esm/component/axisY.js +4 -4
- package/esm/component/axisY.js.map +1 -1
- package/esm/component/index.d.ts +8 -0
- package/esm/component/index.js +5 -0
- package/esm/component/index.js.map +1 -1
- package/esm/component/legendCategory.d.ts +5 -3
- package/esm/component/legendCategory.js +80 -36
- package/esm/component/legendCategory.js.map +1 -1
- package/esm/component/legendContinuous.d.ts +3 -2
- package/esm/component/legendContinuous.js +66 -12
- package/esm/component/legendContinuous.js.map +1 -1
- package/esm/component/legendContinuousBlock.d.ts +4 -0
- package/esm/component/legendContinuousBlock.js +6 -0
- package/esm/component/legendContinuousBlock.js.map +1 -0
- package/esm/component/legendContinuousBlockSize.d.ts +4 -0
- package/esm/component/legendContinuousBlockSize.js +6 -0
- package/esm/component/legendContinuousBlockSize.js.map +1 -0
- package/esm/component/legendContinuousSize.d.ts +4 -0
- package/esm/component/legendContinuousSize.js +10 -0
- package/esm/component/legendContinuousSize.js.map +1 -0
- package/esm/component/scrollbar.js +1 -1
- package/esm/component/scrollbar.js.map +1 -1
- package/esm/component/slider.js +1 -1
- package/esm/component/slider.js.map +1 -1
- package/esm/component/title.js +1 -1
- package/esm/component/title.js.map +1 -1
- package/esm/component/utils.d.ts +12 -0
- package/esm/component/utils.js +35 -0
- package/esm/component/utils.js.map +1 -1
- package/esm/composition/facetCircle.js +1 -1
- package/esm/composition/facetCircle.js.map +1 -1
- package/esm/coordinate/index.d.ts +3 -3
- package/esm/coordinate/index.js +3 -3
- package/esm/coordinate/index.js.map +1 -1
- package/esm/coordinate/polar.d.ts +6 -0
- package/esm/coordinate/polar.js +18 -6
- package/esm/coordinate/polar.js.map +1 -1
- package/esm/coordinate/radial.d.ts +6 -0
- package/esm/coordinate/radial.js +17 -5
- package/esm/coordinate/radial.js.map +1 -1
- package/esm/coordinate/theta.d.ts +7 -0
- package/esm/coordinate/theta.js +16 -4
- package/esm/coordinate/theta.js.map +1 -1
- package/esm/interaction/index.d.ts +1 -0
- package/esm/interaction/index.js +1 -0
- package/esm/interaction/index.js.map +1 -1
- package/esm/interaction/native/brushAxisHighlight.js +6 -1
- package/esm/interaction/native/brushAxisHighlight.js.map +1 -1
- package/esm/interaction/native/brushFilter.js +1 -1
- package/esm/interaction/native/brushFilter.js.map +1 -1
- package/esm/interaction/native/legendFilter.d.ts +2 -0
- package/esm/interaction/native/legendFilter.js +19 -3
- package/esm/interaction/native/legendFilter.js.map +1 -1
- package/esm/interaction/native/legendHighlight.js +2 -3
- package/esm/interaction/native/legendHighlight.js.map +1 -1
- package/esm/interaction/native/poptip.d.ts +5 -0
- package/esm/interaction/native/poptip.js +91 -0
- package/esm/interaction/native/poptip.js.map +1 -0
- package/esm/mark/pack.js +0 -1
- package/esm/mark/pack.js.map +1 -1
- package/esm/mark/treemap.js +0 -1
- package/esm/mark/treemap.js.map +1 -1
- package/esm/runtime/component.d.ts +3 -0
- package/esm/runtime/component.js +246 -103
- package/esm/runtime/component.js.map +1 -1
- package/esm/runtime/coordinate.d.ts +11 -0
- package/esm/runtime/coordinate.js +23 -16
- package/esm/runtime/coordinate.js.map +1 -1
- package/esm/runtime/layout.d.ts +1 -1
- package/esm/runtime/layout.js +145 -76
- package/esm/runtime/layout.js.map +1 -1
- package/esm/runtime/plot.js +1 -0
- package/esm/runtime/plot.js.map +1 -1
- package/esm/runtime/scale.d.ts +2 -1
- package/esm/runtime/scale.js +35 -0
- package/esm/runtime/scale.js.map +1 -1
- package/esm/runtime/transform.js +1 -1
- package/esm/runtime/transform.js.map +1 -1
- package/esm/runtime/types/common.d.ts +11 -2
- package/esm/runtime/types/component.d.ts +9 -7
- package/esm/runtime/types/options.d.ts +5 -5
- package/esm/runtime/types/scale.d.ts +18 -0
- package/esm/runtime/types/scale.js +19 -0
- package/esm/runtime/types/scale.js.map +1 -0
- package/esm/runtime/types/theme.d.ts +2 -1
- package/esm/shape/connector/connector.js +1 -1
- package/esm/shape/utils.js.map +1 -1
- package/esm/spec/geometry.d.ts +1 -1
- package/esm/spec/interaction.d.ts +11 -6
- package/esm/stdlib/index.js +3 -3
- package/esm/stdlib/index.js.map +1 -1
- package/esm/theme/academy.js +10 -4
- package/esm/theme/academy.js.map +1 -1
- package/esm/theme/dark.js +10 -4
- package/esm/theme/dark.js.map +1 -1
- package/esm/theme/light.js +12 -4
- package/esm/theme/light.js.map +1 -1
- package/esm/utils/angle.d.ts +2 -0
- package/esm/utils/angle.js +7 -0
- package/esm/utils/angle.js.map +1 -0
- package/esm/utils/array.d.ts +8 -0
- package/esm/utils/array.js +35 -0
- package/esm/utils/array.js.map +1 -1
- package/esm/utils/coordinate.d.ts +4 -0
- package/esm/utils/coordinate.js +19 -0
- package/esm/utils/coordinate.js.map +1 -1
- package/lib/animation/morphing.js +22 -2
- package/lib/animation/morphing.js.map +1 -1
- package/lib/api/chart.d.ts +3 -2
- package/lib/api/chart.js +6 -4
- package/lib/api/chart.js.map +1 -1
- package/lib/api/mark/base.d.ts +1 -1
- package/lib/api/mark/base.js +1 -1
- package/lib/api/mark/base.js.map +1 -1
- package/lib/component/axis.d.ts +5 -7
- package/lib/component/axis.js +127 -100
- package/lib/component/axis.js.map +1 -1
- package/lib/component/axisArc.d.ts +7 -0
- package/lib/component/axisArc.js +13 -0
- package/lib/component/axisArc.js.map +1 -0
- package/lib/component/axisRadar.d.ts +9 -0
- package/lib/component/axisRadar.js +50 -0
- package/lib/component/axisRadar.js.map +1 -0
- package/lib/component/axisX.d.ts +2 -1
- package/lib/component/axisX.js +6 -4
- package/lib/component/axisX.js.map +1 -1
- package/lib/component/axisY.d.ts +1 -1
- package/lib/component/axisY.js +3 -3
- package/lib/component/axisY.js.map +1 -1
- package/lib/component/index.d.ts +8 -0
- package/lib/component/index.js +12 -1
- package/lib/component/index.js.map +1 -1
- package/lib/component/legendCategory.d.ts +5 -3
- package/lib/component/legendCategory.js +79 -35
- package/lib/component/legendCategory.js.map +1 -1
- package/lib/component/legendContinuous.d.ts +3 -2
- package/lib/component/legendContinuous.js +65 -11
- package/lib/component/legendContinuous.js.map +1 -1
- package/lib/component/legendContinuousBlock.d.ts +4 -0
- package/lib/component/legendContinuousBlock.js +10 -0
- package/lib/component/legendContinuousBlock.js.map +1 -0
- package/lib/component/legendContinuousBlockSize.d.ts +4 -0
- package/lib/component/legendContinuousBlockSize.js +10 -0
- package/lib/component/legendContinuousBlockSize.js.map +1 -0
- package/lib/component/legendContinuousSize.d.ts +4 -0
- package/lib/component/legendContinuousSize.js +14 -0
- package/lib/component/legendContinuousSize.js.map +1 -0
- package/lib/component/scrollbar.js +1 -1
- package/lib/component/scrollbar.js.map +1 -1
- package/lib/component/slider.js +1 -1
- package/lib/component/slider.js.map +1 -1
- package/lib/component/title.js +1 -1
- package/lib/component/title.js.map +1 -1
- package/lib/component/utils.d.ts +12 -0
- package/lib/component/utils.js +39 -1
- package/lib/component/utils.js.map +1 -1
- package/lib/composition/facetCircle.js +1 -1
- package/lib/composition/facetCircle.js.map +1 -1
- package/lib/coordinate/index.d.ts +3 -3
- package/lib/coordinate/index.js +4 -1
- package/lib/coordinate/index.js.map +1 -1
- package/lib/coordinate/polar.d.ts +6 -0
- package/lib/coordinate/polar.js +20 -7
- package/lib/coordinate/polar.js.map +1 -1
- package/lib/coordinate/radial.d.ts +6 -0
- package/lib/coordinate/radial.js +19 -6
- package/lib/coordinate/radial.js.map +1 -1
- package/lib/coordinate/theta.d.ts +7 -0
- package/lib/coordinate/theta.js +18 -5
- package/lib/coordinate/theta.js.map +1 -1
- package/lib/interaction/index.d.ts +1 -0
- package/lib/interaction/index.js +3 -1
- package/lib/interaction/index.js.map +1 -1
- package/lib/interaction/native/brushAxisHighlight.js +6 -1
- package/lib/interaction/native/brushAxisHighlight.js.map +1 -1
- package/lib/interaction/native/brushFilter.js +1 -1
- package/lib/interaction/native/brushFilter.js.map +1 -1
- package/lib/interaction/native/legendFilter.d.ts +2 -0
- package/lib/interaction/native/legendFilter.js +22 -4
- package/lib/interaction/native/legendFilter.js.map +1 -1
- package/lib/interaction/native/legendHighlight.js +1 -2
- package/lib/interaction/native/legendHighlight.js.map +1 -1
- package/lib/interaction/native/poptip.d.ts +5 -0
- package/lib/interaction/native/poptip.js +95 -0
- package/lib/interaction/native/poptip.js.map +1 -0
- package/lib/mark/pack.js +0 -1
- package/lib/mark/pack.js.map +1 -1
- package/lib/mark/treemap.js +0 -1
- package/lib/mark/treemap.js.map +1 -1
- package/lib/runtime/component.d.ts +3 -0
- package/lib/runtime/component.js +250 -107
- package/lib/runtime/component.js.map +1 -1
- package/lib/runtime/coordinate.d.ts +11 -0
- package/lib/runtime/coordinate.js +26 -17
- package/lib/runtime/coordinate.js.map +1 -1
- package/lib/runtime/layout.d.ts +1 -1
- package/lib/runtime/layout.js +146 -77
- package/lib/runtime/layout.js.map +1 -1
- package/lib/runtime/plot.js +1 -0
- package/lib/runtime/plot.js.map +1 -1
- package/lib/runtime/scale.d.ts +2 -1
- package/lib/runtime/scale.js +37 -1
- package/lib/runtime/scale.js.map +1 -1
- package/lib/runtime/transform.js +1 -1
- package/lib/runtime/transform.js.map +1 -1
- package/lib/runtime/types/common.d.ts +11 -2
- package/lib/runtime/types/component.d.ts +9 -7
- package/lib/runtime/types/options.d.ts +5 -5
- package/lib/runtime/types/scale.d.ts +18 -0
- package/lib/runtime/types/scale.js +22 -0
- package/lib/runtime/types/scale.js.map +1 -0
- package/lib/runtime/types/theme.d.ts +2 -1
- package/lib/shape/connector/connector.js +1 -1
- package/lib/shape/utils.js.map +1 -1
- package/lib/spec/geometry.d.ts +1 -1
- package/lib/spec/interaction.d.ts +11 -6
- package/lib/stdlib/index.js +1 -1
- package/lib/stdlib/index.js.map +1 -1
- package/lib/theme/academy.js +10 -4
- package/lib/theme/academy.js.map +1 -1
- package/lib/theme/dark.js +10 -4
- package/lib/theme/dark.js.map +1 -1
- package/lib/theme/light.js +12 -4
- package/lib/theme/light.js.map +1 -1
- package/lib/utils/angle.d.ts +2 -0
- package/lib/utils/angle.js +12 -0
- package/lib/utils/angle.js.map +1 -0
- package/lib/utils/array.d.ts +8 -0
- package/lib/utils/array.js +38 -1
- package/lib/utils/array.js.map +1 -1
- package/lib/utils/coordinate.d.ts +4 -0
- package/lib/utils/coordinate.js +24 -1
- package/lib/utils/coordinate.js.map +1 -1
- package/package.json +5 -6
- package/src/animation/morphing.ts +23 -2
- package/src/api/chart.ts +8 -6
- package/src/api/mark/base.ts +1 -1
- package/src/component/axis.ts +199 -125
- package/src/component/axisArc.ts +16 -0
- package/src/component/axisRadar.ts +73 -0
- package/src/component/axisX.ts +7 -4
- package/src/component/axisY.ts +4 -4
- package/src/component/index.ts +8 -0
- package/src/component/legendCategory.ts +156 -35
- package/src/component/legendContinuous.ts +121 -30
- package/src/component/legendContinuousBlock.ts +17 -0
- package/src/component/legendContinuousBlockSize.ts +22 -0
- package/src/component/legendContinuousSize.ts +27 -0
- package/src/component/scrollbar.ts +1 -1
- package/src/component/slider.ts +1 -1
- package/src/component/title.ts +1 -1
- package/src/component/utils.ts +46 -0
- package/src/composition/facetCircle.ts +1 -1
- package/src/coordinate/index.ts +3 -3
- package/src/coordinate/polar.ts +19 -11
- package/src/coordinate/radial.ts +19 -10
- package/src/coordinate/theta.ts +18 -9
- package/src/interaction/index.ts +1 -0
- package/src/interaction/native/brushAxisHighlight.ts +9 -1
- package/src/interaction/native/brushFilter.ts +1 -1
- package/src/interaction/native/legendFilter.ts +21 -3
- package/src/interaction/native/legendHighlight.ts +2 -3
- package/src/interaction/native/poptip.ts +87 -0
- package/src/mark/pack.ts +0 -1
- package/src/mark/treemap.ts +0 -1
- package/src/runtime/component.ts +335 -124
- package/src/runtime/coordinate.ts +29 -16
- package/src/runtime/layout.ts +206 -97
- package/src/runtime/plot.ts +1 -0
- package/src/runtime/scale.ts +41 -0
- package/src/runtime/transform.ts +3 -0
- package/src/runtime/types/common.ts +23 -10
- package/src/runtime/types/component.ts +19 -10
- package/src/runtime/types/options.ts +15 -15
- package/src/runtime/types/scale.ts +20 -0
- package/src/runtime/types/theme.ts +2 -1
- package/src/shape/connector/connector.ts +1 -1
- package/src/shape/utils.ts +2 -0
- package/src/spec/geometry.ts +3 -1
- package/src/spec/interaction.ts +16 -8
- package/src/stdlib/index.ts +14 -0
- package/src/theme/academy.ts +10 -4
- package/src/theme/dark.ts +10 -4
- package/src/theme/light.ts +12 -4
- package/src/utils/angle.ts +7 -0
- package/src/utils/array.ts +39 -0
- package/src/utils/coordinate.ts +29 -0
- package/src/.DS_Store +0 -0
- package/src/data/.DS_Store +0 -0
- package/src/shape/.DS_Store +0 -0
package/src/spec/interaction.ts
CHANGED
|
@@ -20,10 +20,11 @@ export type Interaction =
|
|
|
20
20
|
| BrushXHighlightInteraction
|
|
21
21
|
| BrushYHighlightInteraction
|
|
22
22
|
| BrushAxisHighlightInteraction
|
|
23
|
-
|
|
|
24
|
-
|
|
|
25
|
-
|
|
|
26
|
-
|
|
|
23
|
+
| BrushFilterInteraction
|
|
24
|
+
| BrushYFilterInteraction
|
|
25
|
+
| BrushXFilterInteraction
|
|
26
|
+
| SliderFilterInteraction
|
|
27
|
+
| PoptipInteraction;
|
|
27
28
|
// | ElementListHighlightInteraction
|
|
28
29
|
// | LegendActiveInteraction
|
|
29
30
|
// | LegendHighlightInteraction
|
|
@@ -54,6 +55,7 @@ export type InteractionTypes =
|
|
|
54
55
|
| 'brushXFilter'
|
|
55
56
|
| 'brushYFilter'
|
|
56
57
|
| 'sliderFilter'
|
|
58
|
+
| 'poptip'
|
|
57
59
|
| InteractionComponent;
|
|
58
60
|
// | 'elementListHighlight'
|
|
59
61
|
// | 'legendActive'
|
|
@@ -103,17 +105,17 @@ export type BrushAxisHighlightInteraction = {
|
|
|
103
105
|
reverse?: boolean;
|
|
104
106
|
} & Record<`${'mask' | 'highlighted' | 'unhighlighted'}${any}`, any>;
|
|
105
107
|
|
|
106
|
-
export type
|
|
108
|
+
export type BrushFilterInteraction = {
|
|
107
109
|
type?: 'brushFilter';
|
|
108
110
|
reverse?: boolean;
|
|
109
111
|
} & Record<`${'mask' | 'highlighted' | 'unhighlighted'}${any}`, any>;
|
|
110
112
|
|
|
111
|
-
export type
|
|
113
|
+
export type BrushXFilterInteraction = {
|
|
112
114
|
type?: 'brushXFilter';
|
|
113
115
|
reverse?: boolean;
|
|
114
116
|
} & Record<`${'mask' | 'highlighted' | 'unhighlighted'}${any}`, any>;
|
|
115
117
|
|
|
116
|
-
export type
|
|
118
|
+
export type BrushYFilterInteraction = {
|
|
117
119
|
type?: 'brushYFilter';
|
|
118
120
|
reverse?: boolean;
|
|
119
121
|
} & Record<`${'mask' | 'highlighted' | 'unhighlighted'}${any}`, any>;
|
|
@@ -176,6 +178,12 @@ export type ElementHighlightByColorInteraction = {
|
|
|
176
178
|
any
|
|
177
179
|
>;
|
|
178
180
|
|
|
181
|
+
export type PoptipInteraction = {
|
|
182
|
+
type?: 'poptip';
|
|
183
|
+
offsetX?: number;
|
|
184
|
+
offsetY?: number;
|
|
185
|
+
} & Record<`tip${any}`, any>;
|
|
186
|
+
|
|
179
187
|
export type LegendFilterInteraction = {
|
|
180
188
|
type?: 'legendFilter';
|
|
181
189
|
channel?: ChannelTypes;
|
|
@@ -194,7 +202,7 @@ export type ChartIndexInteraction = {
|
|
|
194
202
|
trailing?: boolean;
|
|
195
203
|
} & Record<`${'rule' | 'label'}${any}`, any>;
|
|
196
204
|
|
|
197
|
-
export type
|
|
205
|
+
export type SliderFilterInteraction = {
|
|
198
206
|
type?: 'sliderFilter';
|
|
199
207
|
wait?: number;
|
|
200
208
|
leading?: boolean;
|
package/src/stdlib/index.ts
CHANGED
|
@@ -135,10 +135,16 @@ import {
|
|
|
135
135
|
} from '../shape';
|
|
136
136
|
import { Light, Dark, Academy } from '../theme';
|
|
137
137
|
import {
|
|
138
|
+
AxisLinear,
|
|
139
|
+
AxisArc,
|
|
138
140
|
AxisX,
|
|
139
141
|
AxisY,
|
|
142
|
+
AxisRadar,
|
|
140
143
|
LegendCategory,
|
|
141
144
|
LegendContinuous,
|
|
145
|
+
LegendContinuousBlock,
|
|
146
|
+
LegendContinuousBlockSize,
|
|
147
|
+
LegendContinuousSize,
|
|
142
148
|
TitleComponent,
|
|
143
149
|
SliderX,
|
|
144
150
|
SliderY,
|
|
@@ -180,6 +186,7 @@ import {
|
|
|
180
186
|
BrushXFilter,
|
|
181
187
|
BrushYFilter,
|
|
182
188
|
SliderFilter,
|
|
189
|
+
Poptip,
|
|
183
190
|
// ElementHighlightByX,
|
|
184
191
|
// ElementHighlightByColor,
|
|
185
192
|
// ElementListHighlight,
|
|
@@ -474,8 +481,14 @@ export function createLibrary(): G2Library {
|
|
|
474
481
|
'theme.academy': Academy,
|
|
475
482
|
'component.axisX': AxisX,
|
|
476
483
|
'component.axisY': AxisY,
|
|
484
|
+
'component.axisRadar': AxisRadar,
|
|
485
|
+
'component.axisLinear': AxisLinear,
|
|
486
|
+
'component.axisArc': AxisArc,
|
|
477
487
|
'component.legendCategory': LegendCategory,
|
|
478
488
|
'component.legendContinuous': LegendContinuous,
|
|
489
|
+
'component.legendContinuousBlock': LegendContinuousBlock,
|
|
490
|
+
'component.legendContinuousBlockSize': LegendContinuousBlockSize,
|
|
491
|
+
'component.legendContinuousSize': LegendContinuousSize,
|
|
479
492
|
'component.title': TitleComponent,
|
|
480
493
|
'component.sliderX': SliderX,
|
|
481
494
|
'component.sliderY': SliderY,
|
|
@@ -513,6 +526,7 @@ export function createLibrary(): G2Library {
|
|
|
513
526
|
'interaction.brushXFilter': BrushXFilter,
|
|
514
527
|
'interaction.brushYFilter': BrushYFilter,
|
|
515
528
|
'interaction.sliderFilter': SliderFilter,
|
|
529
|
+
'interaction.poptip': Poptip,
|
|
516
530
|
// 'interaction.elementSelected': ElementSelected,
|
|
517
531
|
// 'interaction.elementHighlight': ElementHighlight,
|
|
518
532
|
// 'interaction.elementHighlightByX': ElementHighlightByX,
|
package/src/theme/academy.ts
CHANGED
|
@@ -284,16 +284,22 @@ export const Academy: TC<AcademyOptions> = (options) => {
|
|
|
284
284
|
tickDirection: 'negative',
|
|
285
285
|
gridDirection: 'positive',
|
|
286
286
|
},
|
|
287
|
-
|
|
287
|
+
axisLinear: {
|
|
288
288
|
titlePosition: 'top',
|
|
289
|
-
titleSpacing: 0,
|
|
290
289
|
titleTextBaseline: 'bottom',
|
|
291
290
|
gridDirection: 'negative',
|
|
292
291
|
gridConnect: 'arc',
|
|
293
|
-
gridControlAngles: [90, 180, 360],
|
|
294
292
|
gridType: 'surround',
|
|
295
293
|
girdClosed: true,
|
|
296
294
|
},
|
|
295
|
+
axisRadar: {
|
|
296
|
+
titlePosition: 'start',
|
|
297
|
+
showTick: false,
|
|
298
|
+
showLabel: false,
|
|
299
|
+
gridType: 'surround',
|
|
300
|
+
girdClosed: true,
|
|
301
|
+
gridStrokeOpacity: 0.3,
|
|
302
|
+
},
|
|
297
303
|
legend: {
|
|
298
304
|
padding: 8,
|
|
299
305
|
showTitle: false,
|
|
@@ -303,7 +309,7 @@ export const Academy: TC<AcademyOptions> = (options) => {
|
|
|
303
309
|
titleFontWeight: 'bold',
|
|
304
310
|
titleSpacing: 4,
|
|
305
311
|
// legend marker
|
|
306
|
-
itemMarkerFill: DEFAULT_COLOR,
|
|
312
|
+
// itemMarkerFill: DEFAULT_COLOR,
|
|
307
313
|
itemMarkerFillOpacity: 1,
|
|
308
314
|
itemMarkerSize: 8,
|
|
309
315
|
itemSpacing: [5, 4],
|
package/src/theme/dark.ts
CHANGED
|
@@ -290,16 +290,22 @@ export const Dark: TC<DarkOptions> = (options) => {
|
|
|
290
290
|
tickDirection: 'negative',
|
|
291
291
|
gridDirection: 'positive',
|
|
292
292
|
},
|
|
293
|
-
|
|
293
|
+
axisLinear: {
|
|
294
294
|
titlePosition: 'top',
|
|
295
|
-
titleSpacing: 0,
|
|
296
295
|
titleTextBaseline: 'bottom',
|
|
297
296
|
gridDirection: 'negative',
|
|
298
297
|
gridConnect: 'arc',
|
|
299
|
-
gridControlAngles: [90, 180, 360],
|
|
300
298
|
gridType: 'surround',
|
|
301
299
|
girdClosed: true,
|
|
302
300
|
},
|
|
301
|
+
axisRadar: {
|
|
302
|
+
titlePosition: 'start',
|
|
303
|
+
showTick: false,
|
|
304
|
+
showLabel: false,
|
|
305
|
+
gridType: 'surround',
|
|
306
|
+
girdClosed: true,
|
|
307
|
+
gridStrokeOpacity: 0.3,
|
|
308
|
+
},
|
|
303
309
|
legend: {
|
|
304
310
|
padding: 8,
|
|
305
311
|
showTitle: false,
|
|
@@ -309,7 +315,7 @@ export const Dark: TC<DarkOptions> = (options) => {
|
|
|
309
315
|
titleFontWeight: 'normal',
|
|
310
316
|
titleSpacing: 4,
|
|
311
317
|
// legend marker
|
|
312
|
-
itemMarkerFill: DEFAULT_COLOR,
|
|
318
|
+
// itemMarkerFill: DEFAULT_COLOR,
|
|
313
319
|
itemMarkerFillOpacity: 1,
|
|
314
320
|
itemMarkerSize: 8,
|
|
315
321
|
itemSpacing: [5, 8],
|
package/src/theme/light.ts
CHANGED
|
@@ -290,16 +290,22 @@ export const Light: TC<LightOptions> = (options) => {
|
|
|
290
290
|
tickDirection: 'negative',
|
|
291
291
|
gridDirection: 'positive',
|
|
292
292
|
},
|
|
293
|
-
|
|
293
|
+
axisLinear: {
|
|
294
294
|
titlePosition: 'top',
|
|
295
295
|
titleSpacing: 0,
|
|
296
|
-
titleTextBaseline: 'bottom',
|
|
297
296
|
gridDirection: 'negative',
|
|
298
297
|
gridConnect: 'arc',
|
|
299
|
-
gridControlAngles: [90, 180, 360],
|
|
300
298
|
gridType: 'surround',
|
|
301
299
|
girdClosed: true,
|
|
302
300
|
},
|
|
301
|
+
axisRadar: {
|
|
302
|
+
titlePosition: 'start',
|
|
303
|
+
showTick: false,
|
|
304
|
+
showLabel: false,
|
|
305
|
+
gridType: 'surround',
|
|
306
|
+
girdClosed: true,
|
|
307
|
+
gridStrokeOpacity: 0.3,
|
|
308
|
+
},
|
|
303
309
|
legend: {
|
|
304
310
|
padding: 8,
|
|
305
311
|
showTitle: false,
|
|
@@ -309,7 +315,7 @@ export const Light: TC<LightOptions> = (options) => {
|
|
|
309
315
|
titleFontWeight: 'normal',
|
|
310
316
|
titleSpacing: 4,
|
|
311
317
|
// legend marker
|
|
312
|
-
itemMarkerFill: DEFAULT_COLOR,
|
|
318
|
+
// itemMarkerFill: DEFAULT_COLOR,
|
|
313
319
|
itemMarkerFillOpacity: 1,
|
|
314
320
|
itemMarkerSize: 8,
|
|
315
321
|
itemSpacing: [5, 8],
|
|
@@ -347,6 +353,8 @@ export const Light: TC<LightOptions> = (options) => {
|
|
|
347
353
|
handleLabelFillOpacity: 0.45,
|
|
348
354
|
handleLabelFontSize: 12,
|
|
349
355
|
handleLabelFontWeight: 'normal',
|
|
356
|
+
labelShowTick: true,
|
|
357
|
+
labelSpacing: 8,
|
|
350
358
|
// [todo] legend rail
|
|
351
359
|
},
|
|
352
360
|
label: {
|
package/src/utils/array.ts
CHANGED
|
@@ -48,3 +48,42 @@ export function isFlatArray<T>(array: (T | T[])[]): array is T[] {
|
|
|
48
48
|
export function unique<T>(array: T[]): T[] {
|
|
49
49
|
return Array.from(new Set(array));
|
|
50
50
|
}
|
|
51
|
+
|
|
52
|
+
export function divide<T>(
|
|
53
|
+
array: T[],
|
|
54
|
+
callbackfn: (item: T) => boolean,
|
|
55
|
+
): [T[], T[]] {
|
|
56
|
+
const result: [T[], T[]] = [[], []];
|
|
57
|
+
array.forEach((item) => {
|
|
58
|
+
result[callbackfn(item) ? 0 : 1].push(item);
|
|
59
|
+
});
|
|
60
|
+
return result;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function comb<T>(array: T[], len = array.length): T[][] {
|
|
64
|
+
if (len === 1) return array.map((item) => [item]);
|
|
65
|
+
const result: T[][] = [];
|
|
66
|
+
for (let i = 0; i < array.length; i++) {
|
|
67
|
+
const rest = array.slice(i + 1);
|
|
68
|
+
const restComb = comb(rest, len - 1);
|
|
69
|
+
restComb.forEach((comb) => {
|
|
70
|
+
result.push([array[i], ...comb]);
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
return result;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* get all combinations of two elements in an array
|
|
78
|
+
* @example [1, 2, 3] => [[1], [2], [3], [1, 2], [1, 3], [2, 3], [1, 2, 3]]
|
|
79
|
+
* @param array
|
|
80
|
+
* @returns
|
|
81
|
+
*/
|
|
82
|
+
export function combine<T>(array: T[]): T[][] {
|
|
83
|
+
if (array.length === 1) return [array];
|
|
84
|
+
const result: T[][] = [];
|
|
85
|
+
for (let i = 1; i <= array.length; i++) {
|
|
86
|
+
result.push(...comb(array, i));
|
|
87
|
+
}
|
|
88
|
+
return result;
|
|
89
|
+
}
|
package/src/utils/coordinate.ts
CHANGED
|
@@ -37,6 +37,10 @@ export function isFisheye(coordinate: Coordinate): boolean {
|
|
|
37
37
|
return transformations.some(([type]) => type === 'fisheye');
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
export function isRadar(coordinate: Coordinate): boolean {
|
|
41
|
+
return isParallel(coordinate) && isPolar(coordinate);
|
|
42
|
+
}
|
|
43
|
+
|
|
40
44
|
export function isCircular(coordinate: Coordinate): boolean {
|
|
41
45
|
return isHelix(coordinate) || isPolar(coordinate);
|
|
42
46
|
}
|
|
@@ -45,6 +49,15 @@ export function isTheta(coordinate: Coordinate): boolean {
|
|
|
45
49
|
return isPolar(coordinate) && isTranspose(coordinate);
|
|
46
50
|
}
|
|
47
51
|
|
|
52
|
+
export function isNonCartesian(coordinate: Coordinate): boolean {
|
|
53
|
+
return (
|
|
54
|
+
isPolar(coordinate) ||
|
|
55
|
+
isParallel(coordinate) ||
|
|
56
|
+
isRadial(coordinate) ||
|
|
57
|
+
isTheta(coordinate)
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
48
61
|
export function getRadius(coordinate: Coordinate): number {
|
|
49
62
|
if (isCircular(coordinate)) {
|
|
50
63
|
const [width, height] = coordinate.getSize();
|
|
@@ -56,3 +69,19 @@ export function getRadius(coordinate: Coordinate): number {
|
|
|
56
69
|
}
|
|
57
70
|
return 0;
|
|
58
71
|
}
|
|
72
|
+
|
|
73
|
+
export function radiusOf(coordinate: Coordinate): [number, number] {
|
|
74
|
+
const { transformations } = coordinate.getOptions();
|
|
75
|
+
const [, , , innerRadius, outerRadius] = transformations.find(
|
|
76
|
+
(d) => d[0] === 'polar',
|
|
77
|
+
);
|
|
78
|
+
return [+innerRadius, +outerRadius];
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export function angleOf(coordinate: Coordinate): [number, number] {
|
|
82
|
+
const { transformations } = coordinate.getOptions();
|
|
83
|
+
const [, startAngle, endAngle] = transformations.find(
|
|
84
|
+
(d) => d[0] === 'polar',
|
|
85
|
+
);
|
|
86
|
+
return [(+startAngle * 180) / Math.PI, (+endAngle * 180) / Math.PI];
|
|
87
|
+
}
|
package/src/.DS_Store
DELETED
|
Binary file
|
package/src/data/.DS_Store
DELETED
|
Binary file
|
package/src/shape/.DS_Store
DELETED
|
Binary file
|