@orbcharts/core 3.0.0-alpha.41 → 3.0.0-alpha.43

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. package/LICENSE +200 -200
  2. package/dist/orbcharts-core.es.js +1906 -1897
  3. package/dist/orbcharts-core.umd.js +2 -2
  4. package/dist/src/defaults.d.ts +4 -3
  5. package/dist/src/grid/computeGridData.d.ts +4 -11
  6. package/dist/src/grid/gridObservables.d.ts +15 -18
  7. package/dist/src/multiGrid/multiGridObservables.d.ts +4 -11
  8. package/dist/src/series/seriesObservables.d.ts +26 -1
  9. package/dist/src/types/ComputedData.d.ts +1 -0
  10. package/dist/src/types/ComputedDataGrid.d.ts +0 -3
  11. package/dist/src/types/ComputedDataSeries.d.ts +1 -2
  12. package/dist/src/types/ContextObserverGrid.d.ts +11 -4
  13. package/dist/src/types/ContextObserverMultiGrid.d.ts +8 -3
  14. package/dist/src/types/ContextObserverSeries.d.ts +18 -0
  15. package/dist/src/types/DataFormatter.d.ts +8 -5
  16. package/dist/src/types/DataFormatterGrid.d.ts +13 -16
  17. package/dist/src/types/DataFormatterMultiGrid.d.ts +6 -3
  18. package/dist/src/types/DataFormatterMultiValue.d.ts +3 -0
  19. package/dist/src/types/DataFormatterRelationship.d.ts +3 -0
  20. package/dist/src/types/DataFormatterSeries.d.ts +10 -3
  21. package/dist/src/utils/orbchartsUtils.d.ts +14 -13
  22. package/package.json +41 -41
  23. package/src/AbstractChart.ts +48 -48
  24. package/src/GridChart.ts +20 -20
  25. package/src/MultiGridChart.ts +20 -20
  26. package/src/MultiValueChart.ts +20 -20
  27. package/src/RelationshipChart.ts +20 -20
  28. package/src/SeriesChart.ts +20 -20
  29. package/src/TreeChart.ts +20 -20
  30. package/src/base/createBaseChart.ts +367 -367
  31. package/src/base/createBasePlugin.ts +89 -89
  32. package/src/defaults.ts +220 -248
  33. package/src/defineGridPlugin.ts +3 -3
  34. package/src/defineMultiGridPlugin.ts +3 -3
  35. package/src/defineMultiValuePlugin.ts +3 -3
  36. package/src/defineNoneDataPlugin.ts +4 -4
  37. package/src/defineRelationshipPlugin.ts +3 -3
  38. package/src/defineSeriesPlugin.ts +3 -3
  39. package/src/defineTreePlugin.ts +3 -3
  40. package/src/grid/computeGridData.ts +134 -205
  41. package/src/grid/createGridContextObserver.ts +147 -130
  42. package/src/grid/gridObservables.ts +573 -486
  43. package/src/index.ts +21 -21
  44. package/src/multiGrid/computeMultiGridData.ts +130 -173
  45. package/src/multiGrid/createMultiGridContextObserver.ts +40 -40
  46. package/src/multiGrid/multiGridObservables.ts +350 -285
  47. package/src/multiValue/computeMultiValueData.ts +143 -136
  48. package/src/multiValue/createMultiValueContextObserver.ts +12 -12
  49. package/src/relationship/computeRelationshipData.ts +118 -106
  50. package/src/relationship/createRelationshipContextObserver.ts +12 -12
  51. package/src/series/computeSeriesData.ts +90 -153
  52. package/src/series/createSeriesContextObserver.ts +93 -38
  53. package/src/series/seriesObservables.ts +176 -24
  54. package/src/tree/computeTreeData.ts +131 -128
  55. package/src/tree/createTreeContextObserver.ts +61 -61
  56. package/src/tree/treeObservables.ts +94 -94
  57. package/src/types/Chart.ts +48 -48
  58. package/src/types/ChartParams.ts +51 -51
  59. package/src/types/ComputedData.ts +83 -82
  60. package/src/types/ComputedDataGrid.ts +13 -13
  61. package/src/types/ComputedDataMultiGrid.ts +2 -2
  62. package/src/types/ComputedDataMultiValue.ts +9 -9
  63. package/src/types/ComputedDataRelationship.ts +19 -19
  64. package/src/types/ComputedDataSeries.ts +8 -8
  65. package/src/types/ComputedDataTree.ts +19 -19
  66. package/src/types/ContextObserver.ts +38 -38
  67. package/src/types/ContextObserverGrid.ts +41 -33
  68. package/src/types/ContextObserverMultiGrid.ts +16 -28
  69. package/src/types/ContextObserverMultiValue.ts +4 -4
  70. package/src/types/ContextObserverRelationship.ts +4 -4
  71. package/src/types/ContextObserverSeries.ts +29 -9
  72. package/src/types/ContextObserverTree.ts +11 -11
  73. package/src/types/ContextSubject.ts +18 -18
  74. package/src/types/Data.ts +45 -45
  75. package/src/types/DataFormatter.ts +74 -95
  76. package/src/types/DataFormatterGrid.ts +67 -55
  77. package/src/types/DataFormatterMultiGrid.ts +44 -42
  78. package/src/types/DataFormatterMultiValue.ts +23 -20
  79. package/src/types/DataFormatterRelationship.ts +25 -22
  80. package/src/types/DataFormatterSeries.ts +20 -30
  81. package/src/types/DataFormatterTree.ts +12 -12
  82. package/src/types/DataGrid.ts +11 -11
  83. package/src/types/DataMultiGrid.ts +6 -6
  84. package/src/types/DataMultiValue.ts +12 -12
  85. package/src/types/DataRelationship.ts +27 -27
  86. package/src/types/DataSeries.ts +11 -11
  87. package/src/types/DataTree.ts +20 -20
  88. package/src/types/Event.ts +153 -153
  89. package/src/types/Layout.ts +11 -11
  90. package/src/types/Padding.ts +5 -5
  91. package/src/types/Plugin.ts +60 -60
  92. package/src/types/TransformData.ts +7 -7
  93. package/src/types/index.ts +37 -37
  94. package/src/utils/commonUtils.ts +50 -50
  95. package/src/utils/d3Utils.ts +89 -89
  96. package/src/utils/index.ts +4 -4
  97. package/src/utils/observables.ts +201 -201
  98. package/src/utils/orbchartsUtils.ts +349 -253
  99. package/tsconfig.json +13 -13
  100. package/vite.config.js +44 -44
@@ -1,51 +1,51 @@
1
- import type { Padding } from './Padding'
2
-
3
- export interface ChartParams {
4
- padding: Padding,
5
- highlightTarget: HighlightTarget
6
- highlightDefault: string | null
7
- colorScheme: 'dark' | 'light'
8
- colors: {
9
- light: ColorScheme
10
- dark: ColorScheme
11
- }
12
- styles: Styles
13
- transitionDuration: number
14
- transitionEase: string
15
- // [key: string]: any
16
- }
17
-
18
- export type ChartParamsPartial = Partial<ChartParams | {
19
- padding: Partial<Padding>,
20
- colors: Partial<{
21
- light: Partial<ColorScheme>
22
- dark: Partial<ColorScheme>
23
- }>
24
- styles: Partial<Styles>
25
- }>
26
-
27
- function test (): ChartParamsPartial {
28
- return {
29
- colorScheme: 'dark',
30
- padding: {
31
- top: 10
32
- }
33
- }
34
- }
35
-
36
- export type HighlightTarget = 'series' | 'group' | 'category' | 'datum' | 'none'
37
-
38
- export interface Styles {
39
- textSize: string | number
40
- unhighlightedOpacity: number
41
- }
42
-
43
- export interface ColorScheme {
44
- series: string[]
45
- primary: string
46
- secondary: string
47
- white: string
48
- background: string
49
- }
50
-
51
- export type ColorType = 'none' | keyof ColorScheme
1
+ import type { Padding } from './Padding'
2
+
3
+ export interface ChartParams {
4
+ padding: Padding,
5
+ highlightTarget: HighlightTarget
6
+ highlightDefault: string | null
7
+ colorScheme: 'dark' | 'light'
8
+ colors: {
9
+ light: ColorScheme
10
+ dark: ColorScheme
11
+ }
12
+ styles: Styles
13
+ transitionDuration: number
14
+ transitionEase: string
15
+ // [key: string]: any
16
+ }
17
+
18
+ export type ChartParamsPartial = Partial<ChartParams | {
19
+ padding: Partial<Padding>,
20
+ colors: Partial<{
21
+ light: Partial<ColorScheme>
22
+ dark: Partial<ColorScheme>
23
+ }>
24
+ styles: Partial<Styles>
25
+ }>
26
+
27
+ function test (): ChartParamsPartial {
28
+ return {
29
+ colorScheme: 'dark',
30
+ padding: {
31
+ top: 10
32
+ }
33
+ }
34
+ }
35
+
36
+ export type HighlightTarget = 'series' | 'group' | 'category' | 'datum' | 'none'
37
+
38
+ export interface Styles {
39
+ textSize: string | number
40
+ unhighlightedOpacity: number
41
+ }
42
+
43
+ export interface ColorScheme {
44
+ series: string[]
45
+ primary: string
46
+ secondary: string
47
+ white: string
48
+ background: string
49
+ }
50
+
51
+ export type ColorType = 'none' | keyof ColorScheme
@@ -1,83 +1,84 @@
1
- import type { ChartType } from './Chart'
2
- import type { ComputedDataSeries, ComputedDatumSeries } from './ComputedDataSeries'
3
- import type { ComputedDataGrid, ComputedDatumGrid } from './ComputedDataGrid'
4
- import type { ComputedDataMultiGrid } from './ComputedDataMultiGrid'
5
- import type { ComputedDataMultiValue, ComputedDatumMultiValue } from './ComputedDataMultiValue'
6
- import type { ComputedDataRelationship, ComputedNode } from './ComputedDataRelationship'
7
- import type { ComputedDataTree } from './ComputedDataTree'
8
- import type { DataFormatterContext } from './DataFormatter'
9
-
10
- export interface ComputedDataFn<T extends ChartType> {
11
- (dataFormatterContext: DataFormatterContext<T>): ComputedDataTypeMap<T>
12
- }
13
-
14
- // datum - 基本型本
15
- export interface ComputedDatumBase {
16
- id: string
17
- index: number
18
- label: string
19
- value: number | null
20
- visible: boolean
21
- description: string
22
- data: any // 使用者注入的資料
23
- }
24
-
25
- // datum - 單值
26
- // export interface ComputedDatumValue {
27
- // value: number | null
28
- // // valueLabel: string
29
- // }
30
-
31
- // datum - 多值
32
- // export interface ComputedDatumMultiValue {
33
- // value: number[]
34
- // valueLabels: string[]
35
- // }
36
-
37
- // datum - 圖軸
38
- // export interface ComputedDatumWithAxis {
39
- // axisX: number
40
- // axisY: number
41
- // }
42
-
43
- // datum - 序列資料
44
- export interface ComputedDatumSeriesValue {
45
- color: string
46
- seriesIndex: number
47
- seriesLabel: string
48
- }
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
-
67
- // 透過類型選擇ComputedData
68
- export type ComputedDataTypeMap<T extends ChartType> = T extends 'series' ? ComputedDataSeries
69
- : T extends 'grid' ? ComputedDataGrid
70
- : T extends 'multiGrid' ? ComputedDataMultiGrid
71
- : T extends 'multiValue' ? ComputedDataMultiValue
72
- : T extends 'relationship' ? ComputedDataRelationship
73
- : T extends 'tree' ? ComputedDataTree
74
- : ComputedDatumBase
75
-
76
- // 透過類型選擇ComputedDatum
77
- export type ComputedDatumTypeMap<T extends ChartType> = T extends 'series' ? ComputedDatumSeries
78
- : T extends 'grid' ? ComputedDatumGrid
79
- : T extends 'multiGrid' ? ComputedDatumGrid
80
- : T extends 'multiValue' ? ComputedDatumMultiValue
81
- : T extends 'relationship' ? ComputedNode
82
- : T extends 'tree' ? ComputedDataTree
1
+ import type { ChartType } from './Chart'
2
+ import type { ComputedDataSeries, ComputedDatumSeries } from './ComputedDataSeries'
3
+ import type { ComputedDataGrid, ComputedDatumGrid } from './ComputedDataGrid'
4
+ import type { ComputedDataMultiGrid } from './ComputedDataMultiGrid'
5
+ import type { ComputedDataMultiValue, ComputedDatumMultiValue } from './ComputedDataMultiValue'
6
+ import type { ComputedDataRelationship, ComputedNode } from './ComputedDataRelationship'
7
+ import type { ComputedDataTree } from './ComputedDataTree'
8
+ import type { DataFormatterContext } from './DataFormatter'
9
+
10
+ export interface ComputedDataFn<T extends ChartType> {
11
+ (dataFormatterContext: DataFormatterContext<T>): ComputedDataTypeMap<T>
12
+ }
13
+
14
+ // datum - 基本型本
15
+ export interface ComputedDatumBase {
16
+ id: string
17
+ index: number
18
+ label: string
19
+ value: number | null
20
+ visible: boolean
21
+ description: string
22
+ data: any // 使用者注入的資料
23
+ }
24
+
25
+ // datum - 單值
26
+ // export interface ComputedDatumValue {
27
+ // value: number | null
28
+ // // valueLabel: string
29
+ // }
30
+
31
+ // datum - 多值
32
+ // export interface ComputedDatumMultiValue {
33
+ // value: number[]
34
+ // valueLabels: string[]
35
+ // }
36
+
37
+ // datum - 圖軸
38
+ // export interface ComputedDatumWithAxis {
39
+ // axisX: number
40
+ // axisY: number
41
+ // }
42
+
43
+ // datum - 序列資料
44
+ export interface ComputedDatumSeriesValue {
45
+ color: string
46
+ seriesIndex: number
47
+ seriesLabel: string
48
+ seq: number
49
+ }
50
+
51
+ // datum - 矩陣資料
52
+ export interface ComputedDatumGridValue {
53
+ gridIndex: number
54
+ color: string
55
+ seriesIndex: number
56
+ seriesLabel: string
57
+ groupIndex: number
58
+ groupLabel: string
59
+ }
60
+
61
+ // datum - 類別資料
62
+ export interface ComputedDatumCategoryValue {
63
+ color: string
64
+ categoryIndex: number
65
+ categoryLabel: string | null
66
+ }
67
+
68
+ // 透過類型選擇ComputedData
69
+ export type ComputedDataTypeMap<T extends ChartType> = T extends 'series' ? ComputedDataSeries
70
+ : T extends 'grid' ? ComputedDataGrid
71
+ : T extends 'multiGrid' ? ComputedDataMultiGrid
72
+ : T extends 'multiValue' ? ComputedDataMultiValue
73
+ : T extends 'relationship' ? ComputedDataRelationship
74
+ : T extends 'tree' ? ComputedDataTree
75
+ : ComputedDatumBase
76
+
77
+ // 透過類型選擇ComputedDatum
78
+ export type ComputedDatumTypeMap<T extends ChartType> = T extends 'series' ? ComputedDatumSeries
79
+ : T extends 'grid' ? ComputedDatumGrid
80
+ : T extends 'multiGrid' ? ComputedDatumGrid
81
+ : T extends 'multiValue' ? ComputedDatumMultiValue
82
+ : T extends 'relationship' ? ComputedNode
83
+ : T extends 'tree' ? ComputedDataTree
83
84
  : unknown
@@ -1,14 +1,14 @@
1
- import { ComputedDatumBase, ComputedDatumGridValue } from './ComputedData'
2
-
3
- export interface ComputedDatumGrid
4
- extends ComputedDatumBase, ComputedDatumGridValue {
5
- // accSeriesIndex: number // 每一個grid累加的seriesIndex
6
- // gridIndex: number
7
- // groupIndex: number
8
- // groupLabel: string
9
- axisX: number
10
- axisY: number
11
- axisYFromZero: number
12
- }
13
-
1
+ import { ComputedDatumBase, ComputedDatumGridValue } from './ComputedData'
2
+
3
+ export interface ComputedDatumGrid
4
+ extends ComputedDatumBase, ComputedDatumGridValue {
5
+ // accSeriesIndex: number // 每一個grid累加的seriesIndex
6
+ // gridIndex: number
7
+ // groupIndex: number
8
+ // groupLabel: string
9
+ // axisX: number
10
+ // axisY: number
11
+ // axisYFromZero: number
12
+ }
13
+
14
14
  export type ComputedDataGrid = ComputedDatumGrid[][]
@@ -1,3 +1,3 @@
1
- import { ComputedDataGrid } from './ComputedDataGrid'
2
-
1
+ import { ComputedDataGrid } from './ComputedDataGrid'
2
+
3
3
  export type ComputedDataMultiGrid = ComputedDataGrid[]
@@ -1,9 +1,9 @@
1
- import type { ComputedDatumBase, ComputedDatumCategoryValue } from './ComputedData'
2
-
3
- export type ComputedDataMultiValue = ComputedDatumMultiValue[][]
4
-
5
- export interface ComputedDatumMultiValue extends ComputedDatumBase, ComputedDatumCategoryValue {
6
- axis: number
7
- }
8
-
9
-
1
+ import type { ComputedDatumBase, ComputedDatumCategoryValue } from './ComputedData'
2
+
3
+ export type ComputedDataMultiValue = ComputedDatumMultiValue[][]
4
+
5
+ export interface ComputedDatumMultiValue extends ComputedDatumBase, ComputedDatumCategoryValue {
6
+ axis: number
7
+ }
8
+
9
+
@@ -1,20 +1,20 @@
1
- import type { ComputedDatumBase, ComputedDatumCategoryValue } from './ComputedData'
2
-
3
- export type ComputedDataRelationship = {
4
- nodes: ComputedNode[]
5
- edges: ComputedEdge[]
6
- }
7
-
8
- export interface ComputedNode extends ComputedDatumBase, ComputedDatumCategoryValue {
9
- startNodes: ComputedNode[]
10
- startNodeIds: string[]
11
- endNodes: ComputedNode[]
12
- endNodeIds: string[]
13
- }
14
-
15
- export interface ComputedEdge extends ComputedDatumBase {
16
- startNode: ComputedNode
17
- startNodeId: string
18
- endNode: ComputedNode
19
- endNodeId: string
1
+ import type { ComputedDatumBase, ComputedDatumCategoryValue } from './ComputedData'
2
+
3
+ export type ComputedDataRelationship = {
4
+ nodes: ComputedNode[]
5
+ edges: ComputedEdge[]
6
+ }
7
+
8
+ export interface ComputedNode extends ComputedDatumBase, ComputedDatumCategoryValue {
9
+ startNodes: ComputedNode[]
10
+ startNodeIds: string[]
11
+ endNodes: ComputedNode[]
12
+ endNodeIds: string[]
13
+ }
14
+
15
+ export interface ComputedEdge extends ComputedDatumBase {
16
+ startNode: ComputedNode
17
+ startNodeId: string
18
+ endNode: ComputedNode
19
+ endNodeId: string
20
20
  }
@@ -1,8 +1,8 @@
1
- import { ComputedDatumBase, ComputedDatumSeriesValue } from './ComputedData'
2
-
3
- export interface ComputedDatumSeries
4
- extends ComputedDatumBase, ComputedDatumSeriesValue {
5
- sortedIndex: number
6
- }
7
-
8
- export type ComputedDataSeries = ComputedDatumSeries[]
1
+ import { ComputedDatumBase, ComputedDatumSeriesValue } from './ComputedData'
2
+
3
+ export interface ComputedDatumSeries
4
+ extends ComputedDatumBase, ComputedDatumSeriesValue {
5
+
6
+ }
7
+
8
+ export type ComputedDataSeries = ComputedDatumSeries[][]
@@ -1,20 +1,20 @@
1
- import type { ComputedDatumBase, ComputedDatumCategoryValue } from './ComputedData'
2
-
3
- // export type ComputedDataTree = ComputedDataTreeDatum[]
4
-
5
- // export interface ComputedDataTreeDatum extends ComputedDatum {
6
- // // id: string
7
- // children: ComputedDataTreeDatum[]
8
- // childrenIds: string[]
9
- // // ChildrenMap: Map<string, ComputedDataTreeDatum>
10
- // parent: ComputedDataTreeDatum
11
- // parentId: string
12
- // value?: number
13
- // }
14
-
15
- // 樹狀結構
16
- export interface ComputedDataTree extends ComputedDatumBase, ComputedDatumCategoryValue {
17
- level: number
18
- seq: number
19
- children?: ComputedDataTree[]
1
+ import type { ComputedDatumBase, ComputedDatumCategoryValue } from './ComputedData'
2
+
3
+ // export type ComputedDataTree = ComputedDataTreeDatum[]
4
+
5
+ // export interface ComputedDataTreeDatum extends ComputedDatum {
6
+ // // id: string
7
+ // children: ComputedDataTreeDatum[]
8
+ // childrenIds: string[]
9
+ // // ChildrenMap: Map<string, ComputedDataTreeDatum>
10
+ // parent: ComputedDataTreeDatum
11
+ // parentId: string
12
+ // value?: number
13
+ // }
14
+
15
+ // 樹狀結構
16
+ export interface ComputedDataTree extends ComputedDatumBase, ComputedDatumCategoryValue {
17
+ level: number
18
+ seq: number
19
+ children?: ComputedDataTree[]
20
20
  }
@@ -1,38 +1,38 @@
1
- import { Observable, Subject, BehaviorSubject } from 'rxjs'
2
- import type { ChartType } from './Chart'
3
- import type { ChartParams } from './ChartParams'
4
- import type { DataFormatterTypeMap } from './DataFormatter'
5
- import type { ComputedDataTypeMap } from './ComputedData'
6
- import type { Layout } from './Layout'
7
- import type { ContextObserverGrid } from './ContextObserverGrid'
8
- import type { ContextObserverMultiGrid } from './ContextObserverMultiGrid'
9
- import type { ContextObserverMultiValue } from './ContextObserverMultiValue'
10
- import type { ContextObserverRelationship } from './ContextObserverRelationship'
11
- import type { ContextObserverSeries } from './ContextObserverSeries'
12
- import type { ContextObserverTree } from './ContextObserverTree'
13
- import type { ContextSubject } from './ContextSubject'
14
-
15
- export interface ContextObserverFn<T extends ChartType> {
16
- ({ subject, observer }: {
17
- subject: ContextSubject<T>
18
- observer: ContextObserverBase<T, unknown>
19
- }): ContextObserverTypeMap<T, unknown>
20
- }
21
-
22
- // ContextObserver
23
- export type ContextObserverTypeMap<T extends ChartType, PluginParams> = T extends 'series' ? ContextObserverSeries<PluginParams>
24
- : T extends 'grid' ? ContextObserverGrid<PluginParams>
25
- : T extends 'multiGrid' ? ContextObserverMultiGrid<PluginParams>
26
- : T extends 'multiValue' ? ContextObserverMultiValue<PluginParams>
27
- : T extends 'relationship' ? ContextObserverRelationship<PluginParams>
28
- : T extends 'tree' ? ContextObserverTree<PluginParams>
29
- : ContextObserverBase<ChartType, PluginParams>
30
-
31
- export interface ContextObserverBase<T extends ChartType, PluginParams> {
32
- fullParams$: Observable<PluginParams>
33
- fullChartParams$: Observable<ChartParams>
34
- fullDataFormatter$: Observable<DataFormatterTypeMap<T>>
35
- computedData$: Observable<ComputedDataTypeMap<T>>
36
- layout$: Observable<Layout>
37
- }
38
-
1
+ import { Observable, Subject, BehaviorSubject } from 'rxjs'
2
+ import type { ChartType } from './Chart'
3
+ import type { ChartParams } from './ChartParams'
4
+ import type { DataFormatterTypeMap } from './DataFormatter'
5
+ import type { ComputedDataTypeMap } from './ComputedData'
6
+ import type { Layout } from './Layout'
7
+ import type { ContextObserverGrid } from './ContextObserverGrid'
8
+ import type { ContextObserverMultiGrid } from './ContextObserverMultiGrid'
9
+ import type { ContextObserverMultiValue } from './ContextObserverMultiValue'
10
+ import type { ContextObserverRelationship } from './ContextObserverRelationship'
11
+ import type { ContextObserverSeries } from './ContextObserverSeries'
12
+ import type { ContextObserverTree } from './ContextObserverTree'
13
+ import type { ContextSubject } from './ContextSubject'
14
+
15
+ export interface ContextObserverFn<T extends ChartType> {
16
+ ({ subject, observer }: {
17
+ subject: ContextSubject<T>
18
+ observer: ContextObserverBase<T, unknown>
19
+ }): ContextObserverTypeMap<T, unknown>
20
+ }
21
+
22
+ // ContextObserver
23
+ export type ContextObserverTypeMap<T extends ChartType, PluginParams> = T extends 'series' ? ContextObserverSeries<PluginParams>
24
+ : T extends 'grid' ? ContextObserverGrid<PluginParams>
25
+ : T extends 'multiGrid' ? ContextObserverMultiGrid<PluginParams>
26
+ : T extends 'multiValue' ? ContextObserverMultiValue<PluginParams>
27
+ : T extends 'relationship' ? ContextObserverRelationship<PluginParams>
28
+ : T extends 'tree' ? ContextObserverTree<PluginParams>
29
+ : ContextObserverBase<ChartType, PluginParams>
30
+
31
+ export interface ContextObserverBase<T extends ChartType, PluginParams> {
32
+ fullParams$: Observable<PluginParams>
33
+ fullChartParams$: Observable<ChartParams>
34
+ fullDataFormatter$: Observable<DataFormatterTypeMap<T>>
35
+ computedData$: Observable<ComputedDataTypeMap<T>>
36
+ layout$: Observable<Layout>
37
+ }
38
+
@@ -1,34 +1,42 @@
1
- import { Observable } from 'rxjs'
2
- import type { ContextObserverBase } from './ContextObserver'
3
- import type { ComputedDataGrid, ComputedDatumGrid } from './ComputedDataGrid'
4
- import type { TransformData } from './TransformData'
5
-
6
- export interface ContextObserverGrid<PluginParams>
7
- extends
8
- ContextObserverBase<'grid', PluginParams>,
9
- ContextObserverGridDetail {
10
- textSizePx$: Observable<number>
11
- }
12
-
13
- export interface ContextObserverGridDetail {
14
- gridContainer$: Observable<ContainerPosition[]>
15
- gridAxesTransform$: Observable<TransformData>
16
- gridAxesReverseTransform$: Observable<TransformData>
17
- gridGraphicTransform$: Observable<TransformData>
18
- gridGraphicReverseScale$: Observable<[number, number][]>
19
- gridAxesSize$: Observable<{ width: number; height: number; }>
20
- gridHighlight$: Observable<ComputedDatumGrid[]>
21
- existSeriesLabels$: Observable<string[]>
22
- SeriesDataMap$: Observable<Map<string, ComputedDatumGrid[]>>
23
- GroupDataMap$: Observable<Map<string, ComputedDatumGrid[]>>
24
- visibleComputedData$: Observable<ComputedDataGrid>
25
- isSeriesPositionSeprate$: Observable<boolean>
26
- }
27
-
28
- export interface ContainerPosition {
29
- slotIndex: number
30
- rowIndex: number
31
- columnIndex: number
32
- translate: [number, number]
33
- scale: [number, number]
1
+ import { Observable } from 'rxjs'
2
+ import type { ContextObserverBase } from './ContextObserver'
3
+ import type { ComputedDataGrid, ComputedDatumGrid } from './ComputedDataGrid'
4
+ import type { TransformData } from './TransformData'
5
+
6
+ export interface ContextObserverGrid<PluginParams> extends
7
+ ContextObserverBase<'grid', PluginParams>, ContextObserverGridDetail {
8
+ textSizePx$: Observable<number>
9
+ }
10
+
11
+ export interface ContextObserverGridDetail {
12
+ gridContainerPosition$: Observable<GridContainerPosition[]>
13
+ gridAxesTransform$: Observable<TransformData>
14
+ gridAxesReverseTransform$: Observable<TransformData>
15
+ gridGraphicTransform$: Observable<TransformData>
16
+ gridGraphicReverseScale$: Observable<[number, number][]>
17
+ gridAxesSize$: Observable<{ width: number; height: number; }>
18
+ gridHighlight$: Observable<ComputedDatumGrid[]>
19
+ seriesLabels$: Observable<string[]>
20
+ SeriesDataMap$: Observable<Map<string, ComputedDatumGrid[]>>
21
+ GroupDataMap$: Observable<Map<string, ComputedDatumGrid[]>>
22
+ computedLayoutData$: Observable<ComputedLayoutDataGrid>
23
+ visibleComputedData$: Observable<ComputedDataGrid>
24
+ visibleComputedLayoutData$: Observable<ComputedLayoutDataGrid>
25
+ // isSeriesSeprate$: Observable<boolean>
26
+ }
27
+
28
+ export type ComputedLayoutDataGrid = ComputedLayoutDatumGrid[][]
29
+
30
+ export interface ComputedLayoutDatumGrid extends ComputedDatumGrid {
31
+ axisX: number
32
+ axisY: number
33
+ axisYFromZero: number
34
+ }
35
+
36
+ export interface GridContainerPosition {
37
+ slotIndex: number
38
+ rowIndex: number
39
+ columnIndex: number
40
+ translate: [number, number]
41
+ scale: [number, number]
34
42
  }
@@ -1,28 +1,16 @@
1
- import { Observable } from 'rxjs'
2
- import type { ContextObserverBase } from './ContextObserver'
3
- import type { ComputedDataGrid, ComputedDatumGrid } from './ComputedDataGrid'
4
- import type { ContainerPosition } from './ContextObserverGrid'
5
- import type { TransformData } from './TransformData'
6
- import type { ContextObserverGridDetail } from './ContextObserverGrid'
7
-
8
- export interface ContextObserverMultiGrid<PluginParams> extends ContextObserverBase<'multiGrid', PluginParams> {
9
- textSizePx$: Observable<number>
10
- multiGridEachDetail$: Observable<ContextObserverGridDetail[]>
11
- multiGridContainer$: Observable<ContainerPosition[][]>
12
- }
13
-
14
- // export interface MultiGridObservableAll {
15
- // isSeriesPositionSeprate$: Observable<boolean>
16
- // gridContainer$: Observable<ContainerPosition[]>
17
- // gridAxesTransform$: Observable<TransformData>
18
- // gridAxesReverseTransform$: Observable<TransformData>
19
- // gridGraphicTransform$: Observable<TransformData>
20
- // gridGraphicReverseScale$: Observable<[number, number][]>
21
- // gridAxesSize$: Observable<{ width: number; height: number; }>
22
- // gridHighlight$: Observable<string[]>
23
- // existSeriesLabels$: Observable<string[]>
24
- // SeriesDataMap$: Observable<Map<string, ComputedDatumGrid[]>>
25
- // GroupDataMap$: Observable<Map<string, ComputedDatumGrid[]>>
26
- // visibleComputedData$: Observable<ComputedDataGrid>
27
- // }
28
-
1
+ import { Observable } from 'rxjs'
2
+ import type { ContextObserverBase } from './ContextObserver'
3
+ import type { ComputedDataGrid, ComputedDatumGrid } from './ComputedDataGrid'
4
+ import type { DataFormatterGrid } from './DataFormatterGrid'
5
+ import type { ContextObserverGridDetail } from './ContextObserverGrid'
6
+
7
+ export interface ContextObserverMultiGrid<PluginParams> extends ContextObserverBase<'multiGrid', PluginParams> {
8
+ textSizePx$: Observable<number>
9
+ multiGridEachDetail$: Observable<ContextObserverMultiGridDetail[]>
10
+ }
11
+
12
+
13
+ export interface ContextObserverMultiGridDetail extends ContextObserverGridDetail {
14
+ computedData$: Observable<ComputedDataGrid>
15
+ dataFormatter$: Observable<DataFormatterGrid>
16
+ }
@@ -1,5 +1,5 @@
1
- import type { ContextObserverBase } from './ContextObserver'
2
-
3
- export interface ContextObserverMultiValue<PluginParams> extends ContextObserverBase<'multiValue', PluginParams> {
4
-
1
+ import type { ContextObserverBase } from './ContextObserver'
2
+
3
+ export interface ContextObserverMultiValue<PluginParams> extends ContextObserverBase<'multiValue', PluginParams> {
4
+
5
5
  }
@@ -1,5 +1,5 @@
1
- import type { ContextObserverBase } from './ContextObserver'
2
-
3
- export interface ContextObserverRelationship<PluginParams> extends ContextObserverBase<'relationship', PluginParams> {
4
-
1
+ import type { ContextObserverBase } from './ContextObserver'
2
+
3
+ export interface ContextObserverRelationship<PluginParams> extends ContextObserverBase<'relationship', PluginParams> {
4
+
5
5
  }