@antv/g2 5.0.0-beta.1 → 5.0.0-beta.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.
Files changed (157) hide show
  1. package/dist/g2-lite.min.js +2 -2
  2. package/dist/g2.min.js +2 -2
  3. package/esm/animation/morphing.js +10 -8
  4. package/esm/animation/morphing.js.map +1 -1
  5. package/esm/api/chart.js +2 -5
  6. package/esm/api/chart.js.map +1 -1
  7. package/esm/component/axis.d.ts +1 -2
  8. package/esm/component/axis.js +81 -198
  9. package/esm/component/axis.js.map +1 -1
  10. package/esm/component/legendCategory.d.ts +0 -1
  11. package/esm/component/legendCategory.js +36 -49
  12. package/esm/component/legendCategory.js.map +1 -1
  13. package/esm/component/legendContinuous.js +29 -19
  14. package/esm/component/legendContinuous.js.map +1 -1
  15. package/esm/component/utils.d.ts +1 -0
  16. package/esm/component/utils.js +3 -0
  17. package/esm/component/utils.js.map +1 -1
  18. package/esm/composition/facetRect.js +2 -4
  19. package/esm/composition/facetRect.js.map +1 -1
  20. package/esm/composition/repeatMatrix.js +2 -2
  21. package/esm/composition/repeatMatrix.js.map +1 -1
  22. package/esm/interaction/action/service/legendItemSelection.js.map +1 -1
  23. package/esm/interaction/action/transformer/setItemState.js.map +1 -1
  24. package/esm/mark/cell.js +1 -1
  25. package/esm/shape/area/curve.js +2 -9
  26. package/esm/shape/area/curve.js.map +1 -1
  27. package/esm/shape/interval/color.js +2 -2
  28. package/esm/shape/interval/color.js.map +1 -1
  29. package/esm/shape/line/curve.js +23 -12
  30. package/esm/shape/line/curve.js.map +1 -1
  31. package/esm/shape/line/line.js +6 -2
  32. package/esm/shape/line/line.js.map +1 -1
  33. package/esm/shape/line/smooth.js +6 -2
  34. package/esm/shape/line/smooth.js.map +1 -1
  35. package/esm/shape/text/advance.js +2 -2
  36. package/esm/shape/text/advance.js.map +1 -1
  37. package/esm/shape/utils.d.ts +1 -0
  38. package/esm/shape/utils.js +8 -1
  39. package/esm/shape/utils.js.map +1 -1
  40. package/esm/spec/transform.d.ts +10 -2
  41. package/esm/stdlib/index.js +2 -2
  42. package/esm/stdlib/index.js.map +1 -1
  43. package/esm/theme/dark.js +78 -65
  44. package/esm/theme/dark.js.map +1 -1
  45. package/esm/theme/light.js +84 -74
  46. package/esm/theme/light.js.map +1 -1
  47. package/esm/transform/groupN.js +2 -0
  48. package/esm/transform/groupN.js.map +1 -1
  49. package/esm/transform/index.d.ts +8 -6
  50. package/esm/transform/index.js +4 -3
  51. package/esm/transform/index.js.map +1 -1
  52. package/esm/transform/sample.d.ts +8 -0
  53. package/esm/transform/sample.js +48 -0
  54. package/esm/transform/sample.js.map +1 -0
  55. package/esm/transform/{Select.d.ts → select.d.ts} +0 -0
  56. package/esm/transform/{Select.js → select.js} +1 -1
  57. package/esm/transform/{Select.js.map → select.js.map} +1 -1
  58. package/esm/transform/{SelectX.d.ts → selectX.d.ts} +0 -0
  59. package/esm/transform/{SelectX.js → selectX.js} +1 -1
  60. package/esm/transform/{SelectX.js.map → selectX.js.map} +1 -1
  61. package/esm/transform/{SelectY.d.ts → selectY.d.ts} +0 -0
  62. package/esm/transform/{SelectY.js → selectY.js} +1 -1
  63. package/esm/transform/{SelectY.js.map → selectY.js.map} +1 -1
  64. package/esm/transform/sort.d.ts +1 -1
  65. package/esm/transform/sort.js +39 -21
  66. package/esm/transform/sort.js.map +1 -1
  67. package/lib/animation/morphing.js +10 -8
  68. package/lib/animation/morphing.js.map +1 -1
  69. package/lib/api/chart.js +2 -5
  70. package/lib/api/chart.js.map +1 -1
  71. package/lib/component/axis.d.ts +1 -2
  72. package/lib/component/axis.js +80 -197
  73. package/lib/component/axis.js.map +1 -1
  74. package/lib/component/legendCategory.d.ts +0 -1
  75. package/lib/component/legendCategory.js +36 -49
  76. package/lib/component/legendCategory.js.map +1 -1
  77. package/lib/component/legendContinuous.js +29 -19
  78. package/lib/component/legendContinuous.js.map +1 -1
  79. package/lib/component/utils.d.ts +1 -0
  80. package/lib/component/utils.js +5 -1
  81. package/lib/component/utils.js.map +1 -1
  82. package/lib/composition/facetRect.js +2 -4
  83. package/lib/composition/facetRect.js.map +1 -1
  84. package/lib/composition/repeatMatrix.js +2 -2
  85. package/lib/composition/repeatMatrix.js.map +1 -1
  86. package/lib/interaction/action/service/legendItemSelection.js.map +1 -1
  87. package/lib/interaction/action/transformer/setItemState.js.map +1 -1
  88. package/lib/mark/cell.js +1 -1
  89. package/lib/shape/area/curve.js +2 -9
  90. package/lib/shape/area/curve.js.map +1 -1
  91. package/lib/shape/interval/color.js +2 -2
  92. package/lib/shape/interval/color.js.map +1 -1
  93. package/lib/shape/line/curve.js +21 -10
  94. package/lib/shape/line/curve.js.map +1 -1
  95. package/lib/shape/line/line.js +5 -1
  96. package/lib/shape/line/line.js.map +1 -1
  97. package/lib/shape/line/smooth.js +5 -1
  98. package/lib/shape/line/smooth.js.map +1 -1
  99. package/lib/shape/text/advance.js +2 -2
  100. package/lib/shape/text/advance.js.map +1 -1
  101. package/lib/shape/utils.d.ts +1 -0
  102. package/lib/shape/utils.js +9 -1
  103. package/lib/shape/utils.js.map +1 -1
  104. package/lib/spec/transform.d.ts +10 -2
  105. package/lib/stdlib/index.js +1 -1
  106. package/lib/stdlib/index.js.map +1 -1
  107. package/lib/theme/dark.js +78 -65
  108. package/lib/theme/dark.js.map +1 -1
  109. package/lib/theme/light.js +84 -74
  110. package/lib/theme/light.js.map +1 -1
  111. package/lib/transform/groupN.js +2 -0
  112. package/lib/transform/groupN.js.map +1 -1
  113. package/lib/transform/index.d.ts +8 -6
  114. package/lib/transform/index.js +9 -7
  115. package/lib/transform/index.js.map +1 -1
  116. package/lib/transform/sample.d.ts +8 -0
  117. package/lib/transform/sample.js +52 -0
  118. package/lib/transform/sample.js.map +1 -0
  119. package/lib/transform/{Select.d.ts → select.d.ts} +0 -0
  120. package/lib/transform/{Select.js → select.js} +1 -1
  121. package/lib/transform/{Select.js.map → select.js.map} +1 -1
  122. package/lib/transform/{SelectX.d.ts → selectX.d.ts} +0 -0
  123. package/lib/transform/{SelectX.js → selectX.js} +1 -1
  124. package/lib/transform/{SelectX.js.map → selectX.js.map} +1 -1
  125. package/lib/transform/{SelectY.d.ts → selectY.d.ts} +0 -0
  126. package/lib/transform/{SelectY.js → selectY.js} +1 -1
  127. package/lib/transform/{SelectY.js.map → selectY.js.map} +1 -1
  128. package/lib/transform/sort.d.ts +1 -1
  129. package/lib/transform/sort.js +38 -20
  130. package/lib/transform/sort.js.map +1 -1
  131. package/package.json +3 -3
  132. package/src/animation/morphing.ts +12 -8
  133. package/src/api/chart.ts +2 -5
  134. package/src/component/axis.ts +233 -310
  135. package/src/component/legendCategory.ts +52 -68
  136. package/src/component/legendContinuous.ts +24 -25
  137. package/src/component/utils.ts +4 -0
  138. package/src/composition/facetRect.ts +2 -4
  139. package/src/composition/repeatMatrix.ts +2 -2
  140. package/src/interaction/action/service/legendItemSelection.ts +1 -2
  141. package/src/interaction/action/transformer/setItemState.ts +2 -3
  142. package/src/mark/cell.ts +1 -1
  143. package/src/shape/area/curve.ts +7 -9
  144. package/src/shape/interval/color.ts +7 -7
  145. package/src/shape/line/curve.ts +27 -12
  146. package/src/shape/line/line.ts +6 -2
  147. package/src/shape/line/smooth.ts +11 -2
  148. package/src/shape/text/advance.ts +2 -2
  149. package/src/shape/utils.ts +8 -1
  150. package/src/spec/transform.ts +10 -1
  151. package/src/stdlib/index.ts +2 -0
  152. package/src/theme/dark.ts +78 -66
  153. package/src/theme/light.ts +84 -75
  154. package/src/transform/groupN.ts +2 -0
  155. package/src/transform/index.ts +8 -6
  156. package/src/transform/sample.ts +45 -0
  157. package/src/transform/sort.ts +53 -21
package/src/theme/dark.ts CHANGED
@@ -2,30 +2,14 @@ import { ThemeComponent as TC, Theme } from '../runtime';
2
2
 
3
3
  export type DarkOptions = Theme;
4
4
 
5
- const WHITE_COLORS = {
6
- 100: '#000',
7
- 95: '#0D0D0D',
8
- 85: '#262626',
9
- 65: '#595959',
10
- 45: '#8C8C8C',
11
- 25: '#BFBFBF',
12
- 15: '#D9D9D9',
13
- 6: '#F0F0F0',
14
- };
15
-
16
- const BLACK_COLORS = {
17
- 100: '#FFFFFF',
18
- 95: '#F2F2F2',
19
- 85: '#D9D9D9',
20
- 65: '#A6A6A6',
21
- 45: '#737373',
22
- 25: '#404040',
23
- 15: '#262626',
24
- 6: '#0F0F0F',
5
+ const COLORS = {
6
+ BLACK: '#fff',
7
+ WHITE: '#000',
8
+ STROKE: '#416180',
25
9
  };
26
10
 
27
11
  const BACKGROUND_COLOR = '#141414';
28
- const STROKE_COLOR = '#F9FBFD';
12
+ const STROKE_COLOR = '#416180';
29
13
 
30
14
  /**
31
15
  * Dark theme.
@@ -37,12 +21,22 @@ export const Dark: TC<DarkOptions> = (options) => {
37
21
  defaultCategory10: 'category10',
38
22
  defaultCategory20: 'category20',
39
23
  defaultSize: 1,
40
- elementActiveStroke: BLACK_COLORS[100],
24
+ elementActiveStroke: COLORS.BLACK,
41
25
  enter: {
42
26
  duration: 300,
43
27
  fill: 'both',
44
28
  delay: 0,
45
29
  },
30
+ update: {
31
+ duration: 300,
32
+ fill: 'both',
33
+ delay: 0,
34
+ },
35
+ exit: {
36
+ duration: 300,
37
+ fill: 'both',
38
+ delay: 0,
39
+ },
46
40
  // --- Theme of area style
47
41
  viewFill: BACKGROUND_COLOR,
48
42
  plotFill: 'transparent',
@@ -54,6 +48,7 @@ export const Dark: TC<DarkOptions> = (options) => {
54
48
  fill: '',
55
49
  strokeOpacity: 1,
56
50
  lineWidth: 1,
51
+ connectStroke: '#666',
57
52
  },
58
53
  },
59
54
  point: {
@@ -95,6 +90,8 @@ export const Dark: TC<DarkOptions> = (options) => {
95
90
  area: {
96
91
  fillOpacity: 0.85,
97
92
  lineWidth: 0,
93
+ connectFill: COLORS.BLACK,
94
+ connectFillOpacity: 0.1,
98
95
  },
99
96
  },
100
97
  polygon: {
@@ -103,6 +100,16 @@ export const Dark: TC<DarkOptions> = (options) => {
103
100
  },
104
101
  },
105
102
  cell: {
103
+ cell: {
104
+ fillOpacity: 0.95,
105
+ },
106
+ hollow: {
107
+ fill: '',
108
+ strokeOpacity: 1,
109
+ lineWidth: 2,
110
+ },
111
+ },
112
+ rect: {
106
113
  rect: {
107
114
  fillOpacity: 0.95,
108
115
  },
@@ -132,8 +139,10 @@ export const Dark: TC<DarkOptions> = (options) => {
132
139
  },
133
140
  text: {
134
141
  text: {
135
- fill: BLACK_COLORS[65],
142
+ fill: COLORS.BLACK,
143
+ fillOpacity: 0.65,
136
144
  fontSize: 12,
145
+ strokeWidth: 0,
137
146
  connectorStroke: STROKE_COLOR,
138
147
  connectorStrokeOpacity: 0.45,
139
148
  connectorLineWidth: 1,
@@ -203,7 +212,7 @@ export const Dark: TC<DarkOptions> = (options) => {
203
212
  line: { lineWidth: 3 },
204
213
  },
205
214
  interval: {
206
- rect: { stroke: BLACK_COLORS[100] },
215
+ rect: { stroke: COLORS.BLACK },
207
216
  },
208
217
  area: {
209
218
  area: { fillOpacity: 0.5 },
@@ -219,93 +228,96 @@ export const Dark: TC<DarkOptions> = (options) => {
219
228
  },
220
229
  axis: {
221
230
  // axis title
222
- titleFill: BLACK_COLORS[65],
223
- titleFillOpacity: 1,
231
+ titleFill: COLORS.BLACK,
232
+ titleFillOpacity: 0.65,
224
233
  titleFontSize: 12,
225
234
  titleFontWeight: 'normal',
226
235
  titleSpacing: 12,
227
236
  // axis line
228
- lineStroke: BLACK_COLORS[25],
237
+ lineStroke: COLORS.BLACK,
229
238
  lineStrokeOpacity: 0.45,
230
239
  lineLineWidth: 0.5,
231
- // axis tickLine
232
- tickLineStroke: BLACK_COLORS[25],
233
- tickLineLineWidth: 1,
234
- tickLineLength: 4,
240
+ // axis tick line
241
+ tickStroke: COLORS.BLACK,
242
+ tickStrokeOpacity: 0.25,
243
+ tickLineWidth: 1,
244
+ tickLength: 4,
235
245
  // axis label
236
- labelFill: BLACK_COLORS[45],
237
- labelFillOpacity: 1,
246
+ labelFill: COLORS.BLACK,
247
+ labelFillOpacity: 0.65,
238
248
  labelFontSize: 12,
239
249
  labelFontWeight: 'lighter',
240
250
  labelSpacing: 8, // spacing between label and it's tick
241
251
  // axis grid
242
- gridStroke: BLACK_COLORS[15],
243
- gridStrokeOpacity: 1,
252
+ gridStroke: COLORS.BLACK,
253
+ gridStrokeOpacity: 0.05,
244
254
  gridLineWidth: 0.5,
245
255
  gridLineDash: [0, 0],
246
256
  },
247
257
  legend: {
248
258
  padding: 8,
249
- // legend title
250
259
  showTitle: false,
251
- titleFill: BLACK_COLORS[45],
260
+ titleFill: COLORS.BLACK,
261
+ titleFillOpacity: 0.45,
252
262
  titleFontSize: 12,
253
- titleLineHeight: 21,
254
263
  titleFontWeight: 'normal',
255
264
  titleSpacing: 4,
256
265
  // legend marker
257
- markerFill: DEFAULT_COLOR,
258
- markerSpacing: 8,
259
- markerSize: 4,
260
- // [todo] rename itemLabel to itemName
261
- itemLabelFill: BLACK_COLORS[65],
262
- itemLabelFillOpacity: 1,
266
+ itemMarkerFill: DEFAULT_COLOR,
267
+ itemMarkerFillOpacity: 1,
268
+ itemMarkerSize: 8,
269
+ itemSpacing: [5, 8],
270
+ itemLabelFill: COLORS.BLACK,
271
+ itemLabelFillOpacity: 0.65,
263
272
  itemLabelFontSize: 12,
264
273
  itemLabelFontWeight: 'normal',
265
- itemValueFill: BLACK_COLORS[65],
266
- itemValueFillOpacity: 0.85,
274
+ itemValueFill: COLORS.BLACK,
275
+ itemValueFillOpacity: 0.65,
267
276
  itemValueFontSize: 12,
268
277
  itemValueFontWeight: 'normal',
269
278
  itemBackgroundFill: 'transparent',
270
- // [todo] rename legend navigator
271
- navButtonFill: BLACK_COLORS[100],
272
- navButtonFillOpacity: 1,
273
- navPageNumFill: BLACK_COLORS[45],
279
+ // [todo] support navButtonSize
280
+ navButtonFill: COLORS.BLACK,
281
+ navButtonFillOpacity: 0.45,
282
+ navPageNumFill: COLORS.BLACK,
283
+ navPageNumFillOpacity: 0.45,
274
284
  navPageNumFontSize: 12,
275
285
  // others
276
286
  backgroundFill: 'transparent',
277
287
  },
278
288
  continuousLegend: {
279
- labelFill: BLACK_COLORS[45],
289
+ labelFill: COLORS.BLACK,
290
+ labelFillOpacity: 0.45,
280
291
  labelFontSize: 12,
281
- labelLineHeight: 12,
282
292
  labelFontWeight: 'normal',
283
293
  handleWidth: 10,
284
294
  handleHeight: 12,
285
- handleMarkerFill: BLACK_COLORS[6],
286
- handleMarkerStroke: BLACK_COLORS[25],
295
+ handleMarkerFill: COLORS.BLACK,
296
+ handleMarkerFillOpacity: 0.6,
297
+ handleMarkerStroke: COLORS.BLACK,
298
+ handleMarkerStrokeOpacity: 0.25,
287
299
  handleMarkerLineWidth: 1,
288
- handleLabelFill: BLACK_COLORS[45],
300
+ handleLabelFill: COLORS.BLACK,
301
+ handleLabelFillOpacity: 0.45,
289
302
  handleLabelFontSize: 12,
290
- handleLabelLineHeight: 12,
291
303
  handleLabelFontWeight: 'normal',
292
304
  // [todo] legend rail
293
305
  },
294
306
  label: {
295
- fill: BLACK_COLORS[100],
307
+ fill: COLORS.BLACK,
296
308
  fillOpacity: 0.65,
297
309
  fontSize: 12,
298
310
  fontWeight: 'normal',
299
311
  stroke: null,
300
312
  offset: 12,
301
- connectorStroke: STROKE_COLOR,
313
+ connectorStroke: COLORS.BLACK,
302
314
  connectorStrokeOpacity: 0.45,
303
315
  connectorLineWidth: 1,
304
316
  connectorLength2: 8,
305
317
  connectorDistance: 4,
306
318
  },
307
319
  innerLabel: {
308
- fill: WHITE_COLORS[100],
320
+ fill: COLORS.WHITE,
309
321
  fontSize: 12,
310
322
  fillOpacity: 0.85,
311
323
  fontWeight: 'normal',
@@ -322,26 +334,26 @@ export const Dark: TC<DarkOptions> = (options) => {
322
334
  handleWidth: 10,
323
335
  handleFill: '#f7f7f7',
324
336
  handleFillOpacity: 1,
325
- handleStroke: BLACK_COLORS[25],
326
- handleStrokeOpacity: 1,
337
+ handleStroke: COLORS.BLACK,
338
+ handleStrokeOpacity: 0.25,
327
339
  handleLineWidth: 1,
328
340
  handleRadius: 2,
329
- textFill: BLACK_COLORS[100],
341
+ textFill: COLORS.BLACK,
330
342
  textFillOpacity: 0.45,
331
343
  textFontSize: 12,
332
344
  textFontWeight: 'normal',
333
345
  },
334
346
  scrollbar: {},
335
347
  title: {
336
- fill: BLACK_COLORS[85],
337
- fillOpacity: 1,
348
+ fill: COLORS.BLACK,
349
+ fillOpacity: 0.85,
338
350
  fontSize: 24,
339
351
  fontWeight: 'bold',
340
352
  textBaseline: 'top',
341
353
  },
342
354
  subtitle: {
343
- fill: BLACK_COLORS[65],
344
- fillOpacity: 1,
355
+ fill: COLORS.BLACK,
356
+ fillOpacity: 0.65,
345
357
  fontSize: 10,
346
358
  fontWeight: 'normal',
347
359
  textBaseline: 'top',
@@ -2,30 +2,13 @@ import { ThemeComponent as TC, Theme } from '../runtime';
2
2
 
3
3
  export type LightOptions = Theme;
4
4
 
5
- const BLACK_COLORS = {
6
- 100: '#000',
7
- 95: '#0D0D0D',
8
- 85: '#262626',
9
- 65: '#595959',
10
- 45: '#8C8C8C',
11
- 25: '#BFBFBF',
12
- 15: '#D9D9D9',
13
- 6: '#F0F0F0',
14
- };
15
-
16
- const WHITE_COLORS = {
17
- 100: '#FFFFFF',
18
- 95: '#F2F2F2',
19
- 85: '#D9D9D9',
20
- 65: '#A6A6A6',
21
- 45: '#737373',
22
- 25: '#404040',
23
- 15: '#262626',
24
- 6: '#0F0F0F',
5
+ const COLORS = {
6
+ BLACK: '#000',
7
+ WHITE: '#fff',
8
+ STROKE: '#416180',
25
9
  };
26
10
 
27
11
  const BACKGROUND_COLOR = 'transparent';
28
- const STROKE_COLOR = '#416180';
29
12
 
30
13
  /**
31
14
  * Default theme.
@@ -37,12 +20,22 @@ export const Light: TC<LightOptions> = (options) => {
37
20
  defaultCategory10: 'category10',
38
21
  defaultCategory20: 'category20',
39
22
  defaultSize: 1,
40
- elementActiveStroke: BLACK_COLORS[100],
23
+ elementActiveStroke: COLORS.BLACK,
41
24
  enter: {
42
25
  duration: 300,
43
26
  fill: 'both',
44
27
  delay: 0,
45
28
  },
29
+ update: {
30
+ duration: 300,
31
+ fill: 'both',
32
+ delay: 0,
33
+ },
34
+ exit: {
35
+ duration: 300,
36
+ fill: 'both',
37
+ delay: 0,
38
+ },
46
39
  // --- Theme of area style
47
40
  viewFill: BACKGROUND_COLOR,
48
41
  plotFill: 'transparent',
@@ -54,6 +47,7 @@ export const Light: TC<LightOptions> = (options) => {
54
47
  fill: '',
55
48
  strokeOpacity: 1,
56
49
  lineWidth: 1,
50
+ connectStroke: '#aaa',
57
51
  },
58
52
  },
59
53
  point: {
@@ -95,6 +89,8 @@ export const Light: TC<LightOptions> = (options) => {
95
89
  area: {
96
90
  fillOpacity: 0.85,
97
91
  lineWidth: 0,
92
+ connectFill: COLORS.BLACK,
93
+ connectFillOpacity: 0.1,
98
94
  },
99
95
  },
100
96
  polygon: {
@@ -103,6 +99,16 @@ export const Light: TC<LightOptions> = (options) => {
103
99
  },
104
100
  },
105
101
  cell: {
102
+ cell: {
103
+ fillOpacity: 0.95,
104
+ },
105
+ hollow: {
106
+ fill: '',
107
+ strokeOpacity: 1,
108
+ lineWidth: 2,
109
+ },
110
+ },
111
+ rect: {
106
112
  rect: {
107
113
  fillOpacity: 0.95,
108
114
  },
@@ -132,14 +138,14 @@ export const Light: TC<LightOptions> = (options) => {
132
138
  },
133
139
  text: {
134
140
  text: {
135
- // fill: BLACK_COLORS[65],
141
+ // fill: COLORS.BLACK,fillOpacity: 0.65,
136
142
  fill: '#1D2129',
137
143
  fontSize: 12,
138
144
  strokeWidth: 0,
139
- connectorStroke: STROKE_COLOR,
145
+ connectorStroke: COLORS.STROKE,
140
146
  connectorStrokeOpacity: 0.45,
141
147
  connectorLineWidth: 1,
142
- backgroundFill: STROKE_COLOR,
148
+ backgroundFill: COLORS.STROKE,
143
149
  backgroundFillOpacity: 0.15,
144
150
  backgroundPadding: [2, 4],
145
151
  startMarkerSymbol: 'circle',
@@ -154,48 +160,48 @@ export const Light: TC<LightOptions> = (options) => {
154
160
  fontSize: 10,
155
161
  textAlign: 'center',
156
162
  textBaseline: 'middle',
157
- markerFill: STROKE_COLOR,
163
+ markerFill: COLORS.STROKE,
158
164
  markerFillOpacity: 0.25,
159
165
  markerStrokeOpacity: 0,
160
166
  },
161
167
  },
162
168
  lineX: {
163
169
  line: {
164
- stroke: STROKE_COLOR,
170
+ stroke: COLORS.STROKE,
165
171
  strokeOpacity: 0.45,
166
172
  lineWidth: 1,
167
173
  },
168
174
  },
169
175
  lineY: {
170
176
  line: {
171
- stroke: STROKE_COLOR,
177
+ stroke: COLORS.STROKE,
172
178
  strokeOpacity: 0.45,
173
179
  lineWidth: 1,
174
180
  },
175
181
  },
176
182
  rangeX: {
177
183
  range: {
178
- fill: STROKE_COLOR,
184
+ fill: COLORS.STROKE,
179
185
  fillOpacity: 0.15,
180
186
  lineWidth: 0,
181
187
  },
182
188
  },
183
189
  rangeY: {
184
190
  range: {
185
- fill: STROKE_COLOR,
191
+ fill: COLORS.STROKE,
186
192
  fillOpacity: 0.15,
187
193
  lineWidth: 0,
188
194
  },
189
195
  },
190
196
  connector: {
191
197
  connector: {
192
- stroke: STROKE_COLOR,
198
+ stroke: COLORS.STROKE,
193
199
  strokeOpacity: 0.45,
194
200
  lineWidth: 1,
195
201
  connectLength1: 12,
196
202
  endMarker: true,
197
203
  endMarkerSize: 6,
198
- endMarkerFill: STROKE_COLOR,
204
+ endMarkerFill: COLORS.STROKE,
199
205
  endMarkerFillOpacity: 0.95,
200
206
  },
201
207
  },
@@ -205,7 +211,7 @@ export const Light: TC<LightOptions> = (options) => {
205
211
  line: { lineWidth: 3 },
206
212
  },
207
213
  interval: {
208
- rect: { stroke: BLACK_COLORS[100] },
214
+ rect: { stroke: COLORS.BLACK },
209
215
  },
210
216
  area: {
211
217
  area: { fillOpacity: 0.5 },
@@ -221,93 +227,96 @@ export const Light: TC<LightOptions> = (options) => {
221
227
  },
222
228
  axis: {
223
229
  // axis title
224
- titleFill: BLACK_COLORS[65],
225
- titleFillOpacity: 1,
230
+ titleFill: COLORS.BLACK,
231
+ titleFillOpacity: 0.65,
226
232
  titleFontSize: 12,
227
233
  titleFontWeight: 'normal',
228
234
  titleSpacing: 12,
229
235
  // axis line
230
- lineStroke: BLACK_COLORS[25],
236
+ lineStroke: COLORS.BLACK,
231
237
  lineStrokeOpacity: 0.45,
232
238
  lineLineWidth: 0.5,
233
- // axis tickLine
234
- tickLineStroke: BLACK_COLORS[25],
235
- tickLineLineWidth: 1,
236
- tickLineLength: 4,
239
+ // axis tick line
240
+ tickStroke: COLORS.BLACK,
241
+ tickStrokeOpacity: 0.25,
242
+ tickLineWidth: 1,
243
+ tickLength: 4,
237
244
  // axis label
238
- labelFill: BLACK_COLORS[45],
239
- labelFillOpacity: 1,
245
+ labelFill: COLORS.BLACK,
246
+ labelFillOpacity: 0.65,
240
247
  labelFontSize: 12,
241
248
  labelFontWeight: 'lighter',
242
249
  labelSpacing: 8, // spacing between label and it's tick
243
250
  // axis grid
244
- gridStroke: BLACK_COLORS[15],
245
- gridStrokeOpacity: 1,
251
+ gridStroke: COLORS.BLACK,
252
+ gridStrokeOpacity: 0.05,
246
253
  gridLineWidth: 0.5,
247
254
  gridLineDash: [0, 0],
248
255
  },
249
256
  legend: {
250
257
  padding: 8,
251
- // legend title
252
258
  showTitle: false,
253
- titleFill: BLACK_COLORS[45],
259
+ titleFill: COLORS.BLACK,
260
+ titleFillOpacity: 0.45,
254
261
  titleFontSize: 12,
255
- titleLineHeight: 21,
256
262
  titleFontWeight: 'normal',
257
263
  titleSpacing: 4,
258
264
  // legend marker
259
- markerFill: DEFAULT_COLOR,
260
- markerSpacing: 8,
261
- markerSize: 4,
262
- // [todo] rename itemLabel to itemName
263
- itemLabelFill: BLACK_COLORS[65],
264
- itemLabelFillOpacity: 1,
265
+ itemMarkerFill: DEFAULT_COLOR,
266
+ itemMarkerFillOpacity: 1,
267
+ itemMarkerSize: 8,
268
+ itemSpacing: [5, 8],
269
+ itemLabelFill: COLORS.BLACK,
270
+ itemLabelFillOpacity: 0.65,
265
271
  itemLabelFontSize: 12,
266
272
  itemLabelFontWeight: 'normal',
267
- itemValueFill: BLACK_COLORS[65],
268
- itemValueFillOpacity: 0.85,
273
+ itemValueFill: COLORS.BLACK,
274
+ itemValueFillOpacity: 0.65,
269
275
  itemValueFontSize: 12,
270
276
  itemValueFontWeight: 'normal',
271
277
  itemBackgroundFill: 'transparent',
272
278
  // [todo] rename legend navigator
273
- navButtonFill: BLACK_COLORS[100],
274
- navButtonFillOpacity: 1,
275
- navPageNumFill: BLACK_COLORS[45],
279
+ navButtonFill: COLORS.BLACK,
280
+ navButtonFillOpacity: 0.45,
281
+ navPageNumFill: COLORS.BLACK,
282
+ navPageNumFillOpacity: 0.45,
276
283
  navPageNumFontSize: 12,
277
284
  // others
278
285
  backgroundFill: 'transparent',
279
286
  },
280
287
  continuousLegend: {
281
- labelFill: BLACK_COLORS[45],
288
+ labelFill: COLORS.BLACK,
289
+ labelFillOpacity: 0.45,
282
290
  labelFontSize: 12,
283
- labelLineHeight: 12,
284
291
  labelFontWeight: 'normal',
285
292
  handleWidth: 10,
286
293
  handleHeight: 12,
287
- handleMarkerFill: BLACK_COLORS[6],
288
- handleMarkerStroke: BLACK_COLORS[25],
294
+ handleMarkerFill: COLORS.BLACK,
295
+ handleMarkerFillOpacity: 0.6,
296
+ handleMarkerStroke: COLORS.BLACK,
297
+ handleMarkerStrokeOpacity: 0.25,
289
298
  handleMarkerLineWidth: 1,
290
- handleLabelFill: BLACK_COLORS[45],
299
+ handleLabelFill: COLORS.BLACK,
300
+ handleLabelFillOpacity: 0.45,
291
301
  handleLabelFontSize: 12,
292
- handleLabelLineHeight: 12,
293
302
  handleLabelFontWeight: 'normal',
294
303
  // [todo] legend rail
295
304
  },
296
305
  label: {
297
- fill: BLACK_COLORS[100],
306
+ fill: COLORS.BLACK,
298
307
  fillOpacity: 0.65,
299
308
  fontSize: 12,
300
309
  fontWeight: 'normal',
301
310
  stroke: null,
302
311
  offset: 12,
303
- connectorStroke: STROKE_COLOR,
312
+ connectorStroke: COLORS.BLACK,
304
313
  connectorStrokeOpacity: 0.45,
305
314
  connectorLineWidth: 1,
306
315
  connectorLength2: 8,
307
316
  connectorDistance: 4,
308
317
  },
309
318
  innerLabel: {
310
- fill: WHITE_COLORS[100],
319
+ fill: COLORS.WHITE,
311
320
  fontSize: 12,
312
321
  fillOpacity: 0.85,
313
322
  fontWeight: 'normal',
@@ -316,7 +325,7 @@ export const Light: TC<LightOptions> = (options) => {
316
325
  },
317
326
  slider: {
318
327
  railHeight: 16,
319
- railFill: STROKE_COLOR,
328
+ railFill: COLORS.STROKE,
320
329
  railFillOpacity: 0.05,
321
330
  railForegroundFill: DEFAULT_COLOR,
322
331
  railForegroundFillOpacity: 0.15,
@@ -324,26 +333,26 @@ export const Light: TC<LightOptions> = (options) => {
324
333
  handleWidth: 10,
325
334
  handleFill: '#f7f7f7',
326
335
  handleFillOpacity: 1,
327
- handleStroke: BLACK_COLORS[25],
328
- handleStrokeOpacity: 1,
336
+ handleStroke: COLORS.BLACK,
337
+ handleStrokeOpacity: 0.25,
329
338
  handleLineWidth: 1,
330
339
  handleRadius: 2,
331
- textFill: BLACK_COLORS[100],
340
+ textFill: COLORS.BLACK,
332
341
  textFillOpacity: 0.45,
333
342
  textFontSize: 12,
334
343
  textFontWeight: 'normal',
335
344
  },
336
345
  scrollbar: {},
337
346
  title: {
338
- fill: BLACK_COLORS[85],
339
- fillOpacity: 1,
347
+ fill: COLORS.BLACK,
348
+ fillOpacity: 0.85,
340
349
  fontSize: 24,
341
350
  fontWeight: 'bold',
342
351
  textBaseline: 'top',
343
352
  },
344
353
  subtitle: {
345
- fill: BLACK_COLORS[65],
346
- fillOpacity: 1,
354
+ fill: COLORS.BLACK,
355
+ fillOpacity: 0.65,
347
356
  fontSize: 10,
348
357
  fontWeight: 'normal',
349
358
  textBaseline: 'top',
@@ -94,6 +94,8 @@ export const GroupN: TC<GroupNOptions> = (options = {}) => {
94
94
  return (I, mark) => {
95
95
  const { data, encode } = mark;
96
96
  const groups = groupBy(I, mark);
97
+ if (!groups) return [I, mark];
98
+
97
99
  const outputs = Object.entries(rest).map(([channel, reducer]) => {
98
100
  const [reducerFunction, formatter] = normalizeReducer(reducer);
99
101
  const [V, field] = columnOf(encode, channel);
@@ -24,9 +24,9 @@ export { Jitter } from './jitter';
24
24
  export { JitterX } from './jitterX';
25
25
  export { SymmetryY } from './symmetryY';
26
26
  export { DiffY } from './diffY';
27
- export { Select } from './Select';
28
- export { SelectX } from './SelectX';
29
- export { SelectY } from './SelectY';
27
+ export { Select } from './select';
28
+ export { SelectX } from './selectX';
29
+ export { SelectY } from './selectY';
30
30
  export { GroupX } from './groupX';
31
31
  export { GroupY } from './groupY';
32
32
  export { Group } from './group';
@@ -38,6 +38,7 @@ export { FlexX } from './flexX';
38
38
  export { Pack } from './pack';
39
39
  export { BinX } from './binX';
40
40
  export { Bin } from './bin';
41
+ export { Sample } from './sample';
41
42
 
42
43
  export type { MaybeZeroY1Options } from './maybeZeroY1';
43
44
  export type { MaybeStackYOptions } from './maybeStackY';
@@ -65,9 +66,9 @@ export type { JitterOptions } from './jitter';
65
66
  export type { JitterXOptions } from './jitterX';
66
67
  export type { SymmetryYOptions } from './symmetryY';
67
68
  export type { DiffYOptions } from './diffY';
68
- export type { SelectOptions } from './Select';
69
- export type { SelectXOptions } from './SelectX';
70
- export type { SelectYOptions } from './SelectY';
69
+ export type { SelectOptions } from './select';
70
+ export type { SelectXOptions } from './selectX';
71
+ export type { SelectYOptions } from './selectY';
71
72
  export type { GroupXOptions } from './groupX';
72
73
  export type { GroupYOptions } from './groupY';
73
74
  export type { GroupOptions } from './group';
@@ -79,3 +80,4 @@ export type { FlexXOptions } from './flexX';
79
80
  export type { PackOptions } from './pack';
80
81
  export type { BinXOptions } from './binX';
81
82
  export type { BinOptions } from './bin';
83
+ export type { SampleOptions } from './sample';