@orbcharts/plugins-basic 3.0.0-alpha.34 → 3.0.0-alpha.35
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/orbcharts-plugins-basic.es.js +10198 -9511
- package/dist/orbcharts-plugins-basic.umd.js +10 -10
- package/dist/src/base/BaseBarStack.d.ts +5 -1
- package/dist/src/base/BaseBars.d.ts +5 -1
- package/dist/src/base/BaseBarsTriangle.d.ts +5 -1
- package/dist/src/base/BaseDots.d.ts +4 -1
- package/dist/src/base/BaseGroupAxis.d.ts +35 -0
- package/dist/src/base/BaseLines.d.ts +3 -1
- package/dist/src/base/BaseValueAxis.d.ts +36 -0
- package/dist/src/grid/defaults.d.ts +3 -3
- package/dist/src/grid/gridObservables.d.ts +18 -4
- package/dist/src/grid/index.d.ts +1 -1
- package/dist/src/grid/plugins/GroupAux.d.ts +3 -0
- package/dist/src/grid/plugins/GroupAxis.d.ts +1 -3
- package/dist/src/grid/plugins/ValueAxis.d.ts +1 -3
- package/dist/src/grid/plugins/ValueStackAxis.d.ts +1 -3
- package/dist/src/grid/types.d.ts +1 -1
- package/dist/src/multiGrid/defaults.d.ts +9 -2
- package/dist/src/multiGrid/index.d.ts +8 -1
- package/dist/src/multiGrid/multiGridObservables.d.ts +12 -0
- package/dist/src/multiGrid/plugins/MultiBarStack.d.ts +1 -0
- package/dist/src/multiGrid/plugins/MultiBars.d.ts +1 -0
- package/dist/src/multiGrid/plugins/MultiBarsTriangle.d.ts +1 -0
- package/dist/src/multiGrid/plugins/MultiDots.d.ts +1 -0
- package/dist/src/multiGrid/plugins/MultiGroupAxis.d.ts +1 -0
- package/dist/src/multiGrid/plugins/MultiLines.d.ts +1 -0
- package/dist/src/multiGrid/plugins/MultiValueAxis.d.ts +1 -0
- package/dist/src/multiGrid/plugins/OverlappingValueAxes.d.ts +1 -0
- package/dist/src/multiGrid/types.d.ts +31 -0
- package/package.json +2 -2
- package/src/base/BaseBarStack.ts +375 -198
- package/src/base/BaseBars.ts +297 -191
- package/src/base/BaseBarsTriangle.ts +344 -229
- package/src/base/BaseDots.ts +285 -117
- package/src/base/BaseGroupAxis.ts +497 -0
- package/src/base/BaseLines.ts +180 -50
- package/src/base/BaseValueAxis.ts +475 -0
- package/src/grid/defaults.ts +3 -3
- package/src/grid/gridObservables.ts +147 -14
- package/src/grid/index.ts +1 -1
- package/src/grid/plugins/BarStack.ts +4 -0
- package/src/grid/plugins/Bars.ts +4 -0
- package/src/grid/plugins/BarsTriangle.ts +4 -0
- package/src/grid/plugins/Dots.ts +3 -0
- package/src/grid/plugins/{GroupArea.ts → GroupAux.ts} +24 -24
- package/src/grid/plugins/GroupAxis.ts +16 -348
- package/src/grid/plugins/Lines.ts +2 -0
- package/src/grid/plugins/ScalingArea.ts +9 -6
- package/src/grid/plugins/ValueAxis.ts +13 -337
- package/src/grid/plugins/ValueStackAxis.ts +35 -336
- package/src/grid/types.ts +1 -1
- package/src/index.ts +1 -0
- package/src/multiGrid/defaults.ts +120 -14
- package/src/multiGrid/index.ts +9 -2
- package/src/multiGrid/multiGridObservables.ts +279 -0
- package/src/multiGrid/plugins/MultiBarStack.ts +60 -0
- package/src/multiGrid/plugins/MultiBars.ts +59 -0
- package/src/multiGrid/plugins/MultiBarsTriangle.ts +58 -0
- package/src/multiGrid/plugins/MultiDots.ts +58 -0
- package/src/multiGrid/plugins/MultiGridLegend.ts +2 -7
- package/src/multiGrid/plugins/MultiGroupAxis.ts +53 -0
- package/src/multiGrid/plugins/MultiLines.ts +58 -0
- package/src/multiGrid/plugins/MultiValueAxis.ts +53 -0
- package/src/multiGrid/plugins/OverlappingValueAxes.ts +165 -0
- package/src/multiGrid/types.ts +39 -0
- package/tsconfig.dev.json +17 -0
- package/tsconfig.prod.json +14 -0
- package/vite.config.js +5 -0
- package/dist/src/grid/plugins/GroupArea.d.ts +0 -3
- package/dist/src/multiGrid/plugins/BarsAndLines.d.ts +0 -1
- package/dist/src/multiGrid/plugins/FirstGroupScaleAxis.d.ts +0 -0
- package/dist/src/multiGrid/plugins/TwoValueScaleAxes.d.ts +0 -0
- package/src/multiGrid/plugins/BarStackAndLines.ts +0 -0
- package/src/multiGrid/plugins/BarsAndLines.ts +0 -126
- package/src/multiGrid/plugins/BarsTriangleAndLines.ts +0 -0
- package/src/multiGrid/plugins/FirstGroupScaleAxis.ts +0 -0
- package/src/multiGrid/plugins/TwoValueScaleAxes.ts +0 -0
- /package/dist/src/{multiGrid/plugins/BarStackAndLines.d.ts → base/BaseGroupArea.d.ts} +0 -0
- /package/{dist/src/multiGrid/plugins/BarsTriangleAndLines.d.ts → src/base/BaseGroupArea.ts} +0 -0
package/src/base/BaseDots.ts
CHANGED
@@ -13,11 +13,12 @@ import type {
|
|
13
13
|
ComputedDataGrid,
|
14
14
|
EventGrid,
|
15
15
|
ChartParams,
|
16
|
+
ContainerPosition,
|
16
17
|
Layout,
|
17
18
|
TransformData,
|
18
19
|
ColorType } from '@orbcharts/core'
|
19
|
-
import { getD3TransitionEase } from '../utils/d3Utils'
|
20
20
|
import { getDatumColor, getClassName, getUniID } from '../utils/orbchartsUtils'
|
21
|
+
import { gridSelectionsObservable } from '../grid/gridObservables'
|
21
22
|
|
22
23
|
export interface BaseDotsParams {
|
23
24
|
radius: number
|
@@ -31,17 +32,20 @@ interface BaseDotsContext {
|
|
31
32
|
selection: d3.Selection<any, unknown, any, unknown>
|
32
33
|
computedData$: Observable<ComputedDataGrid>
|
33
34
|
visibleComputedData$: Observable<ComputedDatumGrid[][]>
|
35
|
+
existedSeriesLabels$: Observable<string[]>
|
34
36
|
SeriesDataMap$: Observable<Map<string, ComputedDatumGrid[]>>
|
35
37
|
GroupDataMap$: Observable<Map<string, ComputedDatumGrid[]>>
|
36
38
|
fullParams$: Observable<BaseDotsParams>
|
37
39
|
fullChartParams$: Observable<ChartParams>
|
38
40
|
gridAxesTransform$: Observable<TransformData>
|
39
41
|
gridGraphicTransform$: Observable<TransformData>
|
42
|
+
gridGraphicReverseScale$: Observable<[number, number][]>
|
40
43
|
gridAxesSize$: Observable<{
|
41
44
|
width: number;
|
42
45
|
height: number;
|
43
46
|
}>
|
44
47
|
gridHighlight$: Observable<string[]>
|
48
|
+
gridContainer$: Observable<ContainerPosition[]>
|
45
49
|
event$: Subject<EventGrid>
|
46
50
|
}
|
47
51
|
|
@@ -54,16 +58,18 @@ type ClipPathDatum = {
|
|
54
58
|
height: number;
|
55
59
|
}
|
56
60
|
|
57
|
-
const pluginName = 'Dots'
|
58
|
-
const
|
59
|
-
const circleClassName = getClassName(pluginName, 'circle')
|
61
|
+
// const pluginName = 'Dots'
|
62
|
+
// const circleGClassName = getClassName(pluginName, 'circleG')
|
63
|
+
// const circleClassName = getClassName(pluginName, 'circle')
|
60
64
|
|
61
|
-
function renderDots ({
|
62
|
-
|
63
|
-
|
65
|
+
function renderDots ({ graphicGSelection, circleGClassName, circleClassName, data, fullParams, fullChartParams, graphicReverseScale }: {
|
66
|
+
graphicGSelection: d3.Selection<SVGGElement, any, any, any>
|
67
|
+
circleGClassName: string
|
68
|
+
circleClassName: string
|
69
|
+
data: ComputedDatumGrid[][]
|
64
70
|
fullParams: BaseDotsParams
|
65
71
|
fullChartParams: ChartParams
|
66
|
-
|
72
|
+
graphicReverseScale: [number, number][]
|
67
73
|
}) {
|
68
74
|
const createEnterDuration = (enter: d3.Selection<d3.EnterElement, ComputedDatumGrid, SVGGElement, any>) => {
|
69
75
|
const enterSize = enter.size()
|
@@ -72,59 +78,115 @@ function renderDots ({ selection, data, fullParams, fullChartParams, graphicOppo
|
|
72
78
|
}
|
73
79
|
// enterDuration
|
74
80
|
let enterDuration = 0
|
75
|
-
|
76
|
-
const dots = selection
|
77
|
-
.selectAll<SVGGElement, ComputedDatumGrid>('g')
|
78
|
-
.data(data, d => d.id)
|
79
|
-
.join(
|
80
|
-
enter => {
|
81
|
-
// enterDuration
|
82
|
-
enterDuration = createEnterDuration(enter)
|
83
81
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
exit => exit.remove()
|
90
|
-
)
|
91
|
-
.attr('transform', d => `translate(${d.axisX}, ${d.axisY})`)
|
92
|
-
.each((d, i, g) => {
|
93
|
-
const circle = d3.select(g[i])
|
94
|
-
.selectAll('circle')
|
95
|
-
.data([d])
|
82
|
+
graphicGSelection
|
83
|
+
.each((seriesData, seriesIndex, g) => {
|
84
|
+
d3.select(g[seriesIndex])
|
85
|
+
.selectAll<SVGGElement, ComputedDatumGrid>('g')
|
86
|
+
.data(data[seriesIndex], d => d.id)
|
96
87
|
.join(
|
97
88
|
enter => {
|
89
|
+
// enterDuration
|
90
|
+
enterDuration = createEnterDuration(enter)
|
91
|
+
|
98
92
|
return enter
|
99
|
-
.append('
|
100
|
-
.
|
101
|
-
.style('vector-effect', 'non-scaling-stroke')
|
102
|
-
.classed(circleClassName, true)
|
103
|
-
.attr('opacity', 0)
|
104
|
-
.transition()
|
105
|
-
.delay((_d, _i) => {
|
106
|
-
return i * enterDuration
|
107
|
-
})
|
108
|
-
.attr('opacity', 1)
|
109
|
-
},
|
110
|
-
update => {
|
111
|
-
return update
|
112
|
-
.transition()
|
113
|
-
.duration(50)
|
114
|
-
// .attr('cx', d => d.axisX)
|
115
|
-
// .attr('cy', d => d.axisY)
|
116
|
-
.attr('opacity', 1)
|
93
|
+
.append('g')
|
94
|
+
.classed(circleGClassName, true)
|
117
95
|
},
|
96
|
+
update => update,
|
118
97
|
exit => exit.remove()
|
119
98
|
)
|
120
|
-
.attr('
|
121
|
-
.
|
122
|
-
|
123
|
-
|
124
|
-
|
99
|
+
.attr('transform', d => `translate(${d.axisX}, ${d.axisY})`)
|
100
|
+
.each((d, i, g) => {
|
101
|
+
const circle = d3.select(g[i])
|
102
|
+
.selectAll('circle')
|
103
|
+
.data([d])
|
104
|
+
.join(
|
105
|
+
enter => {
|
106
|
+
return enter
|
107
|
+
.append('circle')
|
108
|
+
.style('cursor', 'pointer')
|
109
|
+
.style('vector-effect', 'non-scaling-stroke')
|
110
|
+
.classed(circleClassName, true)
|
111
|
+
.attr('opacity', 0)
|
112
|
+
.transition()
|
113
|
+
.delay((_d, _i) => {
|
114
|
+
return i * enterDuration
|
115
|
+
})
|
116
|
+
.attr('opacity', 1)
|
117
|
+
},
|
118
|
+
update => {
|
119
|
+
return update
|
120
|
+
.transition()
|
121
|
+
.duration(50)
|
122
|
+
// .attr('cx', d => d.axisX)
|
123
|
+
// .attr('cy', d => d.axisY)
|
124
|
+
.attr('opacity', 1)
|
125
|
+
},
|
126
|
+
exit => exit.remove()
|
127
|
+
)
|
128
|
+
.attr('r', fullParams.radius)
|
129
|
+
.attr('fill', (d, i) => getDatumColor({ datum: d, colorType: fullParams.fillColorType, fullChartParams }))
|
130
|
+
.attr('stroke', (d, i) => getDatumColor({ datum: d, colorType: fullParams.strokeColorType, fullChartParams }))
|
131
|
+
.attr('stroke-width', fullParams.strokeWidth)
|
132
|
+
.attr('transform', `scale(${graphicReverseScale[seriesIndex][0] ?? 1}, ${graphicReverseScale[seriesIndex][1] ?? 1})`)
|
133
|
+
})
|
125
134
|
})
|
135
|
+
|
136
|
+
// const dots = graphicGSelection
|
137
|
+
// .selectAll<SVGGElement, ComputedDatumGrid>('g')
|
138
|
+
// .data(data, d => d.id)
|
139
|
+
// .join(
|
140
|
+
// enter => {
|
141
|
+
// // enterDuration
|
142
|
+
// enterDuration = createEnterDuration(enter)
|
143
|
+
|
144
|
+
// return enter
|
145
|
+
// .append('g')
|
146
|
+
// .classed(circleGClassName, true)
|
147
|
+
// },
|
148
|
+
// update => update,
|
149
|
+
// exit => exit.remove()
|
150
|
+
// )
|
151
|
+
// .attr('transform', d => `translate(${d.axisX}, ${d.axisY})`)
|
152
|
+
// .each((d, i, g) => {
|
153
|
+
// const circle = d3.select(g[i])
|
154
|
+
// .selectAll('circle')
|
155
|
+
// .data([d])
|
156
|
+
// .join(
|
157
|
+
// enter => {
|
158
|
+
// return enter
|
159
|
+
// .append('circle')
|
160
|
+
// .style('cursor', 'pointer')
|
161
|
+
// .style('vector-effect', 'non-scaling-stroke')
|
162
|
+
// .classed(circleClassName, true)
|
163
|
+
// .attr('opacity', 0)
|
164
|
+
// .transition()
|
165
|
+
// .delay((_d, _i) => {
|
166
|
+
// return i * enterDuration
|
167
|
+
// })
|
168
|
+
// .attr('opacity', 1)
|
169
|
+
// },
|
170
|
+
// update => {
|
171
|
+
// return update
|
172
|
+
// .transition()
|
173
|
+
// .duration(50)
|
174
|
+
// // .attr('cx', d => d.axisX)
|
175
|
+
// // .attr('cy', d => d.axisY)
|
176
|
+
// .attr('opacity', 1)
|
177
|
+
// },
|
178
|
+
// exit => exit.remove()
|
179
|
+
// )
|
180
|
+
// .attr('r', fullParams.radius)
|
181
|
+
// .attr('fill', (d, i) => getDatumColor({ datum: d, colorType: fullParams.fillColorType, fullChartParams }))
|
182
|
+
// .attr('stroke', (d, i) => getDatumColor({ datum: d, colorType: fullParams.strokeColorType, fullChartParams }))
|
183
|
+
// .attr('stroke-width', fullParams.strokeWidth)
|
184
|
+
// .attr('transform', `scale(${graphicReverseScale[0]}, ${graphicReverseScale[1]})`)
|
185
|
+
// })
|
186
|
+
|
187
|
+
const graphicCircleSelection: d3.Selection<SVGRectElement, ComputedDatumGrid, SVGGElement, unknown> = graphicGSelection.selectAll(`circle.${circleClassName}`)
|
126
188
|
|
127
|
-
return
|
189
|
+
return graphicCircleSelection
|
128
190
|
}
|
129
191
|
|
130
192
|
|
@@ -195,98 +257,202 @@ export const createBaseDots: BasePluginFn<BaseDotsContext> = (pluginName: string
|
|
195
257
|
selection,
|
196
258
|
computedData$,
|
197
259
|
visibleComputedData$,
|
260
|
+
existedSeriesLabels$,
|
198
261
|
SeriesDataMap$,
|
199
262
|
GroupDataMap$,
|
200
263
|
fullParams$,
|
201
264
|
fullChartParams$,
|
202
265
|
gridAxesTransform$,
|
203
266
|
gridGraphicTransform$,
|
267
|
+
gridGraphicReverseScale$,
|
204
268
|
gridAxesSize$,
|
205
269
|
gridHighlight$,
|
270
|
+
gridContainer$,
|
206
271
|
event$
|
207
272
|
}) => {
|
208
273
|
|
209
274
|
const destroy$ = new Subject()
|
210
275
|
|
211
276
|
const clipPathID = getUniID(pluginName, 'clipPath-box')
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
//
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
const
|
220
|
-
const dataAreaSelection: d3.Selection<SVGGElement, any, any, any> = axisSelection.append('g')
|
277
|
+
const circleGClassName = getClassName(pluginName, 'circleG')
|
278
|
+
const circleClassName = getClassName(pluginName, 'circle')
|
279
|
+
|
280
|
+
// const axisSelection: d3.Selection<SVGGElement, any, any, any> = selection
|
281
|
+
// .append('g')
|
282
|
+
// .attr('clip-path', `url(#${clipPathID})`)
|
283
|
+
// const defsSelection: d3.Selection<SVGDefsElement, any, any, any> = axisSelection.append('defs')
|
284
|
+
// const dataAreaSelection: d3.Selection<SVGGElement, any, any, any> = axisSelection.append('g')
|
221
285
|
const graphicSelection$: Subject<d3.Selection<SVGGElement, ComputedDatumGrid, any, any>> = new Subject()
|
222
|
-
// const dotSelection$: Subject<d3.Selection<SVGCircleElement, ComputedDatumGrid, SVGGElement, any>> = new Subject()
|
223
286
|
|
224
|
-
gridAxesTransform$
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
gridGraphicTransform$
|
235
|
-
.pipe(
|
236
|
-
takeUntil(destroy$),
|
237
|
-
switchMap(async d => d.value),
|
238
|
-
distinctUntilChanged()
|
239
|
-
).subscribe(d => {
|
240
|
-
dataAreaSelection
|
241
|
-
.transition()
|
242
|
-
.duration(50)
|
243
|
-
.style('transform', d)
|
244
|
-
})
|
287
|
+
// gridAxesTransform$
|
288
|
+
// .pipe(
|
289
|
+
// takeUntil(destroy$),
|
290
|
+
// map(d => d.value),
|
291
|
+
// distinctUntilChanged()
|
292
|
+
// ).subscribe(d => {
|
293
|
+
// axisSelection
|
294
|
+
// .style('transform', d)
|
295
|
+
// })
|
245
296
|
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
)
|
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
|
+
// })
|
250
308
|
|
251
|
-
// const
|
252
|
-
//
|
253
|
-
//
|
254
|
-
//
|
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
|
+
// )
|
255
357
|
|
256
358
|
// combineLatest({
|
257
|
-
//
|
258
|
-
//
|
359
|
+
// seriesSelection: seriesSelection$,
|
360
|
+
// gridContainer: gridContainer$
|
259
361
|
// }).pipe(
|
260
362
|
// takeUntil(destroy$),
|
261
|
-
//
|
262
|
-
//
|
263
|
-
//
|
264
|
-
//
|
265
|
-
// .
|
266
|
-
//
|
267
|
-
//
|
268
|
-
//
|
269
|
-
//
|
270
|
-
// // .attr('opacity', 1)
|
271
|
-
// })
|
272
|
-
// selection.on('mouseover', (event, datum) => {
|
273
|
-
|
274
|
-
// console.log('selection mouseover', event, datum)
|
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
|
+
// })
|
275
372
|
// })
|
276
373
|
|
277
|
-
|
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
|
+
// )
|
409
|
+
|
410
|
+
const {
|
411
|
+
seriesSelection$,
|
412
|
+
axesSelection$,
|
413
|
+
defsSelection$,
|
414
|
+
graphicGSelection$
|
415
|
+
} = gridSelectionsObservable({
|
416
|
+
selection,
|
417
|
+
pluginName,
|
418
|
+
clipPathID,
|
419
|
+
existedSeriesLabels$,
|
420
|
+
gridContainer$,
|
421
|
+
gridAxesTransform$,
|
422
|
+
gridGraphicTransform$
|
423
|
+
})
|
424
|
+
|
425
|
+
const graphicReverseScale$: Observable<[number, number][]> = combineLatest({
|
426
|
+
// gridGraphicTransform: gridGraphicTransform$,
|
427
|
+
// gridContainer: gridContainer$,
|
428
|
+
// gridAxesTransform: gridAxesTransform$
|
429
|
+
computedData: computedData$,
|
430
|
+
gridGraphicReverseScale: gridGraphicReverseScale$
|
431
|
+
}).pipe(
|
432
|
+
takeUntil(destroy$),
|
433
|
+
switchMap(async data => data),
|
434
|
+
map(data => {
|
435
|
+
return data.computedData.map((series, seriesIndex) => {
|
436
|
+
return data.gridGraphicReverseScale[seriesIndex]
|
437
|
+
})
|
438
|
+
})
|
439
|
+
)
|
440
|
+
|
441
|
+
const clipPathSubscription = combineLatest({
|
442
|
+
defsSelection: defsSelection$,
|
443
|
+
gridAxesSize: gridAxesSize$,
|
444
|
+
}).pipe(
|
278
445
|
takeUntil(destroy$),
|
279
|
-
// 轉換後會退訂前一個未完成的訂閱事件,因此可以取到「同時間」最後一次的訂閱事件
|
280
446
|
switchMap(async (d) => d),
|
281
447
|
).subscribe(data => {
|
282
448
|
// 外層的遮罩
|
283
449
|
const clipPathData = [{
|
284
450
|
id: clipPathID,
|
285
|
-
width: data.width,
|
286
|
-
height: data.height
|
451
|
+
width: data.gridAxesSize.width,
|
452
|
+
height: data.gridAxesSize.height
|
287
453
|
}]
|
288
454
|
renderClipPath({
|
289
|
-
defsSelection,
|
455
|
+
defsSelection: data.defsSelection,
|
290
456
|
clipPathData,
|
291
457
|
})
|
292
458
|
})
|
@@ -323,26 +489,28 @@ export const createBaseDots: BasePluginFn<BaseDotsContext> = (pluginName: string
|
|
323
489
|
)
|
324
490
|
|
325
491
|
combineLatest({
|
492
|
+
graphicGSelection: graphicGSelection$,
|
326
493
|
computedData: computedData$,
|
327
494
|
visibleComputedData: visibleComputedData$,
|
328
495
|
SeriesDataMap: SeriesDataMap$,
|
329
496
|
GroupDataMap: GroupDataMap$,
|
330
|
-
|
497
|
+
graphicReverseScale: graphicReverseScale$,
|
331
498
|
fullChartParams: fullChartParams$,
|
332
499
|
fullParams: fullParams$,
|
333
500
|
highlightTarget: highlightTarget$
|
334
501
|
}).pipe(
|
335
502
|
takeUntil(destroy$),
|
336
|
-
// 轉換後會退訂前一個未完成的訂閱事件,因此可以取到「同時間」最後一次的訂閱事件
|
337
503
|
switchMap(async (d) => d),
|
338
504
|
).subscribe(data => {
|
339
505
|
|
340
506
|
const graphicSelection = renderDots({
|
341
|
-
|
342
|
-
|
507
|
+
graphicGSelection: data.graphicGSelection,
|
508
|
+
circleGClassName,
|
509
|
+
circleClassName,
|
510
|
+
data: data.visibleComputedData,
|
343
511
|
fullParams: data.fullParams,
|
344
512
|
fullChartParams: data.fullChartParams,
|
345
|
-
|
513
|
+
graphicReverseScale: data.graphicReverseScale
|
346
514
|
})
|
347
515
|
|
348
516
|
graphicSelection
|