@orbcharts/plugins-basic 3.0.0-alpha.43 → 3.0.0-alpha.45

Sign up to get free protection for your applications and to get access to all the features.
Files changed (130) hide show
  1. package/dist/{src → orbcharts-plugins-basic/src}/base/BaseBarStack.d.ts +6 -4
  2. package/dist/{src → orbcharts-plugins-basic/src}/base/BaseBars.d.ts +6 -4
  3. package/dist/{src → orbcharts-plugins-basic/src}/base/BaseBarsTriangle.d.ts +7 -4
  4. package/dist/{src → orbcharts-plugins-basic/src}/base/BaseDots.d.ts +5 -3
  5. package/dist/{src → orbcharts-plugins-basic/src}/base/BaseGroupAxis.d.ts +3 -3
  6. package/dist/{src → orbcharts-plugins-basic/src}/base/BaseLegend.d.ts +1 -0
  7. package/dist/{src → orbcharts-plugins-basic/src}/base/BaseLineAreas.d.ts +6 -3
  8. package/dist/{src → orbcharts-plugins-basic/src}/base/BaseLines.d.ts +6 -3
  9. package/dist/{src → orbcharts-plugins-basic/src}/base/BaseValueAxis.d.ts +3 -3
  10. package/dist/{src → orbcharts-plugins-basic/src}/grid/gridObservables.d.ts +4 -4
  11. package/dist/orbcharts-plugins-basic/src/index.d.ts +5 -0
  12. package/dist/orbcharts-plugins-basic/src/multiGrid/multiGridObservables.d.ts +8 -0
  13. package/dist/orbcharts-plugins-basic/src/series/plugins/PieEventTexts.d.ts +3 -0
  14. package/dist/orbcharts-plugins-basic/src/series/seriesObservables.d.ts +21 -0
  15. package/dist/{src → orbcharts-plugins-basic/src}/series/seriesUtils.d.ts +3 -3
  16. package/dist/orbcharts-plugins-basic.es.js +8349 -8142
  17. package/dist/orbcharts-plugins-basic.umd.js +8 -8
  18. package/dist/src/index.d.ts +1 -5
  19. package/package.json +2 -2
  20. package/src/base/BaseBarStack.ts +105 -208
  21. package/src/base/BaseBars.ts +78 -64
  22. package/src/base/BaseBarsTriangle.ts +76 -63
  23. package/src/base/BaseDots.ts +41 -178
  24. package/src/base/BaseGroupAxis.ts +16 -16
  25. package/src/base/BaseLegend.ts +18 -13
  26. package/src/base/BaseLineAreas.ts +85 -81
  27. package/src/base/BaseLines.ts +82 -75
  28. package/src/base/BaseValueAxis.ts +17 -18
  29. package/src/grid/gridObservables.ts +22 -38
  30. package/src/grid/plugins/BarStack.ts +16 -3
  31. package/src/grid/plugins/Bars.ts +18 -4
  32. package/src/grid/plugins/BarsDiverging.ts +6 -4
  33. package/src/grid/plugins/BarsTriangle.ts +20 -4
  34. package/src/grid/plugins/Dots.ts +4 -2
  35. package/src/grid/plugins/GridLegend.ts +2 -1
  36. package/src/grid/plugins/GroupAux.ts +8 -6
  37. package/src/grid/plugins/GroupAxis.ts +15 -3
  38. package/src/grid/plugins/LineAreas.ts +5 -2
  39. package/src/grid/plugins/Lines.ts +5 -2
  40. package/src/grid/plugins/ScalingArea.ts +0 -1
  41. package/src/grid/plugins/ValueAxis.ts +15 -3
  42. package/src/grid/plugins/ValueStackAxis.ts +14 -5
  43. package/src/multiGrid/multiGridObservables.ts +14 -261
  44. package/src/multiGrid/plugins/MultiBarStack.ts +22 -8
  45. package/src/multiGrid/plugins/MultiBars.ts +21 -7
  46. package/src/multiGrid/plugins/MultiBarsTriangle.ts +22 -7
  47. package/src/multiGrid/plugins/MultiDots.ts +7 -5
  48. package/src/multiGrid/plugins/MultiGridLegend.ts +3 -2
  49. package/src/multiGrid/plugins/MultiGroupAxis.ts +19 -7
  50. package/src/multiGrid/plugins/MultiLineAreas.ts +9 -6
  51. package/src/multiGrid/plugins/MultiLines.ts +9 -6
  52. package/src/multiGrid/plugins/MultiValueAxis.ts +19 -7
  53. package/src/multiGrid/plugins/OverlappingValueAxes.ts +52 -47
  54. package/src/noneData/defaults.ts +3 -0
  55. package/src/noneData/plugins/Tooltip.ts +9 -3
  56. package/src/series/defaults.ts +13 -3
  57. package/src/series/plugins/Bubbles.ts +57 -37
  58. package/src/series/plugins/Pie.ts +300 -352
  59. package/src/series/plugins/PieEventTexts.ts +102 -38
  60. package/src/series/plugins/PieLabels.ts +95 -48
  61. package/src/series/plugins/SeriesLegend.ts +2 -1
  62. package/src/series/seriesObservables.ts +145 -0
  63. package/src/series/seriesUtils.ts +4 -4
  64. package/src/tree/plugins/TreeLegend.ts +2 -1
  65. package/src/tree/plugins/TreeMap.ts +8 -5
  66. package/tsconfig.json +3 -0
  67. package/dist/src/multiGrid/multiGridObservables.d.ts +0 -12
  68. package/dist/src/series/plugins/PieEventTexts.d.ts +0 -1
  69. /package/dist/{src → orbcharts-plugins-basic/src}/base/BaseGroupArea.d.ts +0 -0
  70. /package/dist/{src → orbcharts-plugins-basic/src}/base/types.d.ts +0 -0
  71. /package/dist/{src → orbcharts-plugins-basic/src}/grid/defaults.d.ts +0 -0
  72. /package/dist/{src → orbcharts-plugins-basic/src}/grid/index.d.ts +0 -0
  73. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/BarStack.d.ts +0 -0
  74. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/Bars.d.ts +0 -0
  75. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/BarsDiverging.d.ts +0 -0
  76. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/BarsTriangle.d.ts +0 -0
  77. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/Dots.d.ts +0 -0
  78. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/GridLegend.d.ts +0 -0
  79. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/GroupAux.d.ts +0 -0
  80. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/GroupAxis.d.ts +0 -0
  81. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/LineAreas.d.ts +0 -0
  82. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/Lines.d.ts +0 -0
  83. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/Ranking.d.ts +0 -0
  84. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/RankingAxis.d.ts +0 -0
  85. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/ScalingArea.d.ts +0 -0
  86. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/ValueAxis.d.ts +0 -0
  87. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/ValueStackAxis.d.ts +0 -0
  88. /package/dist/{src → orbcharts-plugins-basic/src}/grid/types.d.ts +0 -0
  89. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/defaults.d.ts +0 -0
  90. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/index.d.ts +0 -0
  91. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiBarStack.d.ts +0 -0
  92. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiBars.d.ts +0 -0
  93. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiBarsTriangle.d.ts +0 -0
  94. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiDots.d.ts +0 -0
  95. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiGridLegend.d.ts +0 -0
  96. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiGroupAxis.d.ts +0 -0
  97. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiLineAreas.d.ts +0 -0
  98. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiLines.d.ts +0 -0
  99. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiValueAxis.d.ts +0 -0
  100. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/OverlappingValueAxes.d.ts +0 -0
  101. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/types.d.ts +0 -0
  102. /package/dist/{src → orbcharts-plugins-basic/src}/multiValue/index.d.ts +0 -0
  103. /package/dist/{src → orbcharts-plugins-basic/src}/multiValue/plugins/Scatter.d.ts +0 -0
  104. /package/dist/{src → orbcharts-plugins-basic/src}/multiValue/plugins/ScatterAxes.d.ts +0 -0
  105. /package/dist/{src → orbcharts-plugins-basic/src}/noneData/defaults.d.ts +0 -0
  106. /package/dist/{src → orbcharts-plugins-basic/src}/noneData/index.d.ts +0 -0
  107. /package/dist/{src → orbcharts-plugins-basic/src}/noneData/plugins/Container.d.ts +0 -0
  108. /package/dist/{src → orbcharts-plugins-basic/src}/noneData/plugins/Tooltip.d.ts +0 -0
  109. /package/dist/{src → orbcharts-plugins-basic/src}/noneData/types.d.ts +0 -0
  110. /package/dist/{src → orbcharts-plugins-basic/src}/relationship/index.d.ts +0 -0
  111. /package/dist/{src → orbcharts-plugins-basic/src}/relationship/plugins/Relationship.d.ts +0 -0
  112. /package/dist/{src → orbcharts-plugins-basic/src}/series/defaults.d.ts +0 -0
  113. /package/dist/{src → orbcharts-plugins-basic/src}/series/index.d.ts +0 -0
  114. /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/Bubbles.d.ts +0 -0
  115. /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/Pie.d.ts +0 -0
  116. /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/PieLabels.d.ts +0 -0
  117. /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/SeriesLegend.d.ts +0 -0
  118. /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/Waffle.d.ts +0 -0
  119. /package/dist/{src → orbcharts-plugins-basic/src}/series/types.d.ts +0 -0
  120. /package/dist/{src → orbcharts-plugins-basic/src}/tree/defaults.d.ts +0 -0
  121. /package/dist/{src → orbcharts-plugins-basic/src}/tree/index.d.ts +0 -0
  122. /package/dist/{src → orbcharts-plugins-basic/src}/tree/plugins/TreeLegend.d.ts +0 -0
  123. /package/dist/{src → orbcharts-plugins-basic/src}/tree/plugins/TreeMap.d.ts +0 -0
  124. /package/dist/{src → orbcharts-plugins-basic/src}/tree/types.d.ts +0 -0
  125. /package/dist/{src → orbcharts-plugins-basic/src}/utils/commonUtils.d.ts +0 -0
  126. /package/dist/{src → orbcharts-plugins-basic/src}/utils/d3Graphics.d.ts +0 -0
  127. /package/dist/{src → orbcharts-plugins-basic/src}/utils/d3Utils.d.ts +0 -0
  128. /package/dist/{src → orbcharts-plugins-basic/src}/utils/observables.d.ts +0 -0
  129. /package/dist/{src → orbcharts-plugins-basic/src}/utils/orbchartsUtils.d.ts +0 -0
  130. /package/dist/{vite.config.d.ts → orbcharts-plugins-basic/vite.config.d.ts} +0 -0
@@ -11,9 +11,10 @@ import type { BasePluginFn } from './types'
11
11
  import type {
12
12
  ComputedDatumGrid,
13
13
  ComputedDataGrid,
14
+ ComputedLayoutDataGrid,
14
15
  EventGrid,
15
16
  ChartParams,
16
- ContainerPosition,
17
+ GridContainerPosition,
17
18
  Layout,
18
19
  TransformData,
19
20
  ColorType } from '@orbcharts/core'
@@ -31,8 +32,10 @@ export interface BaseDotsParams {
31
32
  interface BaseDotsContext {
32
33
  selection: d3.Selection<any, unknown, any, unknown>
33
34
  computedData$: Observable<ComputedDataGrid>
35
+ computedLayoutData$: Observable<ComputedLayoutDataGrid>
34
36
  visibleComputedData$: Observable<ComputedDatumGrid[][]>
35
- existSeriesLabels$: Observable<string[]>
37
+ visibleComputedLayoutData$: Observable<ComputedLayoutDataGrid>
38
+ seriesLabels$: Observable<string[]>
36
39
  SeriesDataMap$: Observable<Map<string, ComputedDatumGrid[]>>
37
40
  GroupDataMap$: Observable<Map<string, ComputedDatumGrid[]>>
38
41
  fullParams$: Observable<BaseDotsParams>
@@ -45,7 +48,7 @@ interface BaseDotsContext {
45
48
  height: number;
46
49
  }>
47
50
  gridHighlight$: Observable<ComputedDatumGrid[]>
48
- gridContainer$: Observable<ContainerPosition[]>
51
+ gridContainerPosition$: Observable<GridContainerPosition[]>
49
52
  event$: Subject<EventGrid>
50
53
  }
51
54
 
@@ -62,11 +65,11 @@ type ClipPathDatum = {
62
65
  // const circleGClassName = getClassName(pluginName, 'circleG')
63
66
  // const circleClassName = getClassName(pluginName, 'circle')
64
67
 
65
- function renderDots ({ graphicGSelection, circleGClassName, circleClassName, data, fullParams, fullChartParams, graphicReverseScale }: {
68
+ function renderDots ({ graphicGSelection, circleGClassName, circleClassName, visibleComputedLayoutData, fullParams, fullChartParams, graphicReverseScale }: {
66
69
  graphicGSelection: d3.Selection<SVGGElement, any, any, any>
67
70
  circleGClassName: string
68
71
  circleClassName: string
69
- data: ComputedDatumGrid[][]
72
+ visibleComputedLayoutData: ComputedLayoutDataGrid
70
73
  fullParams: BaseDotsParams
71
74
  fullChartParams: ChartParams
72
75
  graphicReverseScale: [number, number][]
@@ -83,7 +86,7 @@ function renderDots ({ graphicGSelection, circleGClassName, circleClassName, dat
83
86
  .each((seriesData, seriesIndex, g) => {
84
87
  d3.select(g[seriesIndex])
85
88
  .selectAll<SVGGElement, ComputedDatumGrid>('g')
86
- .data(data[seriesIndex], d => d.id)
89
+ .data(visibleComputedLayoutData[seriesIndex], d => d.id)
87
90
  .join(
88
91
  enter => {
89
92
  // enterDuration
@@ -256,8 +259,10 @@ function renderClipPath ({ defsSelection, clipPathData }: {
256
259
  export const createBaseDots: BasePluginFn<BaseDotsContext> = (pluginName: string, {
257
260
  selection,
258
261
  computedData$,
262
+ computedLayoutData$,
259
263
  visibleComputedData$,
260
- existSeriesLabels$,
264
+ visibleComputedLayoutData$,
265
+ seriesLabels$,
261
266
  SeriesDataMap$,
262
267
  GroupDataMap$,
263
268
  fullParams$,
@@ -267,7 +272,7 @@ export const createBaseDots: BasePluginFn<BaseDotsContext> = (pluginName: string
267
272
  gridGraphicReverseScale$,
268
273
  gridAxesSize$,
269
274
  gridHighlight$,
270
- gridContainer$,
275
+ gridContainerPosition$,
271
276
  event$
272
277
  }) => {
273
278
 
@@ -282,130 +287,7 @@ export const createBaseDots: BasePluginFn<BaseDotsContext> = (pluginName: string
282
287
  // .attr('clip-path', `url(#${clipPathID})`)
283
288
  // const defsSelection: d3.Selection<SVGDefsElement, any, any, any> = axisSelection.append('defs')
284
289
  // const dataAreaSelection: d3.Selection<SVGGElement, any, any, any> = axisSelection.append('g')
285
- const graphicSelection$: Subject<d3.Selection<SVGGElement, ComputedDatumGrid, any, any>> = new Subject()
286
-
287
- // gridAxesTransform$
288
- // .pipe(
289
- // takeUntil(destroy$),
290
- // map(d => d.value),
291
- // distinctUntilChanged()
292
- // ).subscribe(d => {
293
- // axisSelection
294
- // .style('transform', d)
295
- // })
296
-
297
- // gridGraphicTransform$
298
- // .pipe(
299
- // takeUntil(destroy$),
300
- // switchMap(async d => d.value),
301
- // distinctUntilChanged()
302
- // ).subscribe(d => {
303
- // dataAreaSelection
304
- // .transition()
305
- // .duration(50)
306
- // .style('transform', d)
307
- // })
308
-
309
- // const seriesSelection$ = computedData$.pipe(
310
- // takeUntil(destroy$),
311
- // distinctUntilChanged((a, b) => {
312
- // // 只有當series的數量改變時,才重新計算
313
- // return a.length === b.length
314
- // }),
315
- // map((computedData, i) => {
316
- // return selection
317
- // .selectAll<SVGGElement, ComputedDatumGrid[]>(`g.${seriesClassName}`)
318
- // .data(computedData, d => d[0] ? d[0].seriesIndex : i)
319
- // .join(
320
- // enter => {
321
- // return enter
322
- // .append('g')
323
- // .classed(seriesClassName, true)
324
- // .each((d, i, g) => {
325
- // const axesSelection = d3.select(g[i])
326
- // .selectAll<SVGGElement, ComputedDatumGrid[]>(`g.${axesClassName}`)
327
- // .data([i])
328
- // .join(
329
- // enter => {
330
- // return enter
331
- // .append('g')
332
- // .classed(axesClassName, true)
333
- // .attr('clip-path', `url(#${clipPathID})`)
334
- // .each((d, i, g) => {
335
- // const defsSelection = d3.select(g[i])
336
- // .selectAll<SVGDefsElement, any>('defs')
337
- // .data([i])
338
- // .join('defs')
339
-
340
- // const graphicGSelection = d3.select(g[i])
341
- // .selectAll<SVGGElement, any>('g')
342
- // .data([i])
343
- // .join('g')
344
- // .classed(graphicClassName, true)
345
- // })
346
- // },
347
- // update => update,
348
- // exit => exit.remove()
349
- // )
350
- // })
351
- // },
352
- // update => update,
353
- // exit => exit.remove()
354
- // )
355
- // })
356
- // )
357
-
358
- // combineLatest({
359
- // seriesSelection: seriesSelection$,
360
- // gridContainer: gridContainer$
361
- // }).pipe(
362
- // takeUntil(destroy$),
363
- // switchMap(async d => d)
364
- // ).subscribe(data => {
365
- // data.seriesSelection
366
- // .transition()
367
- // .attr('transform', (d, i) => {
368
- // const translate = data.gridContainer[i].translate
369
- // const scale = data.gridContainer[i].scale
370
- // return `translate(${translate[0]}, ${translate[1]}) scale(${scale[0]}, ${scale[1]})`
371
- // })
372
- // })
373
-
374
-
375
- // const axesSelection$ = combineLatest({
376
- // seriesSelection: seriesSelection$,
377
- // gridAxesTransform: gridAxesTransform$
378
- // }).pipe(
379
- // takeUntil(destroy$),
380
- // switchMap(async d => d),
381
- // map(data => {
382
- // return data.seriesSelection
383
- // .select<SVGGElement>(`g.${axesClassName}`)
384
- // .style('transform', data.gridAxesTransform.value)
385
- // })
386
- // )
387
- // const defsSelection$ = axesSelection$.pipe(
388
- // takeUntil(destroy$),
389
- // map(axesSelection => {
390
- // return axesSelection.select<SVGDefsElement>('defs')
391
- // })
392
- // )
393
- // const graphicGSelection$ = combineLatest({
394
- // axesSelection: axesSelection$,
395
- // gridGraphicTransform: gridGraphicTransform$
396
- // }).pipe(
397
- // takeUntil(destroy$),
398
- // switchMap(async d => d),
399
- // map(data => {
400
- // const graphicGSelection = data.axesSelection
401
- // .select<SVGGElement>(`g.${graphicClassName}`)
402
- // graphicGSelection
403
- // .transition()
404
- // .duration(50)
405
- // .style('transform', data.gridGraphicTransform.value)
406
- // return graphicGSelection
407
- // })
408
- // )
290
+ // const graphicSelection$: Subject<d3.Selection<SVGGElement, ComputedDatumGrid, any, any>> = new Subject()
409
291
 
410
292
  const {
411
293
  seriesSelection$,
@@ -416,15 +298,15 @@ export const createBaseDots: BasePluginFn<BaseDotsContext> = (pluginName: string
416
298
  selection,
417
299
  pluginName,
418
300
  clipPathID,
419
- existSeriesLabels$,
420
- gridContainer$,
301
+ seriesLabels$,
302
+ gridContainerPosition$,
421
303
  gridAxesTransform$,
422
304
  gridGraphicTransform$
423
305
  })
424
306
 
425
307
  const graphicReverseScale$: Observable<[number, number][]> = combineLatest({
426
308
  // gridGraphicTransform: gridGraphicTransform$,
427
- // gridContainer: gridContainer$,
309
+ // gridContainerPosition: gridContainerPosition$,
428
310
  // gridAxesTransform: gridAxesTransform$
429
311
  computedData: computedData$,
430
312
  gridGraphicReverseScale: gridGraphicReverseScale$
@@ -457,63 +339,46 @@ export const createBaseDots: BasePluginFn<BaseDotsContext> = (pluginName: string
457
339
  })
458
340
  })
459
341
 
460
- // const visibleComputedData$ = computedData$.pipe(
461
- // map(computedData => {
462
- // return computedData
463
- // .map(d => {
464
- // return d.filter(_d => _d.visible == true)
465
- // })
466
- // })
467
- // )
468
-
469
- // const SeriesDataMap$ = visibleComputedData$.pipe(
470
- // map(d => makeGridSeriesDataMap(d))
471
- // )
472
-
473
- // const GroupDataMap$ = visibleComputedData$.pipe(
474
- // map(d => makeGridGroupDataMap(d))
475
- // )
476
-
477
- // const DataMap$ = computedData$.pipe(
478
- // map(d => {
479
- // const DataMap: Map<string, ComputedDatumGrid> = new Map()
480
- // d.flat().forEach(_d => DataMap.set(_d.id, _d))
481
- // return DataMap
482
- // })
483
- // )
484
-
485
342
  const highlightTarget$ = fullChartParams$.pipe(
486
343
  takeUntil(destroy$),
487
344
  map(d => d.highlightTarget),
488
345
  distinctUntilChanged()
489
346
  )
490
347
 
491
- combineLatest({
348
+ const graphicSelection$ = combineLatest({
492
349
  graphicGSelection: graphicGSelection$,
493
- computedData: computedData$,
494
- visibleComputedData: visibleComputedData$,
495
- SeriesDataMap: SeriesDataMap$,
496
- GroupDataMap: GroupDataMap$,
350
+ visibleComputedLayoutData: visibleComputedLayoutData$,
497
351
  graphicReverseScale: graphicReverseScale$,
498
352
  fullChartParams: fullChartParams$,
499
353
  fullParams: fullParams$,
354
+ }).pipe(
355
+ takeUntil(destroy$),
356
+ switchMap(async (d) => d),
357
+ map(data => {
358
+ return renderDots({
359
+ graphicGSelection: data.graphicGSelection,
360
+ circleGClassName,
361
+ circleClassName,
362
+ visibleComputedLayoutData: data.visibleComputedLayoutData,
363
+ fullParams: data.fullParams,
364
+ fullChartParams: data.fullChartParams,
365
+ graphicReverseScale: data.graphicReverseScale
366
+ })
367
+ })
368
+ )
369
+
370
+ combineLatest({
371
+ graphicSelection: graphicSelection$,
372
+ computedData: computedData$,
373
+ SeriesDataMap: SeriesDataMap$,
374
+ GroupDataMap: GroupDataMap$,
500
375
  highlightTarget: highlightTarget$
501
376
  }).pipe(
502
377
  takeUntil(destroy$),
503
378
  switchMap(async (d) => d),
504
379
  ).subscribe(data => {
505
380
 
506
- const graphicSelection = renderDots({
507
- graphicGSelection: data.graphicGSelection,
508
- circleGClassName,
509
- circleClassName,
510
- data: data.visibleComputedData,
511
- fullParams: data.fullParams,
512
- fullChartParams: data.fullChartParams,
513
- graphicReverseScale: data.graphicReverseScale
514
- })
515
-
516
- graphicSelection
381
+ data.graphicSelection
517
382
  .on('mouseover', (event, datum) => {
518
383
  event.stopPropagation()
519
384
 
@@ -595,8 +460,6 @@ export const createBaseDots: BasePluginFn<BaseDotsContext> = (pluginName: string
595
460
  })
596
461
  })
597
462
 
598
- graphicSelection$.next(graphicSelection)
599
-
600
463
  })
601
464
 
602
465
  // const datumList$ = computedData$.pipe(
@@ -10,7 +10,7 @@ import {
10
10
  Observable,
11
11
  Subject } from 'rxjs'
12
12
  import { createAxisPointScale } from '@orbcharts/core'
13
- import type { ColorType, ComputedDataGrid, ContainerPosition } from '@orbcharts/core'
13
+ import type { ColorType, ComputedDataGrid, GridContainerPosition } from '@orbcharts/core'
14
14
  import type { BasePluginFn } from './types'
15
15
  import type {
16
16
  ComputedDatumGrid,
@@ -51,8 +51,8 @@ interface BaseGroupAxisContext {
51
51
  width: number;
52
52
  height: number;
53
53
  }>
54
- gridContainer$: Observable<ContainerPosition[]>
55
- isSeriesPositionSeprate$: Observable<boolean>
54
+ gridContainerPosition$: Observable<GridContainerPosition[]>
55
+ isSeriesSeprate$: Observable<boolean>
56
56
  }
57
57
 
58
58
  interface TextAlign {
@@ -108,7 +108,7 @@ function renderPointAxis ({ selection, xAxisClassName, groupingLabelClassName, p
108
108
  )
109
109
  .attr('text-anchor', axisLabelAlign.textAnchor)
110
110
  .attr('dominant-baseline', axisLabelAlign.dominantBaseline)
111
- .style('font-size', `${chartParams.styles.textSize}px`)
111
+ .attr('font-size', chartParams.styles.textSize)
112
112
  .style('fill', getColor(params.labelColorType, chartParams))
113
113
  .style('transform', textTransform)
114
114
  .text(d => fullDataFormatter.grid.groupAxis.label)
@@ -161,8 +161,8 @@ function renderPointAxis ({ selection, xAxisClassName, groupingLabelClassName, p
161
161
  // .style('transform', textTransform)
162
162
  // })
163
163
  const xText = xAxisSelection.selectAll('text')
164
- .style('font-family', 'sans-serif')
165
- .style('font-size', `${chartParams.styles.textSize}px`)
164
+ // .style('font-family', 'sans-serif')
165
+ .attr('font-size', chartParams.styles.textSize)
166
166
  // .style('font-weight', 'bold')
167
167
  .style('color', getColor(params.tickTextColorType, chartParams))
168
168
  .attr('text-anchor', tickTextAlign.textAnchor)
@@ -184,8 +184,8 @@ export const createBaseGroupAxis: BasePluginFn<BaseGroupAxisContext> = ((pluginN
184
184
  gridAxesTransform$,
185
185
  gridAxesReverseTransform$,
186
186
  gridAxesSize$,
187
- gridContainer$,
188
- isSeriesPositionSeprate$,
187
+ gridContainerPosition$,
188
+ isSeriesSeprate$,
189
189
  }) => {
190
190
 
191
191
  const destroy$ = new Subject()
@@ -202,12 +202,12 @@ export const createBaseGroupAxis: BasePluginFn<BaseGroupAxisContext> = ((pluginN
202
202
  return a.length === b.length
203
203
  }),
204
204
  ),
205
- isSeriesPositionSeprate: isSeriesPositionSeprate$
205
+ isSeriesSeprate: isSeriesSeprate$
206
206
  }).pipe(
207
207
  takeUntil(destroy$),
208
208
  switchMap(async (d) => d),
209
209
  map(data => {
210
- return data.isSeriesPositionSeprate
210
+ return data.isSeriesSeprate
211
211
  // series分開的時候顯示各別axis
212
212
  ? data.computedData
213
213
  // series合併的時候只顯示第一個axis
@@ -235,16 +235,16 @@ export const createBaseGroupAxis: BasePluginFn<BaseGroupAxisContext> = ((pluginN
235
235
 
236
236
  combineLatest({
237
237
  containerSelection: containerSelection$,
238
- gridContainer: gridContainer$
238
+ gridContainerPosition: gridContainerPosition$
239
239
  }).pipe(
240
240
  takeUntil(destroy$),
241
241
  switchMap(async d => d)
242
242
  ).subscribe(data => {
243
243
  data.containerSelection
244
244
  .attr('transform', (d, i) => {
245
- const gridContainer = data.gridContainer[i] ?? data.gridContainer[0]
246
- const translate = gridContainer.translate
247
- const scale = gridContainer.scale
245
+ const gridContainerPosition = data.gridContainerPosition[i] ?? data.gridContainerPosition[0]
246
+ const translate = gridContainerPosition.translate
247
+ const scale = gridContainerPosition.scale
248
248
  return `translate(${translate[0]}, ${translate[1]}) scale(${scale[0]}, ${scale[1]})`
249
249
  })
250
250
  // .attr('opacity', 0)
@@ -326,14 +326,14 @@ export const createBaseGroupAxis: BasePluginFn<BaseGroupAxisContext> = ((pluginN
326
326
  fullParams: fullParams$,
327
327
  fullDataFormatter: fullDataFormatter$,
328
328
  gridAxesReverseTransform: gridAxesReverseTransform$,
329
- gridContainer: gridContainer$
329
+ gridContainerPosition: gridContainerPosition$
330
330
  }).pipe(
331
331
  takeUntil(destroy$),
332
332
  switchMap(async (d) => d),
333
333
  map(data => {
334
334
  const axisReverseTranslateValue = `translate(${data.gridAxesReverseTransform.translate[0]}px, ${data.gridAxesReverseTransform.translate[1]}px)`
335
335
  const axisReverseRotateValue = `rotate(${data.gridAxesReverseTransform.rotate}deg) rotateX(${data.gridAxesReverseTransform.rotateX}deg) rotateY(${data.gridAxesReverseTransform.rotateY}deg)`
336
- const containerScaleReverseScaleValue = `scale(${1 / data.gridContainer[0].scale[0]}, ${1 / data.gridContainer[0].scale[1]})`
336
+ const containerScaleReverseScaleValue = `scale(${1 / data.gridContainerPosition[0].scale[0]}, ${1 / data.gridContainerPosition[0].scale[1]})`
337
337
  const tickTextRotateDeg = (data.fullDataFormatter.grid.groupAxis.position === 'left' && data.fullDataFormatter.grid.valueAxis.position === 'top')
338
338
  || (data.fullDataFormatter.grid.groupAxis.position === 'right' && data.fullDataFormatter.grid.valueAxis.position === 'bottom')
339
339
  ? data.fullParams.tickTextRotate + 180 // 修正文字倒轉
@@ -36,6 +36,7 @@ interface BaseLegendContext {
36
36
  fullParams$: Observable<BaseLegendParams>
37
37
  layout$: Observable<Layout>
38
38
  fullChartParams$: Observable<ChartParams>
39
+ textSizePx$: Observable<number>
39
40
  }
40
41
 
41
42
  // 第1層 - 定位的容器
@@ -107,7 +108,8 @@ export const createBaseLegend: BasePluginFn<BaseLegendContext> = (pluginName: st
107
108
  seriesLabels$,
108
109
  fullParams$,
109
110
  layout$,
110
- fullChartParams$
111
+ fullChartParams$,
112
+ textSizePx$
111
113
  }) => {
112
114
 
113
115
  const rootPositionClassName = getClassName(pluginName, 'root-position')
@@ -280,7 +282,8 @@ export const createBaseLegend: BasePluginFn<BaseLegendContext> = (pluginName: st
280
282
  lineDirection: lineDirection$,
281
283
  lineMaxSize: lineMaxSize$,
282
284
  defaultListStyle: defaultListStyle$,
283
- SeriesLabelColorMap: SeriesLabelColorMap$
285
+ SeriesLabelColorMap: SeriesLabelColorMap$,
286
+ textSizePx: textSizePx$
284
287
  }).pipe(
285
288
  takeUntil(destroy$),
286
289
  switchMap(async d => d),
@@ -291,8 +294,8 @@ export const createBaseLegend: BasePluginFn<BaseLegendContext> = (pluginName: st
291
294
  return prev
292
295
  }
293
296
 
294
- const textWidth = measureTextWidth(current, data.fullChartParams.styles.textSize)
295
- const itemWidth = (data.fullChartParams.styles.textSize * 1.5) + textWidth
297
+ const textWidth = measureTextWidth(current, data.textSizePx)
298
+ const itemWidth = (data.textSizePx * 1.5) + textWidth
296
299
  // const color = getSeriesColor(currentIndex, data.fullChartParams)
297
300
  const color = data.SeriesLabelColorMap.get(current)
298
301
  const lastItem: LegendItem | null = prev[0] && prev[0][0]
@@ -307,10 +310,10 @@ export const createBaseLegend: BasePluginFn<BaseLegendContext> = (pluginName: st
307
310
 
308
311
  if (_data.lineDirection === 'column') {
309
312
  let tempTranslateY = _lastItem
310
- ? _lastItem.translateY + _data.fullChartParams.styles.textSize + _data.fullParams.gap
313
+ ? _lastItem.translateY + _data.textSizePx + _data.fullParams.gap
311
314
  : 0
312
315
 
313
- if ((tempTranslateY + _data.fullChartParams.styles.textSize) > _data.lineMaxSize) {
316
+ if ((tempTranslateY + _data.textSizePx) > _data.lineMaxSize) {
314
317
  // 換行
315
318
  lineIndex = _lastItem.lineIndex + 1
316
319
  itemIndex = 0
@@ -340,7 +343,7 @@ export const createBaseLegend: BasePluginFn<BaseLegendContext> = (pluginName: st
340
343
  itemIndex = _lastItem ? _lastItem.itemIndex + 1 : 0
341
344
  translateX = tempTranslateX
342
345
  }
343
- translateY = (_data.fullChartParams.styles.textSize + _data.fullParams.gap) * lineIndex
346
+ translateY = (_data.textSizePx + _data.fullParams.gap) * lineIndex
344
347
  }
345
348
 
346
349
  return { translateX, translateY, lineIndex, itemIndex }
@@ -379,7 +382,8 @@ export const createBaseLegend: BasePluginFn<BaseLegendContext> = (pluginName: st
379
382
  fullParams: fullParams$,
380
383
  fullChartParams: fullChartParams$,
381
384
  lineDirection: lineDirection$,
382
- lengendItems: lengendItems$
385
+ lengendItems: lengendItems$,
386
+ textSizePx: textSizePx$
383
387
  }).pipe(
384
388
  takeUntil(destroy$),
385
389
  switchMap(async d => d),
@@ -404,10 +408,10 @@ export const createBaseLegend: BasePluginFn<BaseLegendContext> = (pluginName: st
404
408
  return p + maxWidthInLine
405
409
  }, 0)
406
410
  width += _data.fullParams.gap * (_lengendItems.length - 1)
407
- height = firstLineLastItem.translateY + _data.fullChartParams.styles.textSize
411
+ height = firstLineLastItem.translateY + _data.textSizePx
408
412
  } else {
409
413
  width = firstLineLastItem.translateX + firstLineLastItem.itemWidth
410
- height = (_data.fullChartParams.styles.textSize * _lengendItems.length) + (_data.fullParams.gap * (_lengendItems.length - 1))
414
+ height = (_data.textSizePx * _lengendItems.length) + (_data.fullParams.gap * (_lengendItems.length - 1))
411
415
  }
412
416
 
413
417
  return { width, height }
@@ -565,7 +569,8 @@ export const createBaseLegend: BasePluginFn<BaseLegendContext> = (pluginName: st
565
569
  lengendListSelection: lengendListSelection$,
566
570
  fullParams: fullParams$,
567
571
  fullChartParams: fullChartParams$,
568
- lengendItems: lengendItems$
572
+ lengendItems: lengendItems$,
573
+ textSizePx: textSizePx$
569
574
  }).pipe(
570
575
  takeUntil(destroy$),
571
576
  switchMap(async d => d),
@@ -589,7 +594,7 @@ export const createBaseLegend: BasePluginFn<BaseLegendContext> = (pluginName: st
589
594
  return `translate(${d.translateX}, ${d.translateY})`
590
595
  })
591
596
  .each((d, i, g) => {
592
- const rectCenterX = data.fullChartParams.styles.textSize / 2
597
+ const rectCenterX = data.textSizePx / 2
593
598
  const transformRectWidth = - d.listRectWidth / 2
594
599
  const transformRectHeight = - d.listRectHeight / 2
595
600
  // 方塊
@@ -619,7 +624,7 @@ export const createBaseLegend: BasePluginFn<BaseLegendContext> = (pluginName: st
619
624
  },
620
625
  exit => exit.remove()
621
626
  )
622
- .attr('x', data.fullChartParams.styles.textSize * 1.5)
627
+ .attr('x', data.textSizePx * 1.5)
623
628
  .attr('font-size', data.fullChartParams.styles.textSize)
624
629
  .attr('fill', d => data.fullParams.textColorType === 'series'
625
630
  ? getSeriesColor(d.seriesIndex, data.fullChartParams)