@orbcharts/core 3.0.0-alpha.36 → 3.0.0-alpha.38
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/orbcharts-core.es.js +1753 -1664
- package/dist/orbcharts-core.umd.js +2 -2
- package/dist/src/grid/gridObservables.d.ts +1 -1
- package/dist/src/series/seriesObservables.d.ts +1 -8
- package/dist/src/tree/treeObservables.d.ts +13 -0
- package/dist/src/types/ChartParams.d.ts +1 -1
- package/dist/src/types/ComputedData.d.ts +13 -0
- package/dist/src/types/ComputedDataGrid.d.ts +2 -5
- package/dist/src/types/ComputedDataMultiValue.d.ts +2 -2
- package/dist/src/types/ComputedDataRelationship.d.ts +2 -2
- package/dist/src/types/ComputedDataTree.d.ts +2 -2
- package/dist/src/types/ContextObserverGrid.d.ts +1 -1
- package/dist/src/types/ContextObserverTree.d.ts +6 -0
- package/dist/src/types/DataFormatterMultiGrid.d.ts +1 -3
- package/dist/src/types/DataFormatterMultiValue.d.ts +0 -1
- package/dist/src/types/DataFormatterSeries.d.ts +0 -2
- package/dist/src/types/DataFormatterTree.d.ts +1 -0
- package/dist/src/types/DataMultiValue.d.ts +1 -0
- package/dist/src/types/DataRelationship.d.ts +1 -0
- package/dist/src/types/DataTree.d.ts +2 -0
- package/dist/src/types/Event.d.ts +30 -38
- package/dist/src/utils/observables.d.ts +7 -4
- package/package.json +1 -1
- package/src/defaults.ts +5 -3
- package/src/grid/createGridContextObserver.ts +3 -3
- package/src/grid/gridObservables.ts +1 -1
- package/src/multiGrid/multiGridObservables.ts +3 -3
- package/src/multiValue/computeMultiValueData.ts +7 -2
- package/src/relationship/computeRelationshipData.ts +3 -0
- package/src/series/createSeriesContextObserver.ts +1 -1
- package/src/series/seriesObservables.ts +8 -7
- package/src/tree/computeTreeData.ts +31 -9
- package/src/tree/createTreeContextObserver.ts +44 -0
- package/src/tree/treeObservables.ts +95 -0
- package/src/types/ChartParams.ts +1 -1
- package/src/types/ComputedData.ts +18 -1
- package/src/types/ComputedDataGrid.ts +5 -5
- package/src/types/ComputedDataMultiValue.ts +2 -3
- package/src/types/ComputedDataRelationship.ts +2 -2
- package/src/types/ComputedDataTree.ts +2 -2
- package/src/types/ContextObserverGrid.ts +1 -1
- package/src/types/ContextObserverMultiGrid.ts +1 -1
- package/src/types/ContextObserverTree.ts +6 -1
- package/src/types/DataFormatterMultiGrid.ts +2 -2
- package/src/types/DataFormatterMultiValue.ts +1 -1
- package/src/types/DataFormatterSeries.ts +2 -2
- package/src/types/DataFormatterTree.ts +1 -0
- package/src/types/DataMultiValue.ts +1 -0
- package/src/types/DataRelationship.ts +1 -0
- package/src/types/DataTree.ts +2 -0
- package/src/types/Event.ts +85 -46
- package/src/utils/d3Utils.ts +0 -1
- package/src/utils/observables.ts +60 -77
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import {
|
|
2
|
+
combineLatest,
|
|
3
|
+
distinctUntilChanged,
|
|
4
|
+
filter,
|
|
5
|
+
map,
|
|
6
|
+
merge,
|
|
7
|
+
takeUntil,
|
|
8
|
+
shareReplay,
|
|
9
|
+
switchMap,
|
|
10
|
+
Subject,
|
|
11
|
+
Observable } from 'rxjs'
|
|
12
|
+
import type {
|
|
13
|
+
ChartParams,
|
|
14
|
+
ComputedDataTree,
|
|
15
|
+
ComputedDataTypeMap,
|
|
16
|
+
DataFormatterTree } from '../types'
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
// 所有節點list結構
|
|
20
|
+
export const nodeListObservable = ({ computedData$ }: { computedData$: Observable<ComputedDataTree> }) => {
|
|
21
|
+
return computedData$.pipe(
|
|
22
|
+
map(data => {
|
|
23
|
+
function setNodeList (accNodeList: ComputedDataTree[], branch: ComputedDataTree) {
|
|
24
|
+
accNodeList.push(branch)
|
|
25
|
+
if (branch.children) {
|
|
26
|
+
branch.children.forEach(childBranch => {
|
|
27
|
+
accNodeList = setNodeList(accNodeList, childBranch) // 遞迴子節點
|
|
28
|
+
})
|
|
29
|
+
}
|
|
30
|
+
return accNodeList
|
|
31
|
+
}
|
|
32
|
+
return setNodeList([], data)
|
|
33
|
+
})
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export const existCategoryLabelsObservable = ({ nodeList$, fullDataFormatter$ }: {
|
|
38
|
+
nodeList$: Observable<ComputedDataTree[]>
|
|
39
|
+
fullDataFormatter$: Observable<DataFormatterTree>
|
|
40
|
+
}) => {
|
|
41
|
+
|
|
42
|
+
const categoryLabels$ = fullDataFormatter$.pipe(
|
|
43
|
+
map(d => d.categoryLabels),
|
|
44
|
+
distinctUntilChanged((a, b) => {
|
|
45
|
+
return JSON.stringify(a).length === JSON.stringify(b).length
|
|
46
|
+
}),
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
return combineLatest({
|
|
50
|
+
nodeList: nodeList$,
|
|
51
|
+
categoryLabels: categoryLabels$
|
|
52
|
+
}).pipe(
|
|
53
|
+
switchMap(async d => d),
|
|
54
|
+
map(data => {
|
|
55
|
+
const CurrentLabelSet = new Set(data.categoryLabels)
|
|
56
|
+
const ExistLabelSet = new Set(
|
|
57
|
+
data.nodeList.filter(node => node.visible).map(node => node.categoryLabel)
|
|
58
|
+
)
|
|
59
|
+
// 加入已存在的label(data.nodeList有,但是dataFormatter.categoryLabels沒有)
|
|
60
|
+
Array.from(ExistLabelSet).forEach(label => {
|
|
61
|
+
if (!CurrentLabelSet.has(label)) {
|
|
62
|
+
CurrentLabelSet.add(label)
|
|
63
|
+
}
|
|
64
|
+
})
|
|
65
|
+
// 移除不存在的label(dataFormatter.categoryLabels有,但是data.nodeList沒有)
|
|
66
|
+
Array.from(CurrentLabelSet).forEach(label => {
|
|
67
|
+
if (!ExistLabelSet.has(label)) {
|
|
68
|
+
ExistLabelSet.delete(label)
|
|
69
|
+
}
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
return Array.from(CurrentLabelSet)
|
|
73
|
+
}),
|
|
74
|
+
distinctUntilChanged((a, b) => {
|
|
75
|
+
return JSON.stringify(a).length === JSON.stringify(b).length
|
|
76
|
+
}),
|
|
77
|
+
)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// 所有可見的節點
|
|
81
|
+
export const treeVisibleComputedDataObservable = ({ computedData$ }: { computedData$: Observable<ComputedDataTree> }) => {
|
|
82
|
+
return computedData$.pipe(
|
|
83
|
+
map(data => {
|
|
84
|
+
function filterChildren (accTree: ComputedDataTree) {
|
|
85
|
+
if (accTree.children) {
|
|
86
|
+
accTree.children = accTree.children
|
|
87
|
+
.filter(child => child.visible) // 篩選visible
|
|
88
|
+
.map(child => filterChildren(child)) // 遞迴子節點
|
|
89
|
+
}
|
|
90
|
+
return accTree
|
|
91
|
+
}
|
|
92
|
+
return filterChildren(data)
|
|
93
|
+
})
|
|
94
|
+
)
|
|
95
|
+
}
|
package/src/types/ChartParams.ts
CHANGED
|
@@ -40,13 +40,30 @@ export interface ComputedDatumBase {
|
|
|
40
40
|
// axisY: number
|
|
41
41
|
// }
|
|
42
42
|
|
|
43
|
-
// datum -
|
|
43
|
+
// datum - 序列資料
|
|
44
44
|
export interface ComputedDatumSeriesValue {
|
|
45
45
|
color: string
|
|
46
46
|
seriesIndex: number
|
|
47
47
|
seriesLabel: string
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
// datum - 矩陣資料
|
|
51
|
+
export interface ComputedDatumGridValue {
|
|
52
|
+
gridIndex: number
|
|
53
|
+
color: string
|
|
54
|
+
seriesIndex: number
|
|
55
|
+
seriesLabel: string
|
|
56
|
+
groupIndex: number
|
|
57
|
+
groupLabel: string
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// datum - 類別資料
|
|
61
|
+
export interface ComputedDatumCategoryValue {
|
|
62
|
+
color: string
|
|
63
|
+
categoryIndex: number
|
|
64
|
+
categoryLabel: string | null
|
|
65
|
+
}
|
|
66
|
+
|
|
50
67
|
// 透過類型選擇ComputedData
|
|
51
68
|
export type ComputedDataTypeMap<T extends ChartType> = T extends 'series' ? ComputedDataSeries
|
|
52
69
|
: T extends 'grid' ? ComputedDataGrid
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { ComputedDatumBase,
|
|
1
|
+
import { ComputedDatumBase, ComputedDatumGridValue } from './ComputedData'
|
|
2
2
|
|
|
3
3
|
export interface ComputedDatumGrid
|
|
4
|
-
extends ComputedDatumBase,
|
|
4
|
+
extends ComputedDatumBase, ComputedDatumGridValue {
|
|
5
5
|
// accSeriesIndex: number // 每一個grid累加的seriesIndex
|
|
6
|
-
gridIndex: number
|
|
7
|
-
groupIndex: number
|
|
8
|
-
groupLabel: string
|
|
6
|
+
// gridIndex: number
|
|
7
|
+
// groupIndex: number
|
|
8
|
+
// groupLabel: string
|
|
9
9
|
axisX: number
|
|
10
10
|
axisY: number
|
|
11
11
|
axisYFromZero: number
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import type { ComputedDatumBase } from './ComputedData'
|
|
1
|
+
import type { ComputedDatumBase, ComputedDatumCategoryValue } from './ComputedData'
|
|
2
2
|
|
|
3
3
|
export type ComputedDataMultiValue = ComputedDatumMultiValue[][]
|
|
4
4
|
|
|
5
|
-
export interface ComputedDatumMultiValue
|
|
6
|
-
extends ComputedDatumBase {
|
|
5
|
+
export interface ComputedDatumMultiValue extends ComputedDatumBase, ComputedDatumCategoryValue {
|
|
7
6
|
axis: number
|
|
8
7
|
}
|
|
9
8
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { ComputedDatumBase } from './ComputedData'
|
|
1
|
+
import type { ComputedDatumBase, ComputedDatumCategoryValue } from './ComputedData'
|
|
2
2
|
|
|
3
3
|
export type ComputedDataRelationship = {
|
|
4
4
|
nodes: ComputedNode[]
|
|
5
5
|
edges: ComputedEdge[]
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
export interface ComputedNode extends ComputedDatumBase {
|
|
8
|
+
export interface ComputedNode extends ComputedDatumBase, ComputedDatumCategoryValue {
|
|
9
9
|
startNodes: ComputedNode[]
|
|
10
10
|
startNodeIds: string[]
|
|
11
11
|
endNodes: ComputedNode[]
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ComputedDatumBase } from './ComputedData'
|
|
1
|
+
import type { ComputedDatumBase, ComputedDatumCategoryValue } from './ComputedData'
|
|
2
2
|
|
|
3
3
|
// export type ComputedDataTree = ComputedDataTreeDatum[]
|
|
4
4
|
|
|
@@ -13,7 +13,7 @@ import type { ComputedDatumBase } from './ComputedData'
|
|
|
13
13
|
// }
|
|
14
14
|
|
|
15
15
|
// 樹狀結構
|
|
16
|
-
export interface ComputedDataTree extends ComputedDatumBase {
|
|
16
|
+
export interface ComputedDataTree extends ComputedDatumBase, ComputedDatumCategoryValue {
|
|
17
17
|
level: number
|
|
18
18
|
seq: number
|
|
19
19
|
children?: ComputedDataTree[]
|
|
@@ -18,7 +18,7 @@ export interface ContextObserverGridDetail {
|
|
|
18
18
|
gridGraphicReverseScale$: Observable<[number, number][]>
|
|
19
19
|
gridAxesSize$: Observable<{ width: number; height: number; }>
|
|
20
20
|
gridHighlight$: Observable<string[]>
|
|
21
|
-
|
|
21
|
+
existSeriesLabels$: Observable<string[]>
|
|
22
22
|
SeriesDataMap$: Observable<Map<string, ComputedDatumGrid[]>>
|
|
23
23
|
GroupDataMap$: Observable<Map<string, ComputedDatumGrid[]>>
|
|
24
24
|
visibleComputedData$: Observable<ComputedDataGrid>
|
|
@@ -19,7 +19,7 @@ export interface ContextObserverMultiGrid<PluginParams> extends ContextObserverB
|
|
|
19
19
|
// gridGraphicReverseScale$: Observable<[number, number][]>
|
|
20
20
|
// gridAxesSize$: Observable<{ width: number; height: number; }>
|
|
21
21
|
// gridHighlight$: Observable<string[]>
|
|
22
|
-
//
|
|
22
|
+
// existSeriesLabels$: Observable<string[]>
|
|
23
23
|
// SeriesDataMap$: Observable<Map<string, ComputedDatumGrid[]>>
|
|
24
24
|
// GroupDataMap$: Observable<Map<string, ComputedDatumGrid[]>>
|
|
25
25
|
// visibleComputedData$: Observable<ComputedDataGrid>
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
import { Observable } from 'rxjs'
|
|
1
2
|
import type { ContextObserverBase } from './ContextObserver'
|
|
3
|
+
import type { ComputedDataTree } from './ComputedDataTree'
|
|
2
4
|
|
|
3
5
|
export interface ContextObserverTree<PluginParams> extends ContextObserverBase<'tree', PluginParams> {
|
|
4
|
-
|
|
6
|
+
treeHighlight$: Observable<string[]>
|
|
7
|
+
existCategoryLabels$: Observable<string[]>
|
|
8
|
+
CategoryDataMap$: Observable<Map<string, ComputedDataTree[]>>
|
|
9
|
+
visibleComputedData$: Observable<ComputedDataTree>
|
|
5
10
|
}
|
|
@@ -9,13 +9,13 @@ import type {
|
|
|
9
9
|
import type { AxisPosition } from './Axis'
|
|
10
10
|
|
|
11
11
|
export interface DataFormatterMultiGrid extends DataFormatterBase<'multiGrid'> {
|
|
12
|
-
visibleFilter: VisibleFilter<'multiGrid'>
|
|
12
|
+
// visibleFilter: VisibleFilter<'multiGrid'>
|
|
13
13
|
gridList: Array<DataFormatterGridGrid>
|
|
14
14
|
container: DataFormatterMultiGridContainer
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
export interface DataFormatterMultiGridPartial extends DataFormatterBasePartial<'multiGrid'> {
|
|
18
|
-
visibleFilter?: VisibleFilter<'multiGrid'>
|
|
18
|
+
// visibleFilter?: VisibleFilter<'multiGrid'>
|
|
19
19
|
gridList?: Array<DataFormatterGridGridPartial>
|
|
20
20
|
container?: Partial<DataFormatterMultiGridContainer>
|
|
21
21
|
}
|
|
@@ -5,7 +5,7 @@ import { DataFormatterBase, DataFormatterBasePartial, VisibleFilter } from './Da
|
|
|
5
5
|
export interface DataFormatterSeries extends DataFormatterBase<'series'> {
|
|
6
6
|
visibleFilter: VisibleFilter<'series'>
|
|
7
7
|
// series: DataFormatterSeriesSeries
|
|
8
|
-
unitLabel: string
|
|
8
|
+
// unitLabel: string
|
|
9
9
|
seriesLabels: string[]
|
|
10
10
|
// labelFormat: (datum: DataSeriesDatum) => string
|
|
11
11
|
// mapSeries: (datum: DataSeriesDatum | DataSeriesValue, rowIndex: number, columnIndex: number, context: DataFormatterContext<'series'>) => string
|
|
@@ -16,7 +16,7 @@ export interface DataFormatterSeries extends DataFormatterBase<'series'> {
|
|
|
16
16
|
|
|
17
17
|
export interface DataFormatterSeriesPartial extends DataFormatterBasePartial<'series'> {
|
|
18
18
|
// series: Partial<DataFormatterSeriesSeries>
|
|
19
|
-
unitLabel?: string
|
|
19
|
+
// unitLabel?: string
|
|
20
20
|
seriesLabels?: string[]
|
|
21
21
|
// colorsPredicate?: (datum: DataSeriesDatum | DataSeriesValue, rowIndex: number, columnIndex: number, context: DataFormatterContext<'series'>) => string
|
|
22
22
|
sort?: ((a: DataSeriesDatum | DataSeriesValue, b: DataSeriesDatum | number) => number) | null
|
|
@@ -6,6 +6,7 @@ export interface DataFormatterTree
|
|
|
6
6
|
visibleFilter: VisibleFilter<'tree'>
|
|
7
7
|
// labelFormat: (datum: unknown) => string
|
|
8
8
|
// descriptionFormat: (datum: unknown) => string
|
|
9
|
+
categoryLabels: string[]
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
export type DataFormatterTreePartial = Partial<DataFormatterTree>
|
package/src/types/DataTree.ts
CHANGED
|
@@ -7,6 +7,7 @@ export interface DataTreeObj extends DatumBase {
|
|
|
7
7
|
id: string
|
|
8
8
|
value?: number
|
|
9
9
|
children?: DataTreeObj[]
|
|
10
|
+
categoryLabel?: string
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
// 陣列資料
|
|
@@ -14,5 +15,6 @@ export interface DataTreeDatum extends DatumBase {
|
|
|
14
15
|
id: string
|
|
15
16
|
value?: number
|
|
16
17
|
parent?: string
|
|
18
|
+
categoryLabel?: string
|
|
17
19
|
}
|
|
18
20
|
|
package/src/types/Event.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type { ComputedDataSeries, ComputedDatumSeries } from './ComputedDataSeri
|
|
|
5
5
|
import type { ComputedDataGrid, ComputedDatumGrid } from './ComputedDataGrid'
|
|
6
6
|
import type { ComputedDataMultiGrid } from './ComputedDataMultiGrid'
|
|
7
7
|
import type { ComputedDataMultiValue, ComputedDatumMultiValue } from './ComputedDataMultiValue'
|
|
8
|
-
import type { ComputedNode } from './ComputedDataRelationship'
|
|
8
|
+
import type { ComputedDataRelationship, ComputedNode } from './ComputedDataRelationship'
|
|
9
9
|
import type { ComputedDataTree } from './ComputedDataTree'
|
|
10
10
|
import type { HighlightTarget } from './ChartParams'
|
|
11
11
|
|
|
@@ -41,74 +41,113 @@ export type EventTypeMap<T extends ChartType> = T extends 'series' ? EventSeries
|
|
|
41
41
|
: T extends 'multiValue' ? EventMultiValue
|
|
42
42
|
: T extends 'relationship' ? EventRelationship
|
|
43
43
|
: T extends 'tree' ? EventTree
|
|
44
|
-
: EventBase
|
|
44
|
+
: EventBase<any>
|
|
45
45
|
|
|
46
|
-
export interface EventBase {
|
|
46
|
+
export interface EventBase<T extends ChartType> {
|
|
47
|
+
type: T
|
|
47
48
|
eventName: EventName
|
|
48
49
|
pluginName: string
|
|
49
|
-
// data: EventData
|
|
50
|
-
type: ChartType
|
|
51
50
|
event: MouseEvent | undefined
|
|
52
51
|
highlightTarget: HighlightTarget
|
|
53
|
-
datum: ComputedDatumBase | null
|
|
52
|
+
// datum: ComputedDatumBase | null
|
|
54
53
|
tween?: number
|
|
55
54
|
}
|
|
56
55
|
|
|
57
|
-
export interface
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
series: ComputedDatumSeries[]
|
|
56
|
+
export interface EventBaseSeriesValue<DatumType, DataType> {
|
|
57
|
+
data: DataType
|
|
58
|
+
series: DatumType[]
|
|
61
59
|
seriesIndex: number
|
|
62
60
|
seriesLabel: string
|
|
63
|
-
datum:
|
|
64
|
-
// highlightTarget: 'series' | 'datum' | 'none'
|
|
65
|
-
// highlightLabel: string | null
|
|
66
|
-
// highlightId: string | null
|
|
61
|
+
datum: DatumType | null
|
|
67
62
|
}
|
|
68
63
|
|
|
69
|
-
export interface
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
series:
|
|
64
|
+
export interface EventBaseGridValue<DatumType, DataType> {
|
|
65
|
+
data: DataType
|
|
66
|
+
gridIndex: number
|
|
67
|
+
series: DatumType[]
|
|
73
68
|
seriesIndex: number
|
|
74
69
|
seriesLabel: string
|
|
75
|
-
groups:
|
|
70
|
+
groups: DatumType[]
|
|
76
71
|
groupIndex: number
|
|
77
72
|
groupLabel: string
|
|
78
|
-
datum:
|
|
79
|
-
// highlightTarget: 'series' | 'group' | 'datum' | 'none'
|
|
80
|
-
// highlightLabel: string | null
|
|
81
|
-
// highlightId: string | null
|
|
73
|
+
datum: DatumType | null
|
|
82
74
|
}
|
|
83
75
|
|
|
84
|
-
export interface
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
//
|
|
96
|
-
//
|
|
97
|
-
//
|
|
76
|
+
export interface EventBaseCategoryValue<DatumType, DataType> {
|
|
77
|
+
data: DataType
|
|
78
|
+
category: DatumType[]
|
|
79
|
+
categoryIndex: number
|
|
80
|
+
categoryLabel: string
|
|
81
|
+
datum: DatumType | null
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export interface EventSeries extends EventBase<'series'>, EventBaseSeriesValue<ComputedDatumSeries, ComputedDataSeries> {
|
|
85
|
+
// type: 'series'
|
|
86
|
+
// data: ComputedDataSeries
|
|
87
|
+
// series: ComputedDatumSeries[]
|
|
88
|
+
// seriesIndex: number
|
|
89
|
+
// seriesLabel: string
|
|
90
|
+
// datum: ComputedDatumSeries | null
|
|
91
|
+
// // highlightTarget: 'series' | 'datum' | 'none'
|
|
92
|
+
// // highlightLabel: string | null
|
|
93
|
+
// // highlightId: string | null
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export interface EventGrid extends EventBase<'grid'>, EventBaseGridValue<ComputedDatumGrid, ComputedDataGrid> {
|
|
97
|
+
// type: 'grid'
|
|
98
|
+
// data: ComputedDataGrid
|
|
99
|
+
// series: ComputedDatumGrid[]
|
|
100
|
+
// seriesIndex: number
|
|
101
|
+
// seriesLabel: string
|
|
102
|
+
// groups: ComputedDatumGrid[]
|
|
103
|
+
// groupIndex: number
|
|
104
|
+
// groupLabel: string
|
|
105
|
+
// datum: ComputedDatumGrid | null
|
|
106
|
+
// // highlightTarget: 'series' | 'group' | 'datum' | 'none'
|
|
107
|
+
// // highlightLabel: string | null
|
|
108
|
+
// // highlightId: string | null
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export interface EventMultiGrid extends EventBase<'multiGrid'>, EventBaseGridValue<ComputedDatumGrid, ComputedDataMultiGrid> {
|
|
112
|
+
// type: 'multiGrid'
|
|
113
|
+
// data: ComputedDataMultiGrid
|
|
114
|
+
// gridIndex: number
|
|
115
|
+
// series: ComputedDatumGrid[]
|
|
116
|
+
// seriesIndex: number
|
|
117
|
+
// seriesLabel: string
|
|
118
|
+
// group: ComputedDatumGrid[]
|
|
119
|
+
// groupIndex: number
|
|
120
|
+
// groupLabel: string
|
|
121
|
+
// datum: ComputedDatumGrid | null
|
|
122
|
+
// // highlightTarget: 'series' | 'group' | 'datum' | 'none'
|
|
123
|
+
// // highlightLabel: string | null
|
|
124
|
+
// // highlightId: string | null
|
|
98
125
|
}
|
|
99
126
|
|
|
100
|
-
export interface EventMultiValue extends EventBase {
|
|
101
|
-
type: 'multiValue'
|
|
102
|
-
|
|
127
|
+
export interface EventMultiValue extends EventBase<'multiValue'>, EventBaseCategoryValue<ComputedDatumMultiValue, ComputedDataMultiValue> {
|
|
128
|
+
// type: 'multiValue'
|
|
129
|
+
// data: ComputedDataMultiValue
|
|
130
|
+
// category: ComputedDatumMultiValue[]
|
|
131
|
+
// categoryIndex: number
|
|
132
|
+
// categoryLabel: string
|
|
133
|
+
// datum: ComputedDatumMultiValue | null
|
|
103
134
|
}
|
|
104
135
|
|
|
105
|
-
export interface EventRelationship extends EventBase {
|
|
106
|
-
type: 'relationship'
|
|
107
|
-
|
|
136
|
+
export interface EventRelationship extends EventBase<'relationship'>, EventBaseCategoryValue<ComputedNode, ComputedDataRelationship> {
|
|
137
|
+
// type: 'relationship'
|
|
138
|
+
// data: ComputedDataRelationship
|
|
139
|
+
// category: ComputedNode[]
|
|
140
|
+
// categoryIndex: number
|
|
141
|
+
// categoryLabel: string
|
|
142
|
+
// datum: ComputedNode | null
|
|
108
143
|
}
|
|
109
144
|
|
|
110
|
-
export interface EventTree extends EventBase {
|
|
111
|
-
type: 'tree'
|
|
112
|
-
|
|
145
|
+
export interface EventTree extends EventBase<'tree'>, EventBaseCategoryValue<ComputedDataTree, ComputedDataTree> {
|
|
146
|
+
// type: 'tree'
|
|
147
|
+
// data: ComputedDataTree
|
|
148
|
+
// category: ComputedDataTree[]
|
|
149
|
+
// categoryIndex: number
|
|
150
|
+
// categoryLabel: string
|
|
151
|
+
// datum: ComputedDataTree | null
|
|
113
152
|
}
|
|
114
153
|
|
package/src/utils/d3Utils.ts
CHANGED
|
@@ -15,7 +15,6 @@ export const createAxisLinearScale = ({
|
|
|
15
15
|
scaleDomain: [number | 'auto', number | 'auto']
|
|
16
16
|
scaleRange: [number, number] // 0-1
|
|
17
17
|
}) => {
|
|
18
|
-
|
|
19
18
|
// -- 無值補上預設值 --
|
|
20
19
|
const domainMin: number | 'auto' = scaleDomain[0] ?? DATA_FORMATTER_VALUE_AXIS.scaleDomain[0]
|
|
21
20
|
const domainMax: number | 'auto' = scaleDomain[1] ?? DATA_FORMATTER_VALUE_AXIS.scaleDomain[1]
|