@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.
- package/dist/{src → orbcharts-plugins-basic/src}/base/BaseBarStack.d.ts +2 -2
- package/dist/{src → orbcharts-plugins-basic/src}/base/BaseBars.d.ts +2 -2
- package/dist/{src → orbcharts-plugins-basic/src}/base/BaseBarsTriangle.d.ts +2 -2
- package/dist/{src → orbcharts-plugins-basic/src}/base/BaseDots.d.ts +2 -2
- package/dist/{src → orbcharts-plugins-basic/src}/base/BaseGroupAxis.d.ts +2 -2
- package/dist/{src → orbcharts-plugins-basic/src}/base/BaseLegend.d.ts +1 -1
- package/dist/{src → orbcharts-plugins-basic/src}/base/BaseLineAreas.d.ts +3 -3
- package/dist/{src → orbcharts-plugins-basic/src}/base/BaseLines.d.ts +3 -3
- package/dist/{src → orbcharts-plugins-basic/src}/base/BaseValueAxis.d.ts +3 -2
- package/dist/{src → orbcharts-plugins-basic/src}/grid/defaults.d.ts +1 -1
- package/dist/{src → orbcharts-plugins-basic/src}/grid/gridObservables.d.ts +5 -5
- package/dist/orbcharts-plugins-basic/src/index.d.ts +6 -0
- package/dist/orbcharts-plugins-basic/src/multiValue/defaults.d.ts +9 -0
- package/dist/orbcharts-plugins-basic/src/multiValue/index.d.ts +8 -0
- package/dist/orbcharts-plugins-basic/src/multiValue/multiValueObservables.d.ts +33 -0
- package/dist/orbcharts-plugins-basic/src/multiValue/plugins/MultiValueLegend.d.ts +1 -0
- package/dist/orbcharts-plugins-basic/src/multiValue/plugins/MultiValueTooltip.d.ts +1 -0
- package/dist/orbcharts-plugins-basic/src/multiValue/plugins/Scatter.d.ts +3 -0
- package/dist/orbcharts-plugins-basic/src/multiValue/plugins/ScatterBubbles.d.ts +3 -0
- package/dist/orbcharts-plugins-basic/src/multiValue/plugins/XYAux.d.ts +3 -0
- package/dist/orbcharts-plugins-basic/src/multiValue/plugins/XYAxes.d.ts +3 -0
- package/dist/orbcharts-plugins-basic/src/multiValue/plugins/XYZoom.d.ts +1 -0
- package/dist/{src → orbcharts-plugins-basic/src}/series/seriesObservables.d.ts +3 -3
- package/dist/{src → orbcharts-plugins-basic/src}/utils/observables.d.ts +1 -1
- package/dist/{src → orbcharts-plugins-basic/src}/utils/orbchartsUtils.d.ts +3 -3
- package/dist/orbcharts-plugins-basic.es.js +11809 -10185
- package/dist/orbcharts-plugins-basic.umd.js +66 -34
- package/dist/src/index.d.ts +1 -5
- package/package.json +4 -4
- package/src/base/BaseBarStack.ts +2 -2
- package/src/base/BaseBars.ts +2 -2
- package/src/base/BaseBarsTriangle.ts +2 -2
- package/src/base/BaseDots.ts +2 -53
- package/src/base/BaseGroupAxis.ts +3 -3
- package/src/base/BaseLegend.ts +21 -17
- package/src/base/BaseLineAreas.ts +3 -3
- package/src/base/BaseLines.ts +3 -3
- package/src/base/BaseValueAxis.ts +46 -43
- package/src/grid/defaults.ts +3 -3
- package/src/grid/gridObservables.ts +24 -15
- package/src/grid/plugins/GridLegend.ts +2 -2
- package/src/grid/plugins/GridZoom.ts +14 -14
- package/src/grid/plugins/GroupAux.ts +206 -201
- package/src/grid/plugins/ValueAxis.ts +1 -0
- package/src/grid/plugins/ValueStackAxis.ts +1 -0
- package/src/index.ts +1 -0
- package/src/multiGrid/plugins/MultiGridLegend.ts +2 -2
- package/src/multiGrid/plugins/MultiValueAxis.ts +1 -0
- package/src/multiGrid/plugins/MultiValueStackAxis.ts +1 -0
- package/src/multiGrid/plugins/OverlappingValueAxes.ts +1 -0
- package/src/multiGrid/plugins/OverlappingValueStackAxes.ts +1 -0
- package/src/multiValue/defaults.ts +163 -0
- package/src/multiValue/index.ts +9 -0
- package/src/multiValue/multiValueObservables.ts +258 -0
- package/src/multiValue/plugins/MultiValueLegend.ts +107 -0
- package/src/multiValue/plugins/MultiValueTooltip.ts +66 -0
- package/src/multiValue/plugins/Scatter.ts +426 -0
- package/src/multiValue/plugins/ScatterBubbles.ts +551 -0
- package/src/multiValue/plugins/XYAux.ts +682 -0
- package/src/multiValue/plugins/XYAxes.ts +677 -0
- package/src/multiValue/plugins/XYZoom.ts +300 -0
- package/src/series/plugins/Bubbles.ts +4 -4
- package/src/series/plugins/Pie.ts +2 -2
- package/src/series/plugins/PieEventTexts.ts +2 -2
- package/src/series/plugins/PieLabels.ts +2 -2
- package/src/series/plugins/Rose.ts +2 -2
- package/src/series/plugins/RoseLabels.ts +2 -2
- package/src/series/plugins/SeriesLegend.ts +4 -4
- package/src/series/seriesObservables.ts +3 -3
- package/src/tree/plugins/TreeLegend.ts +3 -10
- package/src/utils/d3Utils.ts +2 -1
- package/src/utils/observables.ts +2 -2
- package/src/utils/orbchartsUtils.ts +7 -6
- package/dist/src/base/BaseGroupArea.d.ts +0 -0
- package/dist/src/multiValue/plugins/Scatter.d.ts +0 -0
- package/dist/src/multiValue/plugins/ScatterAxes.d.ts +0 -0
- package/dist/src/relationship/index.d.ts +0 -0
- package/src/base/BaseGroupArea.ts +0 -0
- package/src/multiValue/plugins/ScatterAxes.ts +0 -0
- /package/dist/{lib → orbcharts-plugins-basic/lib}/core-types.d.ts +0 -0
- /package/dist/{lib → orbcharts-plugins-basic/lib}/core.d.ts +0 -0
- /package/dist/{lib → orbcharts-plugins-basic/lib}/plugins-basic-types.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/base/BaseTooltip.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/base/types.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/const.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/grid/index.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/BarStack.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/Bars.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/BarsPN.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/BarsTriangle.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/Dots.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/GridLegend.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/GridTooltip.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/GridZoom.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/GroupAux.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/GroupAxis.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/LineAreas.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/Lines.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/ValueAxis.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/grid/plugins/ValueStackAxis.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/defaults.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/index.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/multiGridObservables.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiBarStack.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiBars.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiBarsTriangle.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiDots.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiGridLegend.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiGridTooltip.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiGroupAxis.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiLineAreas.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiLines.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiValueAxis.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/MultiValueStackAxis.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/OverlappingValueAxes.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/multiGrid/plugins/OverlappingValueStackAxes.d.ts +0 -0
- /package/dist/{src/grid → orbcharts-plugins-basic/src/multiValue}/plugins/Ranking.d.ts +0 -0
- /package/dist/{src/grid → orbcharts-plugins-basic/src/multiValue}/plugins/RankingAxis.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/noneData/defaults.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/noneData/index.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/noneData/plugins/Container.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/noneData/plugins/Tooltip.d.ts +0 -0
- /package/dist/{src/multiValue → orbcharts-plugins-basic/src/relationship}/index.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/relationship/plugins/Relationship.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/series/defaults.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/series/index.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/Bubbles.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/Pie.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/PieEventTexts.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/PieLabels.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/Rose.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/RoseLabels.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/SeriesLegend.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/SeriesTooltip.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/series/plugins/Waffle.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/series/seriesUtils.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/tree/defaults.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/tree/index.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/tree/plugins/TreeLegend.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/tree/plugins/TreeMap.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/tree/plugins/TreeTooltip.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/utils/commonUtils.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/utils/d3Graphics.d.ts +0 -0
- /package/dist/{src → orbcharts-plugins-basic/src}/utils/d3Utils.d.ts +0 -0
- /package/dist/{vite.config.d.ts → orbcharts-plugins-basic/vite.config.d.ts} +0 -0
- /package/src/{grid → multiValue}/plugins/Ranking.ts +0 -0
- /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
|
-
|
22
|
+
ContainerPositionScaled,
|
23
23
|
Layout } from '../../lib/core-types'
|
24
|
-
import {
|
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<
|
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((
|
48
|
+
map((seriesLabels, i) => {
|
45
49
|
return selection
|
46
50
|
.selectAll<SVGGElement, string>(`g.${seriesClassName}`)
|
47
|
-
.data(
|
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<
|
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 =
|
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:
|
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
|
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<
|
353
|
+
gridContainerPosition$: Observable<ContainerPositionScaled[]>
|
345
354
|
layout$: Observable<Layout>
|
346
355
|
}) => {
|
347
|
-
const rootMousemove
|
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
|
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<
|
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,
|
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
|
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
|
85
|
+
const initGroupScale$ = combineLatest({
|
86
86
|
initGroupAxis: initGroupAxis$,
|
87
|
-
fullDataFormatter: observer.fullDataFormatter$,
|
88
|
-
|
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.
|
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> =
|
102
|
-
maxValue: data.
|
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
|
-
|
114
|
+
initGroupScale: initGroupScale$,
|
115
115
|
// initGroupAxis: initGroupAxis$,
|
116
116
|
// fullDataFormatter: fullDataFormatter$.pipe(first()), // 只用第一次資料來計算scale才不會造成每次變動都受到影響
|
117
117
|
fullDataFormatter: observer.fullDataFormatter$,
|
118
|
-
|
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
|
125
|
+
const groupMinIndex = 0
|
126
126
|
|
127
|
-
const shadowScale = data.
|
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.
|
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] <=
|
169
|
+
if (zoomedDomain[0] <= groupMinIndex && zoomedDomain[1] >= data.groupMaxIndex) {
|
170
170
|
// 繼續縮小
|
171
171
|
if (t.k < lastTransform.k) {
|
172
172
|
// 維持前一次的transform
|