@orbcharts/plugins-basic 3.0.0-alpha.42 → 3.0.0-alpha.43
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +200 -200
- package/dist/orbcharts-plugins-basic.es.js +5477 -5426
- package/dist/orbcharts-plugins-basic.umd.js +8 -8
- package/dist/src/base/BaseBarStack.d.ts +1 -1
- package/dist/src/base/BaseBars.d.ts +1 -1
- package/dist/src/base/BaseBarsTriangle.d.ts +1 -1
- package/dist/src/base/BaseDots.d.ts +1 -1
- package/dist/src/base/BaseLineAreas.d.ts +1 -1
- package/dist/src/base/BaseLines.d.ts +1 -1
- package/dist/src/multiGrid/defaults.d.ts +2 -1
- package/dist/src/multiGrid/index.d.ts +1 -0
- package/dist/src/multiGrid/plugins/MultiLineAreas.d.ts +1 -0
- package/dist/src/multiGrid/types.d.ts +4 -4
- package/package.json +42 -42
- package/src/base/BaseBarStack.ts +881 -879
- package/src/base/BaseBars.ts +750 -748
- package/src/base/BaseBarsTriangle.ts +659 -657
- package/src/base/BaseDots.ts +639 -637
- package/src/base/BaseGroupAxis.ts +496 -496
- package/src/base/BaseLegend.ts +636 -636
- package/src/base/BaseLineAreas.ts +621 -624
- package/src/base/BaseLines.ts +692 -695
- package/src/base/BaseValueAxis.ts +479 -479
- package/src/base/types.ts +2 -2
- package/src/grid/defaults.ts +121 -121
- package/src/grid/gridObservables.ts +263 -263
- package/src/grid/index.ts +15 -15
- package/src/grid/plugins/BarStack.ts +37 -37
- package/src/grid/plugins/Bars.ts +37 -37
- package/src/grid/plugins/BarsDiverging.ts +39 -39
- package/src/grid/plugins/BarsTriangle.ts +34 -34
- package/src/grid/plugins/Dots.ts +35 -35
- package/src/grid/plugins/GridLegend.ts +58 -58
- package/src/grid/plugins/GroupAux.ts +643 -643
- package/src/grid/plugins/GroupAxis.ts +30 -30
- package/src/grid/plugins/LineAreas.ts +36 -36
- package/src/grid/plugins/Lines.ts +35 -35
- package/src/grid/plugins/ScalingArea.ts +174 -174
- package/src/grid/plugins/ValueAxis.ts +31 -31
- package/src/grid/plugins/ValueStackAxis.ts +70 -70
- package/src/grid/types.ts +120 -120
- package/src/index.ts +9 -9
- package/src/multiGrid/defaults.ts +147 -140
- package/src/multiGrid/index.ts +11 -10
- package/src/multiGrid/multiGridObservables.ts +289 -278
- package/src/multiGrid/plugins/MultiBarStack.ts +60 -60
- package/src/multiGrid/plugins/MultiBars.ts +59 -59
- package/src/multiGrid/plugins/MultiBarsTriangle.ts +58 -58
- package/src/multiGrid/plugins/MultiDots.ts +58 -58
- package/src/multiGrid/plugins/MultiGridLegend.ts +88 -88
- package/src/multiGrid/plugins/MultiGroupAxis.ts +53 -53
- package/src/multiGrid/plugins/MultiLineAreas.ts +59 -0
- package/src/multiGrid/plugins/MultiLines.ts +58 -58
- package/src/multiGrid/plugins/MultiValueAxis.ts +53 -53
- package/src/multiGrid/plugins/OverlappingValueAxes.ts +164 -165
- package/src/multiGrid/types.ts +67 -67
- package/src/noneData/defaults.ts +61 -61
- package/src/noneData/index.ts +3 -3
- package/src/noneData/plugins/Container.ts +10 -10
- package/src/noneData/plugins/Tooltip.ts +304 -304
- package/src/noneData/types.ts +26 -26
- package/src/series/defaults.ts +99 -99
- package/src/series/index.ts +6 -6
- package/src/series/plugins/Bubbles.ts +551 -549
- package/src/series/plugins/Pie.ts +600 -598
- package/src/series/plugins/PieEventTexts.ts +194 -194
- package/src/series/plugins/PieLabels.ts +288 -285
- package/src/series/plugins/SeriesLegend.ts +58 -58
- package/src/series/seriesUtils.ts +50 -50
- package/src/series/types.ts +67 -67
- package/src/tree/defaults.ts +22 -22
- package/src/tree/index.ts +3 -3
- package/src/tree/plugins/TreeLegend.ts +58 -58
- package/src/tree/plugins/TreeMap.ts +302 -300
- package/src/tree/types.ts +23 -23
- package/src/utils/commonUtils.ts +21 -21
- package/src/utils/d3Graphics.ts +124 -124
- package/src/utils/d3Utils.ts +73 -73
- package/src/utils/observables.ts +14 -14
- package/src/utils/orbchartsUtils.ts +100 -100
- package/tsconfig.dev.json +16 -16
- package/tsconfig.json +13 -13
- package/tsconfig.prod.json +13 -13
- package/vite.config.js +49 -49
@@ -1,60 +1,60 @@
|
|
1
|
-
import * as d3 from 'd3'
|
2
|
-
import {
|
3
|
-
Subject } from 'rxjs'
|
4
|
-
import {
|
5
|
-
defineMultiGridPlugin } from '@orbcharts/core'
|
6
|
-
import { DEFAULT_MULTI_BAR_STACK_PARAMS } from '../defaults'
|
7
|
-
import { createBaseBarStack } from '../../base/BaseBarStack'
|
8
|
-
import { multiGridDetailObservables } from '../multiGridObservables'
|
9
|
-
import { getClassName, getUniID } from '../../utils/orbchartsUtils'
|
10
|
-
|
11
|
-
const pluginName = 'MultiBarStack'
|
12
|
-
|
13
|
-
const gridClassName = getClassName(pluginName, 'grid')
|
14
|
-
|
15
|
-
export const MultiBarStack = defineMultiGridPlugin(pluginName, DEFAULT_MULTI_BAR_STACK_PARAMS)(({ selection, name, subject, observer }) => {
|
16
|
-
const destroy$ = new Subject()
|
17
|
-
|
18
|
-
const unsubscribeFnArr: (() => void)[] = []
|
19
|
-
|
20
|
-
const multiGridPlugin$ = multiGridDetailObservables(observer)
|
21
|
-
|
22
|
-
multiGridPlugin$.subscribe(data => {
|
23
|
-
// 每次重新計算時,清除之前的訂閱
|
24
|
-
unsubscribeFnArr.forEach(fn => fn())
|
25
|
-
|
26
|
-
selection.selectAll(`g.${gridClassName}`)
|
27
|
-
.data(data)
|
28
|
-
.join('g')
|
29
|
-
.attr('class', gridClassName)
|
30
|
-
.each((d, i, g) => {
|
31
|
-
|
32
|
-
const gridSelection = d3.select(g[i])
|
33
|
-
|
34
|
-
unsubscribeFnArr[i] = createBaseBarStack(pluginName, {
|
35
|
-
selection: gridSelection,
|
36
|
-
computedData$: d.gridComputedData$,
|
37
|
-
visibleComputedData$: d.visibleComputedData$,
|
38
|
-
existSeriesLabels$: d.existSeriesLabels$,
|
39
|
-
SeriesDataMap$: d.SeriesDataMap$,
|
40
|
-
GroupDataMap$: d.GroupDataMap$,
|
41
|
-
fullParams$: observer.fullParams$,
|
42
|
-
fullDataFormatter$: d.gridDataFormatter$,
|
43
|
-
fullChartParams$: observer.fullChartParams$,
|
44
|
-
gridAxesTransform$: d.gridAxesTransform$,
|
45
|
-
gridGraphicTransform$: d.gridGraphicTransform$,
|
46
|
-
gridGraphicReverseScale$: d.gridGraphicReverseScale$,
|
47
|
-
gridAxesSize$: d.gridAxesSize$,
|
48
|
-
gridHighlight$: d.gridHighlight$,
|
49
|
-
gridContainer$: d.gridContainer$,
|
50
|
-
isSeriesPositionSeprate$: d.isSeriesPositionSeprate$,
|
51
|
-
event$: subject.event$ as Subject<any>,
|
52
|
-
})
|
53
|
-
})
|
54
|
-
})
|
55
|
-
|
56
|
-
return () => {
|
57
|
-
destroy$.next(undefined)
|
58
|
-
unsubscribeFnArr.forEach(fn => fn())
|
59
|
-
}
|
60
|
-
})
|
1
|
+
import * as d3 from 'd3'
|
2
|
+
import {
|
3
|
+
Subject } from 'rxjs'
|
4
|
+
import {
|
5
|
+
defineMultiGridPlugin } from '@orbcharts/core'
|
6
|
+
import { DEFAULT_MULTI_BAR_STACK_PARAMS } from '../defaults'
|
7
|
+
import { createBaseBarStack } from '../../base/BaseBarStack'
|
8
|
+
import { multiGridDetailObservables } from '../multiGridObservables'
|
9
|
+
import { getClassName, getUniID } from '../../utils/orbchartsUtils'
|
10
|
+
|
11
|
+
const pluginName = 'MultiBarStack'
|
12
|
+
|
13
|
+
const gridClassName = getClassName(pluginName, 'grid')
|
14
|
+
|
15
|
+
export const MultiBarStack = defineMultiGridPlugin(pluginName, DEFAULT_MULTI_BAR_STACK_PARAMS)(({ selection, name, subject, observer }) => {
|
16
|
+
const destroy$ = new Subject()
|
17
|
+
|
18
|
+
const unsubscribeFnArr: (() => void)[] = []
|
19
|
+
|
20
|
+
const multiGridPlugin$ = multiGridDetailObservables(observer)
|
21
|
+
|
22
|
+
multiGridPlugin$.subscribe(data => {
|
23
|
+
// 每次重新計算時,清除之前的訂閱
|
24
|
+
unsubscribeFnArr.forEach(fn => fn())
|
25
|
+
|
26
|
+
selection.selectAll(`g.${gridClassName}`)
|
27
|
+
.data(data)
|
28
|
+
.join('g')
|
29
|
+
.attr('class', gridClassName)
|
30
|
+
.each((d, i, g) => {
|
31
|
+
|
32
|
+
const gridSelection = d3.select(g[i])
|
33
|
+
|
34
|
+
unsubscribeFnArr[i] = createBaseBarStack(pluginName, {
|
35
|
+
selection: gridSelection,
|
36
|
+
computedData$: d.gridComputedData$,
|
37
|
+
visibleComputedData$: d.visibleComputedData$,
|
38
|
+
existSeriesLabels$: d.existSeriesLabels$,
|
39
|
+
SeriesDataMap$: d.SeriesDataMap$,
|
40
|
+
GroupDataMap$: d.GroupDataMap$,
|
41
|
+
fullParams$: observer.fullParams$,
|
42
|
+
fullDataFormatter$: d.gridDataFormatter$,
|
43
|
+
fullChartParams$: observer.fullChartParams$,
|
44
|
+
gridAxesTransform$: d.gridAxesTransform$,
|
45
|
+
gridGraphicTransform$: d.gridGraphicTransform$,
|
46
|
+
gridGraphicReverseScale$: d.gridGraphicReverseScale$,
|
47
|
+
gridAxesSize$: d.gridAxesSize$,
|
48
|
+
gridHighlight$: d.gridHighlight$,
|
49
|
+
gridContainer$: d.gridContainer$,
|
50
|
+
isSeriesPositionSeprate$: d.isSeriesPositionSeprate$,
|
51
|
+
event$: subject.event$ as Subject<any>,
|
52
|
+
})
|
53
|
+
})
|
54
|
+
})
|
55
|
+
|
56
|
+
return () => {
|
57
|
+
destroy$.next(undefined)
|
58
|
+
unsubscribeFnArr.forEach(fn => fn())
|
59
|
+
}
|
60
|
+
})
|
@@ -1,59 +1,59 @@
|
|
1
|
-
import * as d3 from 'd3'
|
2
|
-
import {
|
3
|
-
Subject } from 'rxjs'
|
4
|
-
import {
|
5
|
-
defineMultiGridPlugin } from '@orbcharts/core'
|
6
|
-
import { DEFAULT_MULTI_BARS_PARAMS } from '../defaults'
|
7
|
-
import { createBaseBars } from '../../base/BaseBars'
|
8
|
-
import { multiGridDetailObservables } from '../multiGridObservables'
|
9
|
-
import { getClassName, getUniID } from '../../utils/orbchartsUtils'
|
10
|
-
|
11
|
-
const pluginName = 'MultiBars'
|
12
|
-
|
13
|
-
const gridClassName = getClassName(pluginName, 'grid')
|
14
|
-
|
15
|
-
export const MultiBars = defineMultiGridPlugin(pluginName, DEFAULT_MULTI_BARS_PARAMS)(({ selection, name, subject, observer }) => {
|
16
|
-
const destroy$ = new Subject()
|
17
|
-
|
18
|
-
const unsubscribeFnArr: (() => void)[] = []
|
19
|
-
|
20
|
-
const multiGridPlugin$ = multiGridDetailObservables(observer)
|
21
|
-
|
22
|
-
multiGridPlugin$.subscribe(data => {
|
23
|
-
// 每次重新計算時,清除之前的訂閱
|
24
|
-
unsubscribeFnArr.forEach(fn => fn())
|
25
|
-
|
26
|
-
selection.selectAll(`g.${gridClassName}`)
|
27
|
-
.data(data)
|
28
|
-
.join('g')
|
29
|
-
.attr('class', gridClassName)
|
30
|
-
.each((d, i, g) => {
|
31
|
-
|
32
|
-
const gridSelection = d3.select(g[i])
|
33
|
-
|
34
|
-
unsubscribeFnArr[i] = createBaseBars(pluginName, {
|
35
|
-
selection: gridSelection,
|
36
|
-
computedData$: d.gridComputedData$,
|
37
|
-
visibleComputedData$: d.visibleComputedData$,
|
38
|
-
existSeriesLabels$: d.existSeriesLabels$,
|
39
|
-
SeriesDataMap$: d.SeriesDataMap$,
|
40
|
-
GroupDataMap$: d.GroupDataMap$,
|
41
|
-
fullParams$: observer.fullParams$,
|
42
|
-
fullChartParams$: observer.fullChartParams$,
|
43
|
-
gridAxesTransform$: d.gridAxesTransform$,
|
44
|
-
gridGraphicTransform$: d.gridGraphicTransform$,
|
45
|
-
gridGraphicReverseScale$: d.gridGraphicReverseScale$,
|
46
|
-
gridAxesSize$: d.gridAxesSize$,
|
47
|
-
gridHighlight$: d.gridHighlight$,
|
48
|
-
gridContainer$: d.gridContainer$,
|
49
|
-
isSeriesPositionSeprate$: d.isSeriesPositionSeprate$,
|
50
|
-
event$: subject.event$ as Subject<any>,
|
51
|
-
})
|
52
|
-
})
|
53
|
-
})
|
54
|
-
|
55
|
-
return () => {
|
56
|
-
destroy$.next(undefined)
|
57
|
-
unsubscribeFnArr.forEach(fn => fn())
|
58
|
-
}
|
59
|
-
})
|
1
|
+
import * as d3 from 'd3'
|
2
|
+
import {
|
3
|
+
Subject } from 'rxjs'
|
4
|
+
import {
|
5
|
+
defineMultiGridPlugin } from '@orbcharts/core'
|
6
|
+
import { DEFAULT_MULTI_BARS_PARAMS } from '../defaults'
|
7
|
+
import { createBaseBars } from '../../base/BaseBars'
|
8
|
+
import { multiGridDetailObservables } from '../multiGridObservables'
|
9
|
+
import { getClassName, getUniID } from '../../utils/orbchartsUtils'
|
10
|
+
|
11
|
+
const pluginName = 'MultiBars'
|
12
|
+
|
13
|
+
const gridClassName = getClassName(pluginName, 'grid')
|
14
|
+
|
15
|
+
export const MultiBars = defineMultiGridPlugin(pluginName, DEFAULT_MULTI_BARS_PARAMS)(({ selection, name, subject, observer }) => {
|
16
|
+
const destroy$ = new Subject()
|
17
|
+
|
18
|
+
const unsubscribeFnArr: (() => void)[] = []
|
19
|
+
|
20
|
+
const multiGridPlugin$ = multiGridDetailObservables(observer)
|
21
|
+
|
22
|
+
multiGridPlugin$.subscribe(data => {
|
23
|
+
// 每次重新計算時,清除之前的訂閱
|
24
|
+
unsubscribeFnArr.forEach(fn => fn())
|
25
|
+
|
26
|
+
selection.selectAll(`g.${gridClassName}`)
|
27
|
+
.data(data)
|
28
|
+
.join('g')
|
29
|
+
.attr('class', gridClassName)
|
30
|
+
.each((d, i, g) => {
|
31
|
+
|
32
|
+
const gridSelection = d3.select(g[i])
|
33
|
+
|
34
|
+
unsubscribeFnArr[i] = createBaseBars(pluginName, {
|
35
|
+
selection: gridSelection,
|
36
|
+
computedData$: d.gridComputedData$,
|
37
|
+
visibleComputedData$: d.visibleComputedData$,
|
38
|
+
existSeriesLabels$: d.existSeriesLabels$,
|
39
|
+
SeriesDataMap$: d.SeriesDataMap$,
|
40
|
+
GroupDataMap$: d.GroupDataMap$,
|
41
|
+
fullParams$: observer.fullParams$,
|
42
|
+
fullChartParams$: observer.fullChartParams$,
|
43
|
+
gridAxesTransform$: d.gridAxesTransform$,
|
44
|
+
gridGraphicTransform$: d.gridGraphicTransform$,
|
45
|
+
gridGraphicReverseScale$: d.gridGraphicReverseScale$,
|
46
|
+
gridAxesSize$: d.gridAxesSize$,
|
47
|
+
gridHighlight$: d.gridHighlight$,
|
48
|
+
gridContainer$: d.gridContainer$,
|
49
|
+
isSeriesPositionSeprate$: d.isSeriesPositionSeprate$,
|
50
|
+
event$: subject.event$ as Subject<any>,
|
51
|
+
})
|
52
|
+
})
|
53
|
+
})
|
54
|
+
|
55
|
+
return () => {
|
56
|
+
destroy$.next(undefined)
|
57
|
+
unsubscribeFnArr.forEach(fn => fn())
|
58
|
+
}
|
59
|
+
})
|
@@ -1,58 +1,58 @@
|
|
1
|
-
import * as d3 from 'd3'
|
2
|
-
import {
|
3
|
-
Subject } from 'rxjs'
|
4
|
-
import {
|
5
|
-
defineMultiGridPlugin } from '@orbcharts/core'
|
6
|
-
import { DEFAULT_MULTI_BARS_TRIANGLE_PARAMS } from '../defaults'
|
7
|
-
import { createBaseBarsTriangle } from '../../base/BaseBarsTriangle'
|
8
|
-
import { multiGridDetailObservables } from '../multiGridObservables'
|
9
|
-
import { getClassName, getUniID } from '../../utils/orbchartsUtils'
|
10
|
-
|
11
|
-
const pluginName = 'MultiBarsTriangle'
|
12
|
-
|
13
|
-
const gridClassName = getClassName(pluginName, 'grid')
|
14
|
-
|
15
|
-
export const MultiBarsTriangle = defineMultiGridPlugin(pluginName, DEFAULT_MULTI_BARS_TRIANGLE_PARAMS)(({ selection, name, subject, observer }) => {
|
16
|
-
const destroy$ = new Subject()
|
17
|
-
|
18
|
-
const unsubscribeFnArr: (() => void)[] = []
|
19
|
-
|
20
|
-
const multiGridPlugin$ = multiGridDetailObservables(observer)
|
21
|
-
|
22
|
-
multiGridPlugin$.subscribe(data => {
|
23
|
-
// 每次重新計算時,清除之前的訂閱
|
24
|
-
unsubscribeFnArr.forEach(fn => fn())
|
25
|
-
|
26
|
-
selection.selectAll(`g.${gridClassName}`)
|
27
|
-
.data(data)
|
28
|
-
.join('g')
|
29
|
-
.attr('class', gridClassName)
|
30
|
-
.each((d, i, g) => {
|
31
|
-
|
32
|
-
const gridSelection = d3.select(g[i])
|
33
|
-
|
34
|
-
unsubscribeFnArr[i] = createBaseBarsTriangle(pluginName, {
|
35
|
-
selection: gridSelection,
|
36
|
-
computedData$: d.gridComputedData$,
|
37
|
-
visibleComputedData$: d.visibleComputedData$,
|
38
|
-
existSeriesLabels$: d.existSeriesLabels$,
|
39
|
-
SeriesDataMap$: d.SeriesDataMap$,
|
40
|
-
GroupDataMap$: d.GroupDataMap$,
|
41
|
-
fullParams$: observer.fullParams$,
|
42
|
-
fullChartParams$: observer.fullChartParams$,
|
43
|
-
gridAxesTransform$: d.gridAxesTransform$,
|
44
|
-
gridGraphicTransform$: d.gridGraphicTransform$,
|
45
|
-
gridAxesSize$: d.gridAxesSize$,
|
46
|
-
gridHighlight$: d.gridHighlight$,
|
47
|
-
gridContainer$: d.gridContainer$,
|
48
|
-
isSeriesPositionSeprate$: d.isSeriesPositionSeprate$,
|
49
|
-
event$: subject.event$ as Subject<any>,
|
50
|
-
})
|
51
|
-
})
|
52
|
-
})
|
53
|
-
|
54
|
-
return () => {
|
55
|
-
destroy$.next(undefined)
|
56
|
-
unsubscribeFnArr.forEach(fn => fn())
|
57
|
-
}
|
58
|
-
})
|
1
|
+
import * as d3 from 'd3'
|
2
|
+
import {
|
3
|
+
Subject } from 'rxjs'
|
4
|
+
import {
|
5
|
+
defineMultiGridPlugin } from '@orbcharts/core'
|
6
|
+
import { DEFAULT_MULTI_BARS_TRIANGLE_PARAMS } from '../defaults'
|
7
|
+
import { createBaseBarsTriangle } from '../../base/BaseBarsTriangle'
|
8
|
+
import { multiGridDetailObservables } from '../multiGridObservables'
|
9
|
+
import { getClassName, getUniID } from '../../utils/orbchartsUtils'
|
10
|
+
|
11
|
+
const pluginName = 'MultiBarsTriangle'
|
12
|
+
|
13
|
+
const gridClassName = getClassName(pluginName, 'grid')
|
14
|
+
|
15
|
+
export const MultiBarsTriangle = defineMultiGridPlugin(pluginName, DEFAULT_MULTI_BARS_TRIANGLE_PARAMS)(({ selection, name, subject, observer }) => {
|
16
|
+
const destroy$ = new Subject()
|
17
|
+
|
18
|
+
const unsubscribeFnArr: (() => void)[] = []
|
19
|
+
|
20
|
+
const multiGridPlugin$ = multiGridDetailObservables(observer)
|
21
|
+
|
22
|
+
multiGridPlugin$.subscribe(data => {
|
23
|
+
// 每次重新計算時,清除之前的訂閱
|
24
|
+
unsubscribeFnArr.forEach(fn => fn())
|
25
|
+
|
26
|
+
selection.selectAll(`g.${gridClassName}`)
|
27
|
+
.data(data)
|
28
|
+
.join('g')
|
29
|
+
.attr('class', gridClassName)
|
30
|
+
.each((d, i, g) => {
|
31
|
+
|
32
|
+
const gridSelection = d3.select(g[i])
|
33
|
+
|
34
|
+
unsubscribeFnArr[i] = createBaseBarsTriangle(pluginName, {
|
35
|
+
selection: gridSelection,
|
36
|
+
computedData$: d.gridComputedData$,
|
37
|
+
visibleComputedData$: d.visibleComputedData$,
|
38
|
+
existSeriesLabels$: d.existSeriesLabels$,
|
39
|
+
SeriesDataMap$: d.SeriesDataMap$,
|
40
|
+
GroupDataMap$: d.GroupDataMap$,
|
41
|
+
fullParams$: observer.fullParams$,
|
42
|
+
fullChartParams$: observer.fullChartParams$,
|
43
|
+
gridAxesTransform$: d.gridAxesTransform$,
|
44
|
+
gridGraphicTransform$: d.gridGraphicTransform$,
|
45
|
+
gridAxesSize$: d.gridAxesSize$,
|
46
|
+
gridHighlight$: d.gridHighlight$,
|
47
|
+
gridContainer$: d.gridContainer$,
|
48
|
+
isSeriesPositionSeprate$: d.isSeriesPositionSeprate$,
|
49
|
+
event$: subject.event$ as Subject<any>,
|
50
|
+
})
|
51
|
+
})
|
52
|
+
})
|
53
|
+
|
54
|
+
return () => {
|
55
|
+
destroy$.next(undefined)
|
56
|
+
unsubscribeFnArr.forEach(fn => fn())
|
57
|
+
}
|
58
|
+
})
|
@@ -1,58 +1,58 @@
|
|
1
|
-
import * as d3 from 'd3'
|
2
|
-
import {
|
3
|
-
Subject } from 'rxjs'
|
4
|
-
import {
|
5
|
-
defineMultiGridPlugin } from '@orbcharts/core'
|
6
|
-
import { DEFAULT_MULTI_DOTS_PARAMS } from '../defaults'
|
7
|
-
import { createBaseDots } from '../../base/BaseDots'
|
8
|
-
import { multiGridDetailObservables } from '../multiGridObservables'
|
9
|
-
import { getClassName, getUniID } from '../../utils/orbchartsUtils'
|
10
|
-
|
11
|
-
const pluginName = 'MultiDots'
|
12
|
-
|
13
|
-
const gridClassName = getClassName(pluginName, 'grid')
|
14
|
-
|
15
|
-
export const MultiDots = defineMultiGridPlugin(pluginName, DEFAULT_MULTI_DOTS_PARAMS)(({ selection, name, subject, observer }) => {
|
16
|
-
const destroy$ = new Subject()
|
17
|
-
|
18
|
-
const unsubscribeFnArr: (() => void)[] = []
|
19
|
-
|
20
|
-
const multiGridPlugin$ = multiGridDetailObservables(observer)
|
21
|
-
|
22
|
-
multiGridPlugin$.subscribe(data => {
|
23
|
-
// 每次重新計算時,清除之前的訂閱
|
24
|
-
unsubscribeFnArr.forEach(fn => fn())
|
25
|
-
|
26
|
-
selection.selectAll(`g.${gridClassName}`)
|
27
|
-
.data(data)
|
28
|
-
.join('g')
|
29
|
-
.attr('class', gridClassName)
|
30
|
-
.each((d, i, g) => {
|
31
|
-
|
32
|
-
const gridSelection = d3.select(g[i])
|
33
|
-
|
34
|
-
unsubscribeFnArr[i] = createBaseDots(pluginName, {
|
35
|
-
selection: gridSelection,
|
36
|
-
computedData$: d.gridComputedData$,
|
37
|
-
visibleComputedData$: d.visibleComputedData$,
|
38
|
-
existSeriesLabels$: d.existSeriesLabels$,
|
39
|
-
SeriesDataMap$: d.SeriesDataMap$,
|
40
|
-
GroupDataMap$: d.GroupDataMap$,
|
41
|
-
fullParams$: observer.fullParams$,
|
42
|
-
fullChartParams$: observer.fullChartParams$,
|
43
|
-
gridAxesTransform$: d.gridAxesTransform$,
|
44
|
-
gridGraphicTransform$: d.gridGraphicTransform$,
|
45
|
-
gridGraphicReverseScale$: d.gridGraphicReverseScale$,
|
46
|
-
gridAxesSize$: d.gridAxesSize$,
|
47
|
-
gridHighlight$: d.gridHighlight$,
|
48
|
-
gridContainer$: d.gridContainer$,
|
49
|
-
event$: subject.event$ as Subject<any>,
|
50
|
-
})
|
51
|
-
})
|
52
|
-
})
|
53
|
-
|
54
|
-
return () => {
|
55
|
-
destroy$.next(undefined)
|
56
|
-
unsubscribeFnArr.forEach(fn => fn())
|
57
|
-
}
|
58
|
-
})
|
1
|
+
import * as d3 from 'd3'
|
2
|
+
import {
|
3
|
+
Subject } from 'rxjs'
|
4
|
+
import {
|
5
|
+
defineMultiGridPlugin } from '@orbcharts/core'
|
6
|
+
import { DEFAULT_MULTI_DOTS_PARAMS } from '../defaults'
|
7
|
+
import { createBaseDots } from '../../base/BaseDots'
|
8
|
+
import { multiGridDetailObservables } from '../multiGridObservables'
|
9
|
+
import { getClassName, getUniID } from '../../utils/orbchartsUtils'
|
10
|
+
|
11
|
+
const pluginName = 'MultiDots'
|
12
|
+
|
13
|
+
const gridClassName = getClassName(pluginName, 'grid')
|
14
|
+
|
15
|
+
export const MultiDots = defineMultiGridPlugin(pluginName, DEFAULT_MULTI_DOTS_PARAMS)(({ selection, name, subject, observer }) => {
|
16
|
+
const destroy$ = new Subject()
|
17
|
+
|
18
|
+
const unsubscribeFnArr: (() => void)[] = []
|
19
|
+
|
20
|
+
const multiGridPlugin$ = multiGridDetailObservables(observer)
|
21
|
+
|
22
|
+
multiGridPlugin$.subscribe(data => {
|
23
|
+
// 每次重新計算時,清除之前的訂閱
|
24
|
+
unsubscribeFnArr.forEach(fn => fn())
|
25
|
+
|
26
|
+
selection.selectAll(`g.${gridClassName}`)
|
27
|
+
.data(data)
|
28
|
+
.join('g')
|
29
|
+
.attr('class', gridClassName)
|
30
|
+
.each((d, i, g) => {
|
31
|
+
|
32
|
+
const gridSelection = d3.select(g[i])
|
33
|
+
|
34
|
+
unsubscribeFnArr[i] = createBaseDots(pluginName, {
|
35
|
+
selection: gridSelection,
|
36
|
+
computedData$: d.gridComputedData$,
|
37
|
+
visibleComputedData$: d.visibleComputedData$,
|
38
|
+
existSeriesLabels$: d.existSeriesLabels$,
|
39
|
+
SeriesDataMap$: d.SeriesDataMap$,
|
40
|
+
GroupDataMap$: d.GroupDataMap$,
|
41
|
+
fullParams$: observer.fullParams$,
|
42
|
+
fullChartParams$: observer.fullChartParams$,
|
43
|
+
gridAxesTransform$: d.gridAxesTransform$,
|
44
|
+
gridGraphicTransform$: d.gridGraphicTransform$,
|
45
|
+
gridGraphicReverseScale$: d.gridGraphicReverseScale$,
|
46
|
+
gridAxesSize$: d.gridAxesSize$,
|
47
|
+
gridHighlight$: d.gridHighlight$,
|
48
|
+
gridContainer$: d.gridContainer$,
|
49
|
+
event$: subject.event$ as Subject<any>,
|
50
|
+
})
|
51
|
+
})
|
52
|
+
})
|
53
|
+
|
54
|
+
return () => {
|
55
|
+
destroy$.next(undefined)
|
56
|
+
unsubscribeFnArr.forEach(fn => fn())
|
57
|
+
}
|
58
|
+
})
|
@@ -1,88 +1,88 @@
|
|
1
|
-
import * as d3 from 'd3'
|
2
|
-
import {
|
3
|
-
combineLatest,
|
4
|
-
map,
|
5
|
-
switchMap,
|
6
|
-
takeUntil,
|
7
|
-
Observable,
|
8
|
-
Subject } from 'rxjs'
|
9
|
-
import {
|
10
|
-
defineMultiGridPlugin, mergeOptionsWithDefault } from '@orbcharts/core'
|
11
|
-
import { DEFAULT_MULTI_GRID_LEGEND_PARAMS } from '../defaults'
|
12
|
-
import { createBaseLegend } from '../../base/BaseLegend'
|
13
|
-
import type { BaseLegendParams } from '../../base/BaseLegend'
|
14
|
-
|
15
|
-
const pluginName = 'MultiGridLegend'
|
16
|
-
|
17
|
-
export const MultiGridLegend = defineMultiGridPlugin(pluginName, DEFAULT_MULTI_GRID_LEGEND_PARAMS)(({ selection, rootSelection, observer, subject }) => {
|
18
|
-
|
19
|
-
const destroy$ = new Subject()
|
20
|
-
|
21
|
-
const seriesLabels$ = observer.multiGridEachDetail$.pipe(
|
22
|
-
takeUntil(destroy$),
|
23
|
-
map(multiGrid => {
|
24
|
-
const seriesLabelsObservableArr = multiGrid.map((grid, gridIndex) => {
|
25
|
-
return grid.SeriesDataMap$.pipe(
|
26
|
-
// grid內的seriesLabels
|
27
|
-
map(seriesDataMap => Array.from(seriesDataMap.keys()))
|
28
|
-
)
|
29
|
-
})
|
30
|
-
return seriesLabelsObservableArr
|
31
|
-
}),
|
32
|
-
switchMap(seriesLabelsObservableArr => combineLatest(seriesLabelsObservableArr)),
|
33
|
-
map(data => data.flat())
|
34
|
-
)
|
35
|
-
|
36
|
-
const seriesList$ = combineLatest({
|
37
|
-
fullParams: observer.fullParams$,
|
38
|
-
multiGrid: observer.multiGridEachDetail$,
|
39
|
-
computedData: observer.computedData$,
|
40
|
-
}).pipe(
|
41
|
-
takeUntil(destroy$),
|
42
|
-
switchMap(async d => d),
|
43
|
-
map(data => {
|
44
|
-
// grid
|
45
|
-
return data.computedData
|
46
|
-
.map((gridData, gridIndex) => {
|
47
|
-
// 這個grid全部series要套用的圖例列點樣式
|
48
|
-
const gridListStyle = mergeOptionsWithDefault(data.fullParams.gridList[gridIndex] ?? {}, {
|
49
|
-
listRectWidth: data.fullParams.listRectWidth,
|
50
|
-
listRectHeight: data.fullParams.listRectHeight,
|
51
|
-
listRectRadius: data.fullParams.listRectRadius,
|
52
|
-
})
|
53
|
-
// series
|
54
|
-
return gridData.map(d => gridListStyle)
|
55
|
-
})
|
56
|
-
.flat()
|
57
|
-
|
58
|
-
})
|
59
|
-
)
|
60
|
-
|
61
|
-
const fullParams$: Observable<BaseLegendParams> = combineLatest({
|
62
|
-
fullParams: observer.fullParams$,
|
63
|
-
seriesList: seriesList$
|
64
|
-
}).pipe(
|
65
|
-
takeUntil(destroy$),
|
66
|
-
switchMap(async d => d),
|
67
|
-
map(d => {
|
68
|
-
return {
|
69
|
-
...d.fullParams,
|
70
|
-
seriesList: d.seriesList
|
71
|
-
}
|
72
|
-
})
|
73
|
-
)
|
74
|
-
|
75
|
-
const unsubscribeBaseLegend = createBaseLegend(pluginName, {
|
76
|
-
rootSelection,
|
77
|
-
seriesLabels$,
|
78
|
-
fullParams$,
|
79
|
-
layout$: observer.layout$,
|
80
|
-
fullChartParams$: observer.fullChartParams$
|
81
|
-
})
|
82
|
-
|
83
|
-
return () => {
|
84
|
-
destroy$.next(undefined)
|
85
|
-
unsubscribeBaseLegend()
|
86
|
-
}
|
87
|
-
})
|
88
|
-
|
1
|
+
import * as d3 from 'd3'
|
2
|
+
import {
|
3
|
+
combineLatest,
|
4
|
+
map,
|
5
|
+
switchMap,
|
6
|
+
takeUntil,
|
7
|
+
Observable,
|
8
|
+
Subject } from 'rxjs'
|
9
|
+
import {
|
10
|
+
defineMultiGridPlugin, mergeOptionsWithDefault } from '@orbcharts/core'
|
11
|
+
import { DEFAULT_MULTI_GRID_LEGEND_PARAMS } from '../defaults'
|
12
|
+
import { createBaseLegend } from '../../base/BaseLegend'
|
13
|
+
import type { BaseLegendParams } from '../../base/BaseLegend'
|
14
|
+
|
15
|
+
const pluginName = 'MultiGridLegend'
|
16
|
+
|
17
|
+
export const MultiGridLegend = defineMultiGridPlugin(pluginName, DEFAULT_MULTI_GRID_LEGEND_PARAMS)(({ selection, rootSelection, observer, subject }) => {
|
18
|
+
|
19
|
+
const destroy$ = new Subject()
|
20
|
+
|
21
|
+
const seriesLabels$ = observer.multiGridEachDetail$.pipe(
|
22
|
+
takeUntil(destroy$),
|
23
|
+
map(multiGrid => {
|
24
|
+
const seriesLabelsObservableArr = multiGrid.map((grid, gridIndex) => {
|
25
|
+
return grid.SeriesDataMap$.pipe(
|
26
|
+
// grid內的seriesLabels
|
27
|
+
map(seriesDataMap => Array.from(seriesDataMap.keys()))
|
28
|
+
)
|
29
|
+
})
|
30
|
+
return seriesLabelsObservableArr
|
31
|
+
}),
|
32
|
+
switchMap(seriesLabelsObservableArr => combineLatest(seriesLabelsObservableArr)),
|
33
|
+
map(data => data.flat())
|
34
|
+
)
|
35
|
+
|
36
|
+
const seriesList$ = combineLatest({
|
37
|
+
fullParams: observer.fullParams$,
|
38
|
+
multiGrid: observer.multiGridEachDetail$,
|
39
|
+
computedData: observer.computedData$,
|
40
|
+
}).pipe(
|
41
|
+
takeUntil(destroy$),
|
42
|
+
switchMap(async d => d),
|
43
|
+
map(data => {
|
44
|
+
// grid
|
45
|
+
return data.computedData
|
46
|
+
.map((gridData, gridIndex) => {
|
47
|
+
// 這個grid全部series要套用的圖例列點樣式
|
48
|
+
const gridListStyle = mergeOptionsWithDefault(data.fullParams.gridList[gridIndex] ?? {}, {
|
49
|
+
listRectWidth: data.fullParams.listRectWidth,
|
50
|
+
listRectHeight: data.fullParams.listRectHeight,
|
51
|
+
listRectRadius: data.fullParams.listRectRadius,
|
52
|
+
})
|
53
|
+
// series
|
54
|
+
return gridData.map(d => gridListStyle)
|
55
|
+
})
|
56
|
+
.flat()
|
57
|
+
|
58
|
+
})
|
59
|
+
)
|
60
|
+
|
61
|
+
const fullParams$: Observable<BaseLegendParams> = combineLatest({
|
62
|
+
fullParams: observer.fullParams$,
|
63
|
+
seriesList: seriesList$
|
64
|
+
}).pipe(
|
65
|
+
takeUntil(destroy$),
|
66
|
+
switchMap(async d => d),
|
67
|
+
map(d => {
|
68
|
+
return {
|
69
|
+
...d.fullParams,
|
70
|
+
seriesList: d.seriesList
|
71
|
+
}
|
72
|
+
})
|
73
|
+
)
|
74
|
+
|
75
|
+
const unsubscribeBaseLegend = createBaseLegend(pluginName, {
|
76
|
+
rootSelection,
|
77
|
+
seriesLabels$,
|
78
|
+
fullParams$,
|
79
|
+
layout$: observer.layout$,
|
80
|
+
fullChartParams$: observer.fullChartParams$
|
81
|
+
})
|
82
|
+
|
83
|
+
return () => {
|
84
|
+
destroy$.next(undefined)
|
85
|
+
unsubscribeBaseLegend()
|
86
|
+
}
|
87
|
+
})
|
88
|
+
|