@orbcharts/plugins-basic 3.0.0-beta.1 → 3.0.0-beta.11

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 (181) hide show
  1. package/dist/{src → orbcharts-plugins-basic/src}/base/BaseBars.d.ts +2 -2
  2. package/dist/{src → orbcharts-plugins-basic/src}/base/BaseBarsTriangle.d.ts +2 -2
  3. package/dist/{src → orbcharts-plugins-basic/src}/base/BaseDots.d.ts +2 -2
  4. package/dist/{src → orbcharts-plugins-basic/src}/base/BaseGroupAxis.d.ts +2 -2
  5. package/dist/{src → orbcharts-plugins-basic/src}/base/BaseLegend.d.ts +1 -1
  6. package/dist/{src → orbcharts-plugins-basic/src}/base/BaseLineAreas.d.ts +3 -3
  7. package/dist/{src → orbcharts-plugins-basic/src}/base/BaseLines.d.ts +3 -3
  8. package/dist/{src/base/BaseBarStack.d.ts → orbcharts-plugins-basic/src/base/BaseStackedBar.d.ts} +6 -6
  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 +4 -4
  11. package/dist/{src → orbcharts-plugins-basic/src}/grid/gridObservables.d.ts +5 -5
  12. package/dist/{src → orbcharts-plugins-basic/src}/grid/index.d.ts +2 -2
  13. package/dist/orbcharts-plugins-basic/src/grid/plugins/StackedBar.d.ts +1 -0
  14. package/dist/orbcharts-plugins-basic/src/grid/plugins/StackedValueAxis.d.ts +1 -0
  15. package/dist/orbcharts-plugins-basic/src/index.d.ts +7 -0
  16. package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/defaults.d.ts +4 -4
  17. package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/index.d.ts +3 -3
  18. package/dist/orbcharts-plugins-basic/src/multiGrid/plugins/MultiStackedBar.d.ts +1 -0
  19. package/dist/orbcharts-plugins-basic/src/multiGrid/plugins/MultiStackedValueAxis.d.ts +1 -0
  20. package/dist/orbcharts-plugins-basic/src/multiGrid/plugins/OverlappingStackedValueAxes.d.ts +1 -0
  21. package/dist/orbcharts-plugins-basic/src/multiValue/defaults.d.ts +9 -0
  22. package/dist/orbcharts-plugins-basic/src/multiValue/index.d.ts +8 -0
  23. package/dist/orbcharts-plugins-basic/src/multiValue/multiValueObservables.d.ts +33 -0
  24. package/dist/orbcharts-plugins-basic/src/multiValue/plugins/MultiValueLegend.d.ts +1 -0
  25. package/dist/orbcharts-plugins-basic/src/multiValue/plugins/MultiValueTooltip.d.ts +1 -0
  26. package/dist/orbcharts-plugins-basic/src/multiValue/plugins/Scatter.d.ts +3 -0
  27. package/dist/orbcharts-plugins-basic/src/multiValue/plugins/ScatterBubbles.d.ts +3 -0
  28. package/dist/orbcharts-plugins-basic/src/multiValue/plugins/XYAux.d.ts +3 -0
  29. package/dist/orbcharts-plugins-basic/src/multiValue/plugins/XYAxes.d.ts +3 -0
  30. package/dist/orbcharts-plugins-basic/src/multiValue/plugins/XYZoom.d.ts +1 -0
  31. package/dist/orbcharts-plugins-basic/src/relationship/defaults.d.ts +6 -0
  32. package/dist/orbcharts-plugins-basic/src/relationship/index.d.ts +5 -0
  33. package/dist/orbcharts-plugins-basic/src/relationship/plugins/ForceDirected.d.ts +3 -0
  34. package/dist/orbcharts-plugins-basic/src/relationship/plugins/ForceDirectedBubbles.d.ts +3 -0
  35. package/dist/orbcharts-plugins-basic/src/relationship/plugins/RelationshipLegend.d.ts +1 -0
  36. package/dist/orbcharts-plugins-basic/src/relationship/plugins/RelationshipTooltip.d.ts +1 -0
  37. package/dist/orbcharts-plugins-basic/src/relationship/relationshipObservables.d.ts +1 -0
  38. package/dist/{src → orbcharts-plugins-basic/src}/series/seriesObservables.d.ts +3 -3
  39. package/dist/{src → orbcharts-plugins-basic/src}/utils/commonUtils.d.ts +1 -1
  40. package/dist/{src → orbcharts-plugins-basic/src}/utils/d3Utils.d.ts +2 -2
  41. package/dist/{src → orbcharts-plugins-basic/src}/utils/observables.d.ts +1 -1
  42. package/dist/{src → orbcharts-plugins-basic/src}/utils/orbchartsUtils.d.ts +3 -3
  43. package/dist/orbcharts-plugins-basic.es.js +13327 -10361
  44. package/dist/orbcharts-plugins-basic.umd.js +99 -49
  45. package/dist/src/index.d.ts +1 -5
  46. package/package.json +4 -4
  47. package/src/base/BaseBars.ts +5 -5
  48. package/src/base/BaseBarsTriangle.ts +6 -4
  49. package/src/base/BaseDots.ts +3 -54
  50. package/src/base/BaseGroupAxis.ts +50 -50
  51. package/src/base/BaseLegend.ts +25 -21
  52. package/src/base/BaseLineAreas.ts +4 -4
  53. package/src/base/BaseLines.ts +3 -3
  54. package/src/base/{BaseBarStack.ts → BaseStackedBar.ts} +22 -20
  55. package/src/base/BaseTooltip.ts +5 -2
  56. package/src/base/BaseValueAxis.ts +84 -81
  57. package/src/grid/defaults.ts +15 -13
  58. package/src/grid/gridObservables.ts +56 -47
  59. package/src/grid/index.ts +2 -2
  60. package/src/grid/plugins/GridLegend.ts +2 -2
  61. package/src/grid/plugins/GridZoom.ts +20 -20
  62. package/src/grid/plugins/GroupAux.ts +216 -211
  63. package/src/grid/plugins/{BarStack.ts → StackedBar.ts} +7 -7
  64. package/src/grid/plugins/{ValueStackAxis.ts → StackedValueAxis.ts} +6 -5
  65. package/src/grid/plugins/ValueAxis.ts +1 -0
  66. package/src/index.ts +2 -5
  67. package/src/multiGrid/defaults.ts +11 -11
  68. package/src/multiGrid/index.ts +3 -3
  69. package/src/multiGrid/plugins/MultiBars.ts +1 -1
  70. package/src/multiGrid/plugins/MultiBarsTriangle.ts +1 -1
  71. package/src/multiGrid/plugins/MultiGridLegend.ts +2 -2
  72. package/src/multiGrid/plugins/MultiGroupAxis.ts +1 -1
  73. package/src/multiGrid/plugins/{MultiBarStack.ts → MultiStackedBar.ts} +8 -8
  74. package/src/multiGrid/plugins/{MultiValueStackAxis.ts → MultiStackedValueAxis.ts} +4 -3
  75. package/src/multiGrid/plugins/MultiValueAxis.ts +2 -1
  76. package/src/multiGrid/plugins/{OverlappingValueStackAxes.ts → OverlappingStackedValueAxes.ts} +9 -8
  77. package/src/multiGrid/plugins/OverlappingValueAxes.ts +4 -3
  78. package/src/multiValue/defaults.ts +167 -0
  79. package/src/multiValue/index.ts +9 -0
  80. package/src/multiValue/multiValueObservables.ts +297 -0
  81. package/src/multiValue/plugins/MultiValueLegend.ts +107 -0
  82. package/src/multiValue/plugins/MultiValueTooltip.ts +66 -0
  83. package/src/multiValue/plugins/Scatter.ts +426 -0
  84. package/src/multiValue/plugins/ScatterBubbles.ts +554 -0
  85. package/src/multiValue/plugins/XYAux.ts +682 -0
  86. package/src/multiValue/plugins/XYAxes.ts +685 -0
  87. package/src/multiValue/plugins/XYZoom.ts +300 -0
  88. package/src/noneData/plugins/Container.ts +23 -23
  89. package/src/noneData/plugins/Tooltip.ts +365 -365
  90. package/src/relationship/defaults.ts +197 -0
  91. package/src/relationship/index.ts +5 -0
  92. package/src/relationship/plugins/ForceDirected.ts +1169 -0
  93. package/src/relationship/plugins/ForceDirectedBubbles.ts +1394 -0
  94. package/src/relationship/plugins/RelationshipLegend.ts +100 -0
  95. package/src/relationship/plugins/RelationshipTooltip.ts +66 -0
  96. package/src/relationship/relationshipObservables.ts +50 -0
  97. package/src/series/defaults.ts +13 -12
  98. package/src/series/plugins/Bubbles.ts +22 -22
  99. package/src/series/plugins/Pie.ts +2 -2
  100. package/src/series/plugins/PieEventTexts.ts +22 -21
  101. package/src/series/plugins/PieLabels.ts +2 -2
  102. package/src/series/plugins/Rose.ts +2 -2
  103. package/src/series/plugins/RoseLabels.ts +2 -2
  104. package/src/series/plugins/SeriesLegend.ts +4 -4
  105. package/src/series/seriesObservables.ts +3 -3
  106. package/src/tree/defaults.ts +3 -3
  107. package/src/tree/plugins/TreeLegend.ts +3 -10
  108. package/src/utils/commonUtils.ts +5 -5
  109. package/src/utils/d3Utils.ts +4 -3
  110. package/src/utils/observables.ts +2 -2
  111. package/src/utils/orbchartsUtils.ts +28 -12
  112. package/dist/src/grid/plugins/BarStack.d.ts +0 -1
  113. package/dist/src/grid/plugins/ValueStackAxis.d.ts +0 -1
  114. package/dist/src/multiGrid/plugins/MultiBarStack.d.ts +0 -1
  115. package/dist/src/multiGrid/plugins/MultiValueStackAxis.d.ts +0 -1
  116. package/dist/src/multiGrid/plugins/OverlappingValueStackAxes.d.ts +0 -1
  117. package/dist/src/multiValue/plugins/Scatter.d.ts +0 -0
  118. package/dist/src/multiValue/plugins/ScatterAxes.d.ts +0 -0
  119. package/dist/src/noneData/plugins/Container.d.ts +0 -1
  120. package/dist/src/noneData/plugins/Tooltip.d.ts +0 -3
  121. package/dist/src/relationship/index.d.ts +0 -0
  122. package/dist/src/relationship/plugins/Relationship.d.ts +0 -0
  123. package/src/base/BaseGroupArea.ts +0 -0
  124. package/src/multiValue/plugins/ScatterAxes.ts +0 -0
  125. package/src/relationship/plugins/Relationship.ts +0 -0
  126. /package/dist/{lib → orbcharts-plugins-basic/lib}/core-types.d.ts +0 -0
  127. /package/dist/{lib → orbcharts-plugins-basic/lib}/core.d.ts +0 -0
  128. /package/dist/{lib → orbcharts-plugins-basic/lib}/plugins-basic-types.d.ts +0 -0
  129. /package/dist/{src → orbcharts-plugins-basic/src}/base/BaseTooltip.d.ts +0 -0
  130. /package/dist/{src → orbcharts-plugins-basic/src}/base/types.d.ts +0 -0
  131. /package/dist/{src → orbcharts-plugins-basic/src}/const.d.ts +0 -0
  132. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/Bars.d.ts +0 -0
  133. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/BarsPN.d.ts +0 -0
  134. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/BarsTriangle.d.ts +0 -0
  135. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/Dots.d.ts +0 -0
  136. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/GridLegend.d.ts +0 -0
  137. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/GridTooltip.d.ts +0 -0
  138. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/GridZoom.d.ts +0 -0
  139. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/GroupAux.d.ts +0 -0
  140. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/GroupAxis.d.ts +0 -0
  141. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/LineAreas.d.ts +0 -0
  142. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/Lines.d.ts +0 -0
  143. /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/ValueAxis.d.ts +0 -0
  144. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/multiGridObservables.d.ts +0 -0
  145. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiBars.d.ts +0 -0
  146. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiBarsTriangle.d.ts +0 -0
  147. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiDots.d.ts +0 -0
  148. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiGridLegend.d.ts +0 -0
  149. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiGridTooltip.d.ts +0 -0
  150. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiGroupAxis.d.ts +0 -0
  151. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiLineAreas.d.ts +0 -0
  152. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiLines.d.ts +0 -0
  153. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiValueAxis.d.ts +0 -0
  154. /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/OverlappingValueAxes.d.ts +0 -0
  155. /package/dist/{src/grid → orbcharts-plugins-basic/src/multiValue}/plugins/Ranking.d.ts +0 -0
  156. /package/dist/{src/grid → orbcharts-plugins-basic/src/multiValue}/plugins/RankingAxis.d.ts +0 -0
  157. /package/dist/{src → orbcharts-plugins-basic/src}/noneData/defaults.d.ts +0 -0
  158. /package/dist/{src → orbcharts-plugins-basic/src}/noneData/index.d.ts +0 -0
  159. /package/dist/{src/base/BaseGroupArea.d.ts → orbcharts-plugins-basic/src/noneData/plugins/Container.d.ts} +0 -0
  160. /package/dist/{src/multiValue/index.d.ts → orbcharts-plugins-basic/src/noneData/plugins/Tooltip.d.ts} +0 -0
  161. /package/dist/{src → orbcharts-plugins-basic/src}/series/defaults.d.ts +0 -0
  162. /package/dist/{src → orbcharts-plugins-basic/src}/series/index.d.ts +0 -0
  163. /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/Bubbles.d.ts +0 -0
  164. /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/Pie.d.ts +0 -0
  165. /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/PieEventTexts.d.ts +0 -0
  166. /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/PieLabels.d.ts +0 -0
  167. /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/Rose.d.ts +0 -0
  168. /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/RoseLabels.d.ts +0 -0
  169. /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/SeriesLegend.d.ts +0 -0
  170. /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/SeriesTooltip.d.ts +0 -0
  171. /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/Waffle.d.ts +0 -0
  172. /package/dist/{src → orbcharts-plugins-basic/src}/series/seriesUtils.d.ts +0 -0
  173. /package/dist/{src → orbcharts-plugins-basic/src}/tree/defaults.d.ts +0 -0
  174. /package/dist/{src → orbcharts-plugins-basic/src}/tree/index.d.ts +0 -0
  175. /package/dist/{src → orbcharts-plugins-basic/src}/tree/plugins/TreeLegend.d.ts +0 -0
  176. /package/dist/{src → orbcharts-plugins-basic/src}/tree/plugins/TreeMap.d.ts +0 -0
  177. /package/dist/{src → orbcharts-plugins-basic/src}/tree/plugins/TreeTooltip.d.ts +0 -0
  178. /package/dist/{src → orbcharts-plugins-basic/src}/utils/d3Graphics.d.ts +0 -0
  179. /package/dist/{vite.config.d.ts → orbcharts-plugins-basic/vite.config.d.ts} +0 -0
  180. /package/src/{grid → multiValue}/plugins/Ranking.ts +0 -0
  181. /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()
@@ -171,18 +180,18 @@ export const gridGroupPositionFnObservable = ({ fullDataFormatter$, gridAxesSize
171
180
  // ).subscribe(data => {
172
181
  // const groupMin = 0
173
182
  // const groupMax = data.computedData[0] ? data.computedData[0].length - 1 : 0
174
- // const groupScaleDomainMin = data.dataFormatter.grid.groupAxis.scaleDomain[0] === 'auto'
175
- // ? groupMin - data.dataFormatter.grid.groupAxis.scalePadding
176
- // : data.dataFormatter.grid.groupAxis.scaleDomain[0] as number - data.dataFormatter.grid.groupAxis.scalePadding
177
- // const groupScaleDomainMax = data.dataFormatter.grid.groupAxis.scaleDomain[1] === 'auto'
178
- // ? groupMax + data.dataFormatter.grid.groupAxis.scalePadding
179
- // : data.dataFormatter.grid.groupAxis.scaleDomain[1] as number + data.dataFormatter.grid.groupAxis.scalePadding
183
+ // const groupScaleDomainMin = data.dataFormatter.groupAxis.scaleDomain[0] === 'auto'
184
+ // ? groupMin - data.dataFormatter.groupAxis.scalePadding
185
+ // : data.dataFormatter.groupAxis.scaleDomain[0] as number - data.dataFormatter.groupAxis.scalePadding
186
+ // const groupScaleDomainMax = data.dataFormatter.groupAxis.scaleDomain[1] === 'auto'
187
+ // ? groupMax + data.dataFormatter.groupAxis.scalePadding
188
+ // : data.dataFormatter.groupAxis.scaleDomain[1] as number + data.dataFormatter.groupAxis.scalePadding
180
189
 
181
190
  // // const groupingAmount = data.computedData[0]
182
191
  // // ? data.computedData[0].length
183
192
  // // : 0
184
193
 
185
- // let _labels = data.dataFormatter.grid.seriesDirection === 'row'
194
+ // let _labels = data.dataFormatter.seriesDirection === 'row'
186
195
  // ? (data.computedData[0] ?? []).map(d => d.groupLabel)
187
196
  // : data.computedData.map(d => d[0].groupLabel)
188
197
 
@@ -209,13 +218,13 @@ export const gridGroupPositionFnObservable = ({ fullDataFormatter$, gridAxesSize
209
218
  map(data => {
210
219
  const groupMin = 0
211
220
  const groupMax = data.computedData[0] ? data.computedData[0].length - 1 : 0
212
- // const groupScaleDomainMin = data.fullDataFormatter.grid.groupAxis.scaleDomain[0] === 'auto'
213
- // ? groupMin - data.fullDataFormatter.grid.groupAxis.scalePadding
214
- // : data.fullDataFormatter.grid.groupAxis.scaleDomain[0] as number - data.fullDataFormatter.grid.groupAxis.scalePadding
215
- const groupScaleDomainMin = data.fullDataFormatter.grid.groupAxis.scaleDomain[0] - data.fullDataFormatter.grid.groupAxis.scalePadding
216
- const groupScaleDomainMax = data.fullDataFormatter.grid.groupAxis.scaleDomain[1] === 'max'
217
- ? groupMax + data.fullDataFormatter.grid.groupAxis.scalePadding
218
- : data.fullDataFormatter.grid.groupAxis.scaleDomain[1] as number + data.fullDataFormatter.grid.groupAxis.scalePadding
221
+ // const groupScaleDomainMin = data.fullDataFormatter.groupAxis.scaleDomain[0] === 'auto'
222
+ // ? groupMin - data.fullDataFormatter.groupAxis.scalePadding
223
+ // : data.fullDataFormatter.groupAxis.scaleDomain[0] as number - data.fullDataFormatter.groupAxis.scalePadding
224
+ const groupScaleDomainMin = data.fullDataFormatter.groupAxis.scaleDomain[0] - data.fullDataFormatter.groupAxis.scalePadding
225
+ const groupScaleDomainMax = data.fullDataFormatter.groupAxis.scaleDomain[1] === 'max'
226
+ ? groupMax + data.fullDataFormatter.groupAxis.scalePadding
227
+ : data.fullDataFormatter.groupAxis.scaleDomain[1] as number + data.fullDataFormatter.groupAxis.scalePadding
219
228
 
220
229
  return [groupScaleDomainMin, groupScaleDomainMax]
221
230
  }),
@@ -228,7 +237,7 @@ export const gridGroupPositionFnObservable = ({ fullDataFormatter$, gridAxesSize
228
237
  }).pipe(
229
238
  switchMap(async d => d),
230
239
  map(data => {
231
- return data.fullDataFormatter.grid.seriesDirection === 'row'
240
+ return data.fullDataFormatter.seriesDirection === 'row'
232
241
  ? (data.computedData[0] ?? []).map(d => d.groupLabel)
233
242
  : data.computedData.map(d => d[0].groupLabel)
234
243
  })
@@ -284,28 +293,28 @@ export const gridGroupPositionFnObservable = ({ fullDataFormatter$, gridAxesSize
284
293
  switchMap(async (d) => d),
285
294
  ).subscribe(data => {
286
295
 
287
- const reverse = data.dataFormatter.grid.valueAxis.position === 'right'
288
- || data.dataFormatter.grid.valueAxis.position === 'bottom'
296
+ const reverse = data.dataFormatter.valueAxis.position === 'right'
297
+ || data.dataFormatter.valueAxis.position === 'bottom'
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
- padding: data.dataFormatter.grid.groupAxis.scalePadding,
304
+ padding: data.dataFormatter.groupAxis.scalePadding,
296
305
  reverse
297
306
  })
298
307
 
299
308
  // 依比例尺位置計算座標
300
309
  const axisValuePredicate = (event: any) => {
301
- return data.dataFormatter.grid.groupAxis.position === 'bottom'
302
- || data.dataFormatter.grid.groupAxis.position === 'top'
310
+ return data.dataFormatter.groupAxis.position === 'bottom'
311
+ || data.dataFormatter.groupAxis.position === 'top'
303
312
  ? event.offsetX - data.fullChartParams.padding.left
304
313
  : event.offsetY - data.fullChartParams.padding.top
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$,
@@ -355,13 +364,13 @@ export const gridGroupPosition = ({ rootSelection, fullDataFormatter$, gridAxesS
355
364
  map(data => {
356
365
  const groupMin = 0
357
366
  const groupMax = data.computedData[0] ? data.computedData[0].length - 1 : 0
358
- // const groupScaleDomainMin = data.fullDataFormatter.grid.groupAxis.scaleDomain[0] === 'auto'
359
- // ? groupMin - data.fullDataFormatter.grid.groupAxis.scalePadding
360
- // : data.fullDataFormatter.grid.groupAxis.scaleDomain[0] as number - data.fullDataFormatter.grid.groupAxis.scalePadding
361
- const groupScaleDomainMin = data.fullDataFormatter.grid.groupAxis.scaleDomain[0] - data.fullDataFormatter.grid.groupAxis.scalePadding
362
- const groupScaleDomainMax = data.fullDataFormatter.grid.groupAxis.scaleDomain[1] === 'max'
363
- ? groupMax + data.fullDataFormatter.grid.groupAxis.scalePadding
364
- : data.fullDataFormatter.grid.groupAxis.scaleDomain[1] as number + data.fullDataFormatter.grid.groupAxis.scalePadding
367
+ // const groupScaleDomainMin = data.fullDataFormatter.groupAxis.scaleDomain[0] === 'auto'
368
+ // ? groupMin - data.fullDataFormatter.groupAxis.scalePadding
369
+ // : data.fullDataFormatter.groupAxis.scaleDomain[0] as number - data.fullDataFormatter.groupAxis.scalePadding
370
+ const groupScaleDomainMin = data.fullDataFormatter.groupAxis.scaleDomain[0] - data.fullDataFormatter.groupAxis.scalePadding
371
+ const groupScaleDomainMax = data.fullDataFormatter.groupAxis.scaleDomain[1] === 'max'
372
+ ? groupMax + data.fullDataFormatter.groupAxis.scalePadding
373
+ : data.fullDataFormatter.groupAxis.scaleDomain[1] as number + data.fullDataFormatter.groupAxis.scalePadding
365
374
 
366
375
  return [groupScaleDomainMin, groupScaleDomainMax]
367
376
  }),
@@ -374,7 +383,7 @@ export const gridGroupPosition = ({ rootSelection, fullDataFormatter$, gridAxesS
374
383
  }).pipe(
375
384
  switchMap(async d => d),
376
385
  map(data => {
377
- return data.fullDataFormatter.grid.seriesDirection === 'row'
386
+ return data.fullDataFormatter.seriesDirection === 'row'
378
387
  ? (data.computedData[0] ?? []).map(d => d.groupLabel)
379
388
  : data.computedData.map(d => d[0].groupLabel)
380
389
  })
@@ -395,7 +404,7 @@ export const gridGroupPosition = ({ rootSelection, fullDataFormatter$, gridAxesS
395
404
 
396
405
  const reverse$ = fullDataFormatter$.pipe(
397
406
  map(d => {
398
- return d.grid.valueAxis.position === 'right' || d.grid.valueAxis.position === 'bottom'
407
+ return d.valueAxis.position === 'right' || d.valueAxis.position === 'bottom'
399
408
  ? true
400
409
  : false
401
410
  })
@@ -410,10 +419,10 @@ 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
- padding: data.fullDataFormatter.grid.groupAxis.scalePadding,
425
+ padding: data.fullDataFormatter.groupAxis.scalePadding,
417
426
  reverse: data.reverse
418
427
  })
419
428
  })
@@ -454,8 +463,8 @@ export const gridGroupPosition = ({ rootSelection, fullDataFormatter$, gridAxesS
454
463
  offsetX: data.rootMousemove.offsetX * data.columnAmount % data.layout.rootWidth,
455
464
  offsetY: data.rootMousemove.offsetY * data.rowAmount % data.layout.rootHeight
456
465
  }
457
- return data.fullDataFormatter.grid.groupAxis.position === 'bottom'
458
- || data.fullDataFormatter.grid.groupAxis.position === 'top'
466
+ return data.fullDataFormatter.groupAxis.position === 'bottom'
467
+ || data.fullDataFormatter.groupAxis.position === 'top'
459
468
  ? eventData.offsetX - data.fullChartParams.padding.left
460
469
  : eventData.offsetY - data.fullChartParams.padding.top
461
470
  })
@@ -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;
package/src/grid/index.ts CHANGED
@@ -4,13 +4,13 @@ export { Lines } from './plugins/Lines'
4
4
  export { LineAreas } from './plugins/LineAreas'
5
5
  export { Bars } from './plugins/Bars'
6
6
  export { BarsPN } from './plugins/BarsPN'
7
- export { BarStack } from './plugins/BarStack'
7
+ export { StackedBar } from './plugins/StackedBar'
8
8
  export { BarsTriangle } from './plugins/BarsTriangle'
9
9
  export { Dots } from './plugins/Dots'
10
10
  export { GridLegend } from './plugins/GridLegend'
11
11
  export { GroupAxis } from './plugins/GroupAxis'
12
12
  export { ValueAxis } from './plugins/ValueAxis'
13
- export { ValueStackAxis } from './plugins/ValueStackAxis'
13
+ export { StackedValueAxis } from './plugins/StackedValueAxis'
14
14
  export { GridTooltip } from './plugins/GridTooltip'
15
15
  export { GridZoom } from './plugins/GridZoom'
16
16
  export { GroupAux } from './plugins/GroupAux'
@@ -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
  )
@@ -76,16 +76,16 @@ export const GridZoom = defineGridPlugin(pluginConfig)(({ selection, rootSelecti
76
76
  // })
77
77
 
78
78
  const initGroupAxis$ = observer.fullDataFormatter$.pipe(
79
- map(d => d.grid.groupAxis),
79
+ map(d => d.groupAxis),
80
80
  // 只用第一次資料來計算scale才不會造成每次變動都受到影響
81
81
  first()
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,10 +153,10 @@ 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
- const zoomedDomain = data.fullDataFormatter.grid.groupAxis.position === 'bottom' || data.fullDataFormatter.grid.groupAxis.position === 'top'
159
+ const zoomedDomain = data.fullDataFormatter.groupAxis.position === 'bottom' || data.fullDataFormatter.groupAxis.position === 'top'
160
160
  ? t.rescaleX(shadowScale)
161
161
  .domain()
162
162
  .map(mapGroupindex)
@@ -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
@@ -193,13 +193,13 @@ export const GridZoom = defineGridPlugin(pluginConfig)(({ selection, rootSelecti
193
193
 
194
194
  const newDataFormatter: DataFormatterGrid = {
195
195
  ...data.fullDataFormatter,
196
- grid: {
197
- ...data.fullDataFormatter.grid,
196
+ // grid: {
197
+ // ...data.fullDataFormatter.grid,
198
198
  groupAxis: {
199
- ...data.fullDataFormatter.grid.groupAxis,
199
+ ...data.fullDataFormatter.groupAxis,
200
200
  scaleDomain: zoomedDomain
201
201
  }
202
- }
202
+ // }
203
203
  }
204
204
  subject.dataFormatter$.next(newDataFormatter)
205
205
  })