@orbcharts/plugins-basic 3.0.0-beta.3 → 3.0.0-beta.5

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 (147) hide show
  1. package/dist/{src → orbcharts-plugins-basic/src}/base/BaseBarStack.d.ts +2 -2
  2. package/dist/{src → orbcharts-plugins-basic/src}/base/BaseBars.d.ts +2 -2
  3. package/dist/{src → orbcharts-plugins-basic/src}/base/BaseBarsTriangle.d.ts +2 -2
  4. package/dist/{src → orbcharts-plugins-basic/src}/base/BaseDots.d.ts +2 -2
  5. package/dist/{src → orbcharts-plugins-basic/src}/base/BaseGroupAxis.d.ts +2 -2
  6. package/dist/{src → orbcharts-plugins-basic/src}/base/BaseLegend.d.ts +1 -1
  7. package/dist/{src → orbcharts-plugins-basic/src}/base/BaseLineAreas.d.ts +3 -3
  8. package/dist/{src → orbcharts-plugins-basic/src}/base/BaseLines.d.ts +3 -3
  9. package/dist/{src → orbcharts-plugins-basic/src}/base/BaseValueAxis.d.ts +3 -2
  10. package/dist/{src → orbcharts-plugins-basic/src}/grid/defaults.d.ts +1 -1
  11. package/dist/{src → orbcharts-plugins-basic/src}/grid/gridObservables.d.ts +5 -5
  12. package/dist/orbcharts-plugins-basic/src/index.d.ts +6 -0
  13. package/dist/orbcharts-plugins-basic/src/multiValue/defaults.d.ts +9 -0
  14. package/dist/orbcharts-plugins-basic/src/multiValue/index.d.ts +8 -0
  15. package/dist/orbcharts-plugins-basic/src/multiValue/multiValueObservables.d.ts +33 -0
  16. package/dist/orbcharts-plugins-basic/src/multiValue/plugins/MultiValueLegend.d.ts +1 -0
  17. package/dist/orbcharts-plugins-basic/src/multiValue/plugins/MultiValueTooltip.d.ts +1 -0
  18. package/dist/orbcharts-plugins-basic/src/multiValue/plugins/Scatter.d.ts +3 -0
  19. package/dist/orbcharts-plugins-basic/src/multiValue/plugins/ScatterBubbles.d.ts +3 -0
  20. package/dist/orbcharts-plugins-basic/src/multiValue/plugins/XYAux.d.ts +3 -0
  21. package/dist/orbcharts-plugins-basic/src/multiValue/plugins/XYAxes.d.ts +3 -0
  22. package/dist/orbcharts-plugins-basic/src/multiValue/plugins/XYZoom.d.ts +1 -0
  23. package/dist/{src → orbcharts-plugins-basic/src}/series/seriesObservables.d.ts +3 -3
  24. package/dist/{src → orbcharts-plugins-basic/src}/utils/observables.d.ts +1 -1
  25. package/dist/{src → orbcharts-plugins-basic/src}/utils/orbchartsUtils.d.ts +3 -3
  26. package/dist/orbcharts-plugins-basic.es.js +11809 -10185
  27. package/dist/orbcharts-plugins-basic.umd.js +66 -34
  28. package/dist/src/index.d.ts +1 -5
  29. package/package.json +4 -4
  30. package/src/base/BaseBarStack.ts +2 -2
  31. package/src/base/BaseBars.ts +2 -2
  32. package/src/base/BaseBarsTriangle.ts +2 -2
  33. package/src/base/BaseDots.ts +2 -53
  34. package/src/base/BaseGroupAxis.ts +3 -3
  35. package/src/base/BaseLegend.ts +21 -17
  36. package/src/base/BaseLineAreas.ts +3 -3
  37. package/src/base/BaseLines.ts +3 -3
  38. package/src/base/BaseValueAxis.ts +46 -43
  39. package/src/grid/defaults.ts +3 -3
  40. package/src/grid/gridObservables.ts +24 -15
  41. package/src/grid/plugins/GridLegend.ts +2 -2
  42. package/src/grid/plugins/GridZoom.ts +14 -14
  43. package/src/grid/plugins/GroupAux.ts +206 -201
  44. package/src/grid/plugins/ValueAxis.ts +1 -0
  45. package/src/grid/plugins/ValueStackAxis.ts +1 -0
  46. package/src/index.ts +1 -0
  47. package/src/multiGrid/plugins/MultiGridLegend.ts +2 -2
  48. package/src/multiGrid/plugins/MultiValueAxis.ts +1 -0
  49. package/src/multiGrid/plugins/MultiValueStackAxis.ts +1 -0
  50. package/src/multiGrid/plugins/OverlappingValueAxes.ts +1 -0
  51. package/src/multiGrid/plugins/OverlappingValueStackAxes.ts +1 -0
  52. package/src/multiValue/defaults.ts +163 -0
  53. package/src/multiValue/index.ts +9 -0
  54. package/src/multiValue/multiValueObservables.ts +258 -0
  55. package/src/multiValue/plugins/MultiValueLegend.ts +107 -0
  56. package/src/multiValue/plugins/MultiValueTooltip.ts +66 -0
  57. package/src/multiValue/plugins/Scatter.ts +426 -0
  58. package/src/multiValue/plugins/ScatterBubbles.ts +551 -0
  59. package/src/multiValue/plugins/XYAux.ts +682 -0
  60. package/src/multiValue/plugins/XYAxes.ts +677 -0
  61. package/src/multiValue/plugins/XYZoom.ts +300 -0
  62. package/src/series/plugins/Bubbles.ts +4 -4
  63. package/src/series/plugins/Pie.ts +2 -2
  64. package/src/series/plugins/PieEventTexts.ts +2 -2
  65. package/src/series/plugins/PieLabels.ts +2 -2
  66. package/src/series/plugins/Rose.ts +2 -2
  67. package/src/series/plugins/RoseLabels.ts +2 -2
  68. package/src/series/plugins/SeriesLegend.ts +4 -4
  69. package/src/series/seriesObservables.ts +3 -3
  70. package/src/tree/plugins/TreeLegend.ts +3 -10
  71. package/src/utils/d3Utils.ts +2 -1
  72. package/src/utils/observables.ts +2 -2
  73. package/src/utils/orbchartsUtils.ts +7 -6
  74. package/dist/src/base/BaseGroupArea.d.ts +0 -0
  75. package/dist/src/multiValue/plugins/Scatter.d.ts +0 -0
  76. package/dist/src/multiValue/plugins/ScatterAxes.d.ts +0 -0
  77. package/dist/src/relationship/index.d.ts +0 -0
  78. package/src/base/BaseGroupArea.ts +0 -0
  79. package/src/multiValue/plugins/ScatterAxes.ts +0 -0
  80. /package/dist/{lib → orbcharts-plugins-basic/lib}/core-types.d.ts +0 -0
  81. /package/dist/{lib → orbcharts-plugins-basic/lib}/core.d.ts +0 -0
  82. /package/dist/{lib → orbcharts-plugins-basic/lib}/plugins-basic-types.d.ts +0 -0
  83. /package/dist/{src → orbcharts-plugins-basic/src}/base/BaseTooltip.d.ts +0 -0
  84. /package/dist/{src → orbcharts-plugins-basic/src}/base/types.d.ts +0 -0
  85. /package/dist/{src → orbcharts-plugins-basic/src}/const.d.ts +0 -0
  86. /package/dist/{src → orbcharts-plugins-basic/src}/grid/index.d.ts +0 -0
  87. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/BarStack.d.ts +0 -0
  88. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/Bars.d.ts +0 -0
  89. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/BarsPN.d.ts +0 -0
  90. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/BarsTriangle.d.ts +0 -0
  91. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/Dots.d.ts +0 -0
  92. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/GridLegend.d.ts +0 -0
  93. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/GridTooltip.d.ts +0 -0
  94. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/GridZoom.d.ts +0 -0
  95. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/GroupAux.d.ts +0 -0
  96. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/GroupAxis.d.ts +0 -0
  97. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/LineAreas.d.ts +0 -0
  98. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/Lines.d.ts +0 -0
  99. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/ValueAxis.d.ts +0 -0
  100. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/ValueStackAxis.d.ts +0 -0
  101. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/defaults.d.ts +0 -0
  102. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/index.d.ts +0 -0
  103. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/multiGridObservables.d.ts +0 -0
  104. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiBarStack.d.ts +0 -0
  105. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiBars.d.ts +0 -0
  106. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiBarsTriangle.d.ts +0 -0
  107. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiDots.d.ts +0 -0
  108. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiGridLegend.d.ts +0 -0
  109. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiGridTooltip.d.ts +0 -0
  110. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiGroupAxis.d.ts +0 -0
  111. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiLineAreas.d.ts +0 -0
  112. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiLines.d.ts +0 -0
  113. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiValueAxis.d.ts +0 -0
  114. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiValueStackAxis.d.ts +0 -0
  115. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/OverlappingValueAxes.d.ts +0 -0
  116. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/OverlappingValueStackAxes.d.ts +0 -0
  117. /package/dist/{src/grid → orbcharts-plugins-basic/src/multiValue}/plugins/Ranking.d.ts +0 -0
  118. /package/dist/{src/grid → orbcharts-plugins-basic/src/multiValue}/plugins/RankingAxis.d.ts +0 -0
  119. /package/dist/{src → orbcharts-plugins-basic/src}/noneData/defaults.d.ts +0 -0
  120. /package/dist/{src → orbcharts-plugins-basic/src}/noneData/index.d.ts +0 -0
  121. /package/dist/{src → orbcharts-plugins-basic/src}/noneData/plugins/Container.d.ts +0 -0
  122. /package/dist/{src → orbcharts-plugins-basic/src}/noneData/plugins/Tooltip.d.ts +0 -0
  123. /package/dist/{src/multiValue → orbcharts-plugins-basic/src/relationship}/index.d.ts +0 -0
  124. /package/dist/{src → orbcharts-plugins-basic/src}/relationship/plugins/Relationship.d.ts +0 -0
  125. /package/dist/{src → orbcharts-plugins-basic/src}/series/defaults.d.ts +0 -0
  126. /package/dist/{src → orbcharts-plugins-basic/src}/series/index.d.ts +0 -0
  127. /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/Bubbles.d.ts +0 -0
  128. /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/Pie.d.ts +0 -0
  129. /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/PieEventTexts.d.ts +0 -0
  130. /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/PieLabels.d.ts +0 -0
  131. /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/Rose.d.ts +0 -0
  132. /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/RoseLabels.d.ts +0 -0
  133. /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/SeriesLegend.d.ts +0 -0
  134. /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/SeriesTooltip.d.ts +0 -0
  135. /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/Waffle.d.ts +0 -0
  136. /package/dist/{src → orbcharts-plugins-basic/src}/series/seriesUtils.d.ts +0 -0
  137. /package/dist/{src → orbcharts-plugins-basic/src}/tree/defaults.d.ts +0 -0
  138. /package/dist/{src → orbcharts-plugins-basic/src}/tree/index.d.ts +0 -0
  139. /package/dist/{src → orbcharts-plugins-basic/src}/tree/plugins/TreeLegend.d.ts +0 -0
  140. /package/dist/{src → orbcharts-plugins-basic/src}/tree/plugins/TreeMap.d.ts +0 -0
  141. /package/dist/{src → orbcharts-plugins-basic/src}/tree/plugins/TreeTooltip.d.ts +0 -0
  142. /package/dist/{src → orbcharts-plugins-basic/src}/utils/commonUtils.d.ts +0 -0
  143. /package/dist/{src → orbcharts-plugins-basic/src}/utils/d3Graphics.d.ts +0 -0
  144. /package/dist/{src → orbcharts-plugins-basic/src}/utils/d3Utils.d.ts +0 -0
  145. /package/dist/{vite.config.d.ts → orbcharts-plugins-basic/vite.config.d.ts} +0 -0
  146. /package/src/{grid → multiValue}/plugins/Ranking.ts +0 -0
  147. /package/src/{grid → multiValue}/plugins/RankingAxis.ts +0 -0
@@ -19,20 +19,20 @@ import type {
19
19
  ComputedDataGrid,
20
20
  ComputedDatumGrid,
21
21
  TransformData,
22
- GridContainerPosition,
22
+ ContainerPositionScaled,
23
23
  Layout } from '../../lib/core-types'
24
- import { createAxisQuantizeScale } from '../../lib/core'
24
+ import { createAxisToLabelIndexScale } from '../../lib/core'
25
25
  import { getClassName, getUniID } from '../utils/orbchartsUtils'
26
26
  import { d3EventObservable } from '../utils/observables'
27
27
 
28
- // grid選取器
28
+ // 建立 grid 主要的 selection
29
29
  export const gridSelectionsObservable = ({ selection, pluginName, clipPathID, seriesLabels$, gridContainerPosition$, gridAxesTransform$, gridGraphicTransform$ }: {
30
30
  selection: d3.Selection<any, unknown, any, unknown>
31
31
  pluginName: string
32
32
  clipPathID: string
33
33
  // computedData$: Observable<ComputedDataGrid>
34
34
  seriesLabels$: Observable<string[]>
35
- gridContainerPosition$: Observable<GridContainerPosition[]>
35
+ gridContainerPosition$: Observable<ContainerPositionScaled[]>
36
36
  gridAxesTransform$: Observable<TransformData>
37
37
  gridGraphicTransform$: Observable<TransformData>
38
38
  }) => {
@@ -40,11 +40,15 @@ export const gridSelectionsObservable = ({ selection, pluginName, clipPathID, se
40
40
  const axesClassName = getClassName(pluginName, 'axes')
41
41
  const graphicClassName = getClassName(pluginName, 'graphic')
42
42
 
43
+ // <g> series selection(container排放位置)
44
+ // <g> axes selection(旋轉圖軸方向)
45
+ // <defs> clipPath selection
46
+ // <g> graphic selection(圖形 scale 範圍的變形)
43
47
  const seriesSelection$ = seriesLabels$.pipe(
44
- map((existSeriesLabels, i) => {
48
+ map((seriesLabels, i) => {
45
49
  return selection
46
50
  .selectAll<SVGGElement, string>(`g.${seriesClassName}`)
47
- .data(existSeriesLabels, d => d)
51
+ .data(seriesLabels, d => d)
48
52
  .join(
49
53
  enter => {
50
54
  return enter
@@ -85,6 +89,7 @@ export const gridSelectionsObservable = ({ selection, pluginName, clipPathID, se
85
89
  shareReplay(1)
86
90
  )
87
91
 
92
+ // <g> series selection
88
93
  combineLatest({
89
94
  seriesSelection: seriesSelection$,
90
95
  gridContainerPosition: gridContainerPosition$
@@ -101,6 +106,7 @@ export const gridSelectionsObservable = ({ selection, pluginName, clipPathID, se
101
106
  })
102
107
  })
103
108
 
109
+ // <g> axes selection
104
110
  const axesSelection$ = combineLatest({
105
111
  seriesSelection: seriesSelection$,
106
112
  gridAxesTransform: gridAxesTransform$
@@ -113,12 +119,16 @@ export const gridSelectionsObservable = ({ selection, pluginName, clipPathID, se
113
119
  }),
114
120
  shareReplay(1)
115
121
  )
122
+
123
+ // <defs> clipPath selection
116
124
  const defsSelection$ = axesSelection$.pipe(
117
125
  map(axesSelection => {
118
126
  return axesSelection.select<SVGDefsElement>('defs')
119
127
  }),
120
128
  shareReplay(1)
121
129
  )
130
+
131
+ // <g> graphic selection
122
132
  const graphicGSelection$ = combineLatest({
123
133
  axesSelection: axesSelection$,
124
134
  gridGraphicTransform: gridGraphicTransform$
@@ -145,7 +155,6 @@ export const gridSelectionsObservable = ({ selection, pluginName, clipPathID, se
145
155
  }
146
156
 
147
157
  // 由事件取得group data的function
148
- // @Q@ 之後重構改用 gridGroupPosition
149
158
  export const gridGroupPositionFnObservable = ({ fullDataFormatter$, gridAxesSize$, computedData$, fullChartParams$, gridContainerPosition$, layout$ }: {
150
159
  fullDataFormatter$: Observable<DataFormatterGrid>
151
160
  gridAxesSize$: Observable<{
@@ -155,7 +164,7 @@ export const gridGroupPositionFnObservable = ({ fullDataFormatter$, gridAxesSize
155
164
  computedData$: Observable<ComputedDataGrid>
156
165
  // GroupDataMap$: Observable<Map<string, ComputedDatumGrid[]>>
157
166
  fullChartParams$: Observable<ChartParams>
158
- gridContainerPosition$: Observable<GridContainerPosition[]>
167
+ gridContainerPosition$: Observable<ContainerPositionScaled[]>
159
168
  layout$: Observable<Layout>
160
169
  }): Observable<(event: any) => { groupIndex: number; groupLabel: string }> => {
161
170
  const destroy$ = new Subject()
@@ -289,7 +298,7 @@ export const gridGroupPositionFnObservable = ({ fullDataFormatter$, gridAxesSize
289
298
  ? true : false
290
299
 
291
300
  // 比例尺座標對應非連續資料索引
292
- const xIndexScale = createAxisQuantizeScale({
301
+ const xIndexScale = createAxisToLabelIndexScale({
293
302
  axisLabels: data.scaleRangeGroupLabels,
294
303
  axisWidth: data.axisSize.width,
295
304
  padding: data.dataFormatter.grid.groupAxis.scalePadding,
@@ -305,7 +314,7 @@ export const gridGroupPositionFnObservable = ({ fullDataFormatter$, gridAxesSize
305
314
  }
306
315
 
307
316
  // 比例尺座標取得groupData的function
308
- const createEventGroupData: (event: any) => { groupIndex: number; groupLabel: string } = (event: any) => {
317
+ const createEventGroupData: (event: MouseEvent) => { groupIndex: number; groupLabel: string } = (event: any) => {
309
318
  // 由於event座標是基於底層的,但是container會有多欄,所以要重新計算
310
319
  const eventData = {
311
320
  offsetX: event.offsetX * data.columnAmount % data.layout.rootWidth,
@@ -332,7 +341,7 @@ export const gridGroupPositionFnObservable = ({ fullDataFormatter$, gridAxesSize
332
341
  })
333
342
  }
334
343
 
335
- export const gridGroupPosition = ({ rootSelection, fullDataFormatter$, gridAxesSize$, computedData$, fullChartParams$, gridContainerPosition$, layout$ }: {
344
+ export const gridGroupPositionObservable = ({ rootSelection, fullDataFormatter$, gridAxesSize$, computedData$, fullChartParams$, gridContainerPosition$, layout$ }: {
336
345
  rootSelection: d3.Selection<any, unknown, any, unknown>
337
346
  fullDataFormatter$: Observable<DataFormatterGrid>
338
347
  gridAxesSize$: Observable<{
@@ -341,10 +350,10 @@ export const gridGroupPosition = ({ rootSelection, fullDataFormatter$, gridAxesS
341
350
  }>
342
351
  computedData$: Observable<ComputedDataGrid>
343
352
  fullChartParams$: Observable<ChartParams>
344
- gridContainerPosition$: Observable<GridContainerPosition[]>
353
+ gridContainerPosition$: Observable<ContainerPositionScaled[]>
345
354
  layout$: Observable<Layout>
346
355
  }) => {
347
- const rootMousemove$: Observable<any> = d3EventObservable(rootSelection, 'mousemove')
356
+ const rootMousemove$ = d3EventObservable(rootSelection, 'mousemove')
348
357
 
349
358
  const groupScaleDomain$ = combineLatest({
350
359
  fullDataFormatter: fullDataFormatter$,
@@ -410,7 +419,7 @@ export const gridGroupPosition = ({ rootSelection, fullDataFormatter$, gridAxesS
410
419
  }).pipe(
411
420
  switchMap(async d => d),
412
421
  map(data => {
413
- return createAxisQuantizeScale({
422
+ return createAxisToLabelIndexScale({
414
423
  axisLabels: data.scaleRangeGroupLabels,
415
424
  axisWidth: data.gridAxesSize.width,
416
425
  padding: data.fullDataFormatter.grid.groupAxis.scalePadding,
@@ -500,7 +509,7 @@ export const gridGroupPosition = ({ rootSelection, fullDataFormatter$, gridAxesS
500
509
 
501
510
  // const gridContainerEventData$ = ({ eventData$, gridContainerPosition$, layout$ }: {
502
511
  // eventData$: Observable<any>
503
- // gridContainerPosition$: Observable<GridContainerPosition[]>
512
+ // gridContainerPosition$: Observable<ContainerPositionScaled[]>
504
513
  // layout$: Observable<Layout>
505
514
  // }): Observable<{
506
515
  // offsetX: number;
@@ -85,14 +85,14 @@ export const GridLegend = defineGridPlugin(pluginConfig)(({ selection, rootSelec
85
85
  ]
86
86
  return {
87
87
  ...d,
88
- seriesList
88
+ labelList: seriesList
89
89
  }
90
90
  })
91
91
  )
92
92
 
93
93
  const unsubscribeBaseLegend = createBaseLegend(pluginName, {
94
94
  rootSelection,
95
- seriesLabels$,
95
+ legendLabels$: seriesLabels$,
96
96
  fullParams$,
97
97
  layout$: observer.layout$,
98
98
  fullChartParams$: observer.fullChartParams$,
@@ -12,7 +12,7 @@ import {
12
12
  import type { DefinePluginConfig } from '../../../lib/core-types'
13
13
  import type { DataFormatterGrid } from '../../../lib/core-types'
14
14
  import {
15
- defineGridPlugin, createAxisLinearScale } from '../../../lib/core'
15
+ defineGridPlugin, createValueToAxisScale } from '../../../lib/core'
16
16
  import { DEFAULT_GRID_ZOOM_PARAMS } from '../defaults'
17
17
  import { getClassName, getUniID } from '../../utils/orbchartsUtils'
18
18
  import { LAYER_INDEX_OF_ROOT } from '../../const'
@@ -60,7 +60,7 @@ export const GridZoom = defineGridPlugin(pluginConfig)(({ selection, rootSelecti
60
60
  // .attr('y', d.top)
61
61
  // })
62
62
 
63
- const groupMax$ = observer.computedData$.pipe(
63
+ const groupMaxIndex$ = observer.computedData$.pipe(
64
64
  map(d => d[0] ? d[0].length - 1 : 0),
65
65
  distinctUntilChanged()
66
66
  )
@@ -82,10 +82,10 @@ export const GridZoom = defineGridPlugin(pluginConfig)(({ selection, rootSelecti
82
82
  )
83
83
 
84
84
 
85
- const groupScale$ = combineLatest({
85
+ const initGroupScale$ = combineLatest({
86
86
  initGroupAxis: initGroupAxis$,
87
- fullDataFormatter: observer.fullDataFormatter$,
88
- groupMax: groupMax$,
87
+ // fullDataFormatter: observer.fullDataFormatter$,
88
+ groupMaxIndex: groupMaxIndex$,
89
89
  layout: observer.layout$,
90
90
  axisSize: observer.gridAxesSize$
91
91
  }).pipe(
@@ -95,11 +95,11 @@ export const GridZoom = defineGridPlugin(pluginConfig)(({ selection, rootSelecti
95
95
  // const groupMin = 0
96
96
  const groupScaleDomainMin = data.initGroupAxis.scaleDomain[0] - data.initGroupAxis.scalePadding
97
97
  const groupScaleDomainMax = data.initGroupAxis.scaleDomain[1] === 'max'
98
- ? data.groupMax + data.initGroupAxis.scalePadding
98
+ ? data.groupMaxIndex + data.initGroupAxis.scalePadding
99
99
  : data.initGroupAxis.scaleDomain[1] as number + data.initGroupAxis.scalePadding
100
100
 
101
- const groupScale: d3.ScaleLinear<number, number> = createAxisLinearScale({
102
- maxValue: data.groupMax,
101
+ const groupScale: d3.ScaleLinear<number, number> = createValueToAxisScale({
102
+ maxValue: data.groupMaxIndex,
103
103
  minValue: 0,
104
104
  axisWidth: data.axisSize.width,
105
105
  scaleDomain: [groupScaleDomainMin, groupScaleDomainMax],
@@ -111,20 +111,20 @@ export const GridZoom = defineGridPlugin(pluginConfig)(({ selection, rootSelecti
111
111
  )
112
112
 
113
113
  combineLatest({
114
- groupScale: groupScale$,
114
+ initGroupScale: initGroupScale$,
115
115
  // initGroupAxis: initGroupAxis$,
116
116
  // fullDataFormatter: fullDataFormatter$.pipe(first()), // 只用第一次資料來計算scale才不會造成每次變動都受到影響
117
117
  fullDataFormatter: observer.fullDataFormatter$,
118
- groupMax: groupMax$,
118
+ groupMaxIndex: groupMaxIndex$,
119
119
  // layout: observer.layout$,
120
120
  // axisSize: observer.gridAxesSize$
121
121
  }).pipe(
122
122
  takeUntil(destroy$),
123
123
  switchMap(async (d) => d),
124
124
  ).subscribe(data => {
125
- const groupMin = 0
125
+ const groupMinIndex = 0
126
126
 
127
- const shadowScale = data.groupScale.copy()
127
+ const shadowScale = data.initGroupScale.copy()
128
128
 
129
129
  const zoom = d3.zoom()
130
130
  // .scaleExtent([1, data.groupMaxIndex])
@@ -153,7 +153,7 @@ export const GridZoom = defineGridPlugin(pluginConfig)(({ selection, rootSelecti
153
153
  // console.log('t.x', t.x)
154
154
  const mapGroupindex = (d: number) => {
155
155
  const n = Math.round(d)
156
- return Math.min(data.groupMax, Math.max(groupMin, n));
156
+ return Math.min(data.groupMaxIndex, Math.max(groupMinIndex, n));
157
157
  }
158
158
 
159
159
  const zoomedDomain = data.fullDataFormatter.grid.groupAxis.position === 'bottom' || data.fullDataFormatter.grid.groupAxis.position === 'top'
@@ -166,7 +166,7 @@ export const GridZoom = defineGridPlugin(pluginConfig)(({ selection, rootSelecti
166
166
 
167
167
 
168
168
  // domain超過極限值
169
- if (zoomedDomain[0] <= groupMin && zoomedDomain[1] >= data.groupMax) {
169
+ if (zoomedDomain[0] <= groupMinIndex && zoomedDomain[1] >= data.groupMaxIndex) {
170
170
  // 繼續縮小
171
171
  if (t.k < lastTransform.k) {
172
172
  // 維持前一次的transform