@orbcharts/core 3.0.0-alpha.60 → 3.0.0-alpha.62

Sign up to get free protection for your applications and to get access to all the features.
Files changed (215) hide show
  1. package/LICENSE +200 -200
  2. package/dist/lib/core-types.d.ts +1 -0
  3. package/dist/orbcharts-core.es.js +3056 -2609
  4. package/dist/orbcharts-core.umd.js +6 -2
  5. package/dist/src/AbstractChart.d.ts +5 -3
  6. package/dist/src/GridChart.d.ts +1 -1
  7. package/dist/src/MultiGridChart.d.ts +1 -1
  8. package/dist/src/MultiValueChart.d.ts +1 -1
  9. package/dist/src/RelationshipChart.d.ts +1 -1
  10. package/dist/src/SeriesChart.d.ts +1 -1
  11. package/dist/src/TreeChart.d.ts +1 -1
  12. package/dist/src/base/createBaseChart.d.ts +1 -1
  13. package/dist/src/base/createBasePlugin.d.ts +1 -1
  14. package/dist/src/base/validators/chartOptionsValidator.d.ts +3 -0
  15. package/dist/src/base/validators/chartParamsValidator.d.ts +3 -0
  16. package/dist/src/base/validators/elementValidator.d.ts +3 -0
  17. package/dist/src/base/validators/pluginsValidator.d.ts +3 -0
  18. package/dist/src/defaults.d.ts +1 -16
  19. package/dist/src/defineGridPlugin.d.ts +1 -1
  20. package/dist/src/defineMultiGridPlugin.d.ts +1 -1
  21. package/dist/src/defineMultiValuePlugin.d.ts +1 -1
  22. package/dist/src/defineNoneDataPlugin.d.ts +1 -1
  23. package/dist/src/defineRelationshipPlugin.d.ts +1 -1
  24. package/dist/src/defineSeriesPlugin.d.ts +1 -1
  25. package/dist/src/defineTreePlugin.d.ts +1 -1
  26. package/dist/src/grid/computedDataFn.d.ts +4 -0
  27. package/dist/src/grid/contextObserverCallback.d.ts +3 -0
  28. package/dist/src/grid/dataFormatterValidator.d.ts +3 -0
  29. package/dist/src/grid/dataValidator.d.ts +3 -0
  30. package/dist/src/index.d.ts +1 -1
  31. package/dist/src/multiGrid/computedDataFn.d.ts +3 -0
  32. package/dist/src/multiGrid/contextObserverCallback.d.ts +3 -0
  33. package/dist/src/multiGrid/dataFormatterValidator.d.ts +3 -0
  34. package/dist/src/multiGrid/dataValidator.d.ts +3 -0
  35. package/dist/src/multiValue/computedDataFn.d.ts +3 -0
  36. package/dist/src/multiValue/contextObserverCallback.d.ts +3 -0
  37. package/dist/src/multiValue/dataFormatterValidator.d.ts +3 -0
  38. package/dist/src/multiValue/dataValidator.d.ts +3 -0
  39. package/dist/src/relationship/computedDataFn.d.ts +3 -0
  40. package/dist/src/relationship/contextObserverCallback.d.ts +3 -0
  41. package/dist/src/relationship/dataFormatterValidator.d.ts +3 -0
  42. package/dist/src/relationship/dataValidator.d.ts +3 -0
  43. package/dist/src/series/computedDataFn.d.ts +3 -0
  44. package/dist/src/series/contextObserverCallback.d.ts +3 -0
  45. package/dist/src/series/dataFormatterValidator.d.ts +3 -0
  46. package/dist/src/series/dataValidator.d.ts +3 -0
  47. package/dist/src/tree/computedDataFn.d.ts +3 -0
  48. package/dist/src/tree/contextObserverCallback.d.ts +3 -0
  49. package/dist/src/tree/dataFormatterValidator.d.ts +3 -0
  50. package/dist/src/tree/dataValidator.d.ts +3 -0
  51. package/dist/src/utils/commonUtils.d.ts +1 -0
  52. package/dist/src/utils/errorMessage.d.ts +14 -0
  53. package/dist/src/{grid → utils}/gridObservables.d.ts +2 -2
  54. package/dist/src/utils/index.d.ts +7 -3
  55. package/dist/src/{multiGrid → utils}/multiGridObservables.d.ts +1 -1
  56. package/dist/src/utils/observables.d.ts +2 -1
  57. package/dist/src/utils/orbchartsUtils.d.ts +1 -12
  58. package/dist/src/{series → utils}/seriesObservables.d.ts +3 -3
  59. package/dist/src/{tree → utils}/treeObservables.d.ts +1 -1
  60. package/dist/src/utils/validator.d.ts +3 -0
  61. package/lib/core-types.ts +7 -0
  62. package/package.json +42 -41
  63. package/src/AbstractChart.ts +57 -48
  64. package/src/GridChart.ts +24 -20
  65. package/src/MultiGridChart.ts +24 -20
  66. package/src/MultiValueChart.ts +24 -20
  67. package/src/RelationshipChart.ts +24 -20
  68. package/src/SeriesChart.ts +24 -20
  69. package/src/TreeChart.ts +24 -20
  70. package/src/base/createBaseChart.ts +500 -386
  71. package/src/base/createBasePlugin.ts +152 -95
  72. package/src/base/validators/chartOptionsValidator.ts +24 -0
  73. package/src/base/validators/chartParamsValidator.ts +134 -0
  74. package/src/base/validators/elementValidator.ts +14 -0
  75. package/src/base/validators/pluginsValidator.ts +15 -0
  76. package/src/defaults.ts +232 -226
  77. package/src/defineGridPlugin.ts +3 -3
  78. package/src/defineMultiGridPlugin.ts +3 -3
  79. package/src/defineMultiValuePlugin.ts +3 -3
  80. package/src/defineNoneDataPlugin.ts +4 -4
  81. package/src/defineRelationshipPlugin.ts +3 -3
  82. package/src/defineSeriesPlugin.ts +3 -3
  83. package/src/defineTreePlugin.ts +3 -3
  84. package/src/grid/{computeGridData.ts → computedDataFn.ts} +129 -134
  85. package/src/grid/{createGridContextObserver.ts → contextObserverCallback.ts} +155 -155
  86. package/src/grid/dataFormatterValidator.ts +9 -0
  87. package/src/grid/dataValidator.ts +9 -0
  88. package/src/index.ts +20 -21
  89. package/src/multiGrid/{computeMultiGridData.ts → computedDataFn.ts} +123 -130
  90. package/src/multiGrid/{createMultiGridContextObserver.ts → contextObserverCallback.ts} +41 -41
  91. package/src/multiGrid/dataFormatterValidator.ts +9 -0
  92. package/src/multiGrid/dataValidator.ts +9 -0
  93. package/src/multiValue/{computeMultiValueData.ts → computedDataFn.ts} +176 -179
  94. package/src/multiValue/{createMultiValueContextObserver.ts → contextObserverCallback.ts} +12 -12
  95. package/src/multiValue/dataFormatterValidator.ts +9 -0
  96. package/src/multiValue/dataValidator.ts +9 -0
  97. package/src/relationship/{computeRelationshipData.ts → computedDataFn.ts} +125 -118
  98. package/src/relationship/{createRelationshipContextObserver.ts → contextObserverCallback.ts} +12 -12
  99. package/src/relationship/dataFormatterValidator.ts +9 -0
  100. package/src/relationship/dataValidator.ts +9 -0
  101. package/src/series/{computeSeriesData.ts → computedDataFn.ts} +88 -90
  102. package/src/series/{createSeriesContextObserver.ts → contextObserverCallback.ts} +100 -93
  103. package/src/series/dataFormatterValidator.ts +9 -0
  104. package/src/series/dataValidator.ts +9 -0
  105. package/src/tree/{computeTreeData.ts → computedDataFn.ts} +130 -132
  106. package/src/tree/{createTreeContextObserver.ts → contextObserverCallback.ts} +61 -61
  107. package/src/tree/dataFormatterValidator.ts +9 -0
  108. package/src/tree/dataValidator.ts +9 -0
  109. package/src/utils/commonUtils.ts +54 -50
  110. package/src/utils/d3Utils.ts +108 -108
  111. package/src/utils/errorMessage.ts +43 -0
  112. package/src/{grid → utils}/gridObservables.ts +611 -614
  113. package/src/utils/index.ts +10 -4
  114. package/src/{multiGrid → utils}/multiGridObservables.ts +366 -365
  115. package/src/utils/observables.ts +218 -202
  116. package/src/utils/orbchartsUtils.ts +352 -349
  117. package/src/{series → utils}/seriesObservables.ts +175 -175
  118. package/src/{tree → utils}/treeObservables.ts +94 -94
  119. package/src/utils/validator.ts +126 -0
  120. package/tsconfig.base.json +13 -13
  121. package/tsconfig.json +2 -2
  122. package/vite-env.d.ts +7 -0
  123. package/vite.config.js +22 -22
  124. package/dist/src/grid/computeGridData.d.ts +0 -6
  125. package/dist/src/grid/createGridContextObserver.d.ts +0 -3
  126. package/dist/src/multiGrid/computeMultiGridData.d.ts +0 -3
  127. package/dist/src/multiGrid/createMultiGridContextObserver.d.ts +0 -3
  128. package/dist/src/multiValue/computeMultiValueData.d.ts +0 -3
  129. package/dist/src/multiValue/createMultiValueContextObserver.d.ts +0 -3
  130. package/dist/src/relationship/computeRelationshipData.d.ts +0 -3
  131. package/dist/src/relationship/createRelationshipContextObserver.d.ts +0 -3
  132. package/dist/src/series/computeSeriesData.d.ts +0 -3
  133. package/dist/src/series/createSeriesContextObserver.d.ts +0 -3
  134. package/dist/src/tree/computeTreeData.d.ts +0 -3
  135. package/dist/src/tree/createTreeContextObserver.d.ts +0 -3
  136. package/dist/src/types/Axis.d.ts +0 -1
  137. package/dist/src/types/Chart.d.ts +0 -45
  138. package/dist/src/types/ChartParams.d.ts +0 -36
  139. package/dist/src/types/ComputedData.d.ts +0 -42
  140. package/dist/src/types/ComputedDataGrid.d.ts +0 -5
  141. package/dist/src/types/ComputedDataMultiGrid.d.ts +0 -3
  142. package/dist/src/types/ComputedDataMultiValue.d.ts +0 -6
  143. package/dist/src/types/ComputedDataRelationship.d.ts +0 -18
  144. package/dist/src/types/ComputedDataSeries.d.ts +0 -5
  145. package/dist/src/types/ComputedDataTree.d.ts +0 -7
  146. package/dist/src/types/ContextObserver.d.ts +0 -28
  147. package/dist/src/types/ContextObserverGrid.d.ts +0 -41
  148. package/dist/src/types/ContextObserverMultiGrid.d.ts +0 -15
  149. package/dist/src/types/ContextObserverMultiValue.d.ts +0 -4
  150. package/dist/src/types/ContextObserverRelationship.d.ts +0 -4
  151. package/dist/src/types/ContextObserverSeries.d.ts +0 -27
  152. package/dist/src/types/ContextObserverTree.d.ts +0 -11
  153. package/dist/src/types/ContextSubject.d.ts +0 -15
  154. package/dist/src/types/Data.d.ts +0 -19
  155. package/dist/src/types/DataFormatter.d.ts +0 -41
  156. package/dist/src/types/DataFormatterGrid.d.ts +0 -34
  157. package/dist/src/types/DataFormatterMultiGrid.d.ts +0 -20
  158. package/dist/src/types/DataFormatterMultiValue.d.ts +0 -18
  159. package/dist/src/types/DataFormatterRelationship.d.ts +0 -10
  160. package/dist/src/types/DataFormatterSeries.d.ts +0 -19
  161. package/dist/src/types/DataFormatterTree.d.ts +0 -7
  162. package/dist/src/types/DataGrid.d.ts +0 -6
  163. package/dist/src/types/DataMultiGrid.d.ts +0 -6
  164. package/dist/src/types/DataMultiValue.d.ts +0 -7
  165. package/dist/src/types/DataRelationship.d.ts +0 -21
  166. package/dist/src/types/DataSeries.d.ts +0 -6
  167. package/dist/src/types/DataTree.d.ts +0 -15
  168. package/dist/src/types/Event.d.ts +0 -56
  169. package/dist/src/types/Layout.d.ts +0 -8
  170. package/dist/src/types/Padding.d.ts +0 -6
  171. package/dist/src/types/Plugin.d.ts +0 -37
  172. package/dist/src/types/TransformData.d.ts +0 -8
  173. package/dist/src/types/index.d.ts +0 -37
  174. package/src/types/Axis.ts +0 -1
  175. package/src/types/Chart.ts +0 -54
  176. package/src/types/ChartParams.ts +0 -51
  177. package/src/types/ComputedData.ts +0 -84
  178. package/src/types/ComputedDataGrid.ts +0 -14
  179. package/src/types/ComputedDataMultiGrid.ts +0 -3
  180. package/src/types/ComputedDataMultiValue.ts +0 -9
  181. package/src/types/ComputedDataRelationship.ts +0 -20
  182. package/src/types/ComputedDataSeries.ts +0 -8
  183. package/src/types/ComputedDataTree.ts +0 -20
  184. package/src/types/ContextObserver.ts +0 -38
  185. package/src/types/ContextObserverGrid.ts +0 -43
  186. package/src/types/ContextObserverMultiGrid.ts +0 -17
  187. package/src/types/ContextObserverMultiValue.ts +0 -5
  188. package/src/types/ContextObserverRelationship.ts +0 -5
  189. package/src/types/ContextObserverSeries.ts +0 -29
  190. package/src/types/ContextObserverTree.ts +0 -11
  191. package/src/types/ContextSubject.ts +0 -18
  192. package/src/types/Data.ts +0 -45
  193. package/src/types/DataFormatter.ts +0 -74
  194. package/src/types/DataFormatterGrid.ts +0 -68
  195. package/src/types/DataFormatterMultiGrid.ts +0 -45
  196. package/src/types/DataFormatterMultiValue.ts +0 -24
  197. package/src/types/DataFormatterRelationship.ts +0 -26
  198. package/src/types/DataFormatterSeries.ts +0 -20
  199. package/src/types/DataFormatterTree.ts +0 -12
  200. package/src/types/DataGrid.ts +0 -11
  201. package/src/types/DataMultiGrid.ts +0 -7
  202. package/src/types/DataMultiValue.ts +0 -12
  203. package/src/types/DataRelationship.ts +0 -28
  204. package/src/types/DataSeries.ts +0 -11
  205. package/src/types/DataTree.ts +0 -20
  206. package/src/types/Event.ts +0 -153
  207. package/src/types/Layout.ts +0 -12
  208. package/src/types/Padding.ts +0 -6
  209. package/src/types/Plugin.ts +0 -60
  210. package/src/types/TransformData.ts +0 -8
  211. package/src/types/index.ts +0 -37
  212. /package/dist/src/{multiValue → utils}/multiValueObservables.d.ts +0 -0
  213. /package/dist/src/{relationship → utils}/relationshipObservables.d.ts +0 -0
  214. /package/src/{multiValue → utils}/multiValueObservables.ts +0 -0
  215. /package/src/{relationship → utils}/relationshipObservables.ts +0 -0
@@ -1,5 +0,0 @@
1
- import type { ContextObserverBase } from './ContextObserver'
2
-
3
- export interface ContextObserverRelationship<PluginParams> extends ContextObserverBase<'relationship', PluginParams> {
4
-
5
- }
@@ -1,29 +0,0 @@
1
- import { Observable } from 'rxjs'
2
- import type { ContextObserverBase } from './ContextObserver'
3
- import type { ComputedDatumSeries } from './ComputedDataSeries'
4
-
5
- export interface ContextObserverSeries<PluginParams> extends ContextObserverBase<'series', PluginParams> {
6
- textSizePx$: Observable<number>
7
- separateSeries$: Observable<boolean>
8
- visibleComputedData$: Observable<ComputedDatumSeries[][]>
9
- computedLayoutData$: Observable<ComputedDatumSeries[][]>
10
- visibleComputedLayoutData$: Observable<ComputedDatumSeries[][]>
11
- seriesHighlight$: Observable<ComputedDatumSeries[]>
12
- seriesLabels$: Observable<string[]>
13
- SeriesDataMap$: Observable<Map<string, ComputedDatumSeries[]>>
14
- seriesContainerPosition$: Observable<SeriesContainerPosition[]>
15
- SeriesContainerPositionMap$: Observable<Map<string, SeriesContainerPosition>>
16
- }
17
-
18
- export interface SeriesContainerPosition {
19
- slotIndex: number
20
- rowIndex: number
21
- columnIndex: number
22
- // translate: [number, number]
23
- startX: number
24
- startY: number
25
- centerX: number
26
- centerY: number
27
- width: number
28
- height: number
29
- }
@@ -1,11 +0,0 @@
1
- import { Observable } from 'rxjs'
2
- import type { ContextObserverBase } from './ContextObserver'
3
- import type { ComputedDataTree } from './ComputedDataTree'
4
-
5
- export interface ContextObserverTree<PluginParams> extends ContextObserverBase<'tree', PluginParams> {
6
- textSizePx$: Observable<number>
7
- treeHighlight$: Observable<ComputedDataTree[]>
8
- existCategoryLabels$: Observable<string[]>
9
- CategoryDataMap$: Observable<Map<string, ComputedDataTree[]>>
10
- visibleComputedData$: Observable<ComputedDataTree>
11
- }
@@ -1,18 +0,0 @@
1
- import { Observable, Subject, BehaviorSubject } from 'rxjs'
2
- import type { ChartType } from './Chart'
3
- import type { EventTypeMap } from './Event'
4
- import type { ChartParamsPartial } from './ChartParams'
5
- // import type { Data } from './Data'
6
- import type { DataFormatterPartialTypeMap } from './DataFormatter'
7
- import type { DataTypeMap } from './Data'
8
- import type { DataFormatterTypeMap } from './DataFormatter'
9
- import type { PluginEntity } from './Plugin'
10
-
11
- export interface ContextSubject<T extends ChartType> {
12
- data$: Subject<DataTypeMap<T>>
13
- dataFormatter$: Subject<DataFormatterPartialTypeMap<T>>
14
- plugins$: Subject<PluginEntity<T, any, any>[]>
15
- // pluginParams$: Subject<{[keys: string]: unknown}>
16
- chartParams$: Subject<ChartParamsPartial>
17
- event$: Subject<EventTypeMap<T>>
18
- }
package/src/types/Data.ts DELETED
@@ -1,45 +0,0 @@
1
- import { ChartType } from './Chart'
2
- import { DataSeries, DataSeriesDatum, DataSeriesValue } from './DataSeries'
3
- import { DataGrid, DataGridDatum, DataGridValue } from './DataGrid'
4
- import { DataMultiGrid, DataMultiGridDatum, DataMultiGridValue } from './DataMultiGrid'
5
- import { DataMultiValue, DataMultiValueDatum, DataMultiValueValue } from './DataMultiValue'
6
- import { DataTree, DataTreeDatum, DataTreeObj } from './DataTree'
7
- import { DataRelationship, Node, Edge } from './DataRelationship'
8
-
9
- // 基本欄位(皆為可選,無填寫則在計算時產生預設值)
10
- export interface DatumBase {
11
- id?: string
12
- label?: string
13
- description?: string
14
- data?: any // 使用者注入的資料
15
- }
16
-
17
- // 需具備value的datum
18
- export interface DatumValue {
19
- value: number | null
20
- }
21
-
22
- // 透過類型選擇Data
23
- export type DataTypeMap<T extends ChartType> = T extends 'series' ? DataSeries
24
- : T extends 'grid' ? DataGrid
25
- : T extends 'multiGrid' ? DataMultiGrid
26
- : T extends 'multiValue' ? DataMultiValue
27
- : T extends 'relationship' ? DataRelationship
28
- : T extends 'tree' ? DataTree
29
- : unknown
30
-
31
- // 透過類型選擇Datum
32
- export type DatumTypeMap<T extends ChartType> = T extends 'series' ? DataSeriesDatum | DataSeriesValue
33
- : T extends 'grid' ? DataGridDatum | DataGridValue
34
- : T extends 'multiGrid' ? DataMultiGridDatum | DataMultiGridValue
35
- : T extends 'multiValue' ? DataMultiValueDatum | DataMultiValueValue
36
- : T extends 'relationship' ? Node | Edge
37
- : T extends 'tree' ? DataTreeDatum | DataTreeObj
38
- : unknown
39
-
40
- // export type Data = DataSeries
41
- // | DataGrid
42
- // | DataMultiGrid
43
- // | DataMultiValue
44
- // | DataTree
45
- // | DataRelationship
@@ -1,74 +0,0 @@
1
- import type { ChartType } from './Chart'
2
- import type { ChartParams } from './ChartParams'
3
- import type { DataTypeMap, DatumTypeMap } from './Data'
4
- import type { ComputedDataTypeMap, ComputedDatumTypeMap } from './ComputedData'
5
- import type { DataFormatterSeries, DataFormatterSeriesPartial } from './DataFormatterSeries'
6
- import type { DataFormatterGrid, DataFormatterGridPartial } from './DataFormatterGrid'
7
- import type { DataFormatterMultiGrid, DataFormatterMultiGridPartial } from './DataFormatterMultiGrid'
8
- import type { DataFormatterMultiValue, DataFormatterMultiValuePartial } from './DataFormatterMultiValue'
9
- import type { DataFormatterTree, DataFormatterTreePartial } from './DataFormatterTree'
10
- import type { DataFormatterRelationship, DataFormatterRelationshipPartial } from './DataFormatterRelationship'
11
- import type { AxisPosition } from './Axis'
12
-
13
-
14
- // dataFormatter計算當中會使用的資料
15
- export interface DataFormatterContext<T extends ChartType> {
16
- data: DataTypeMap<T>
17
- dataFormatter: DataFormatterTypeMap<T>
18
- chartParams: ChartParams
19
- // layout: Layout
20
- }
21
-
22
-
23
- // 透過類型選擇DataFormatter
24
- export type DataFormatterTypeMap<T extends ChartType> = T extends 'series' ? DataFormatterSeries
25
- : T extends 'grid' ? DataFormatterGrid
26
- : T extends 'multiGrid' ? DataFormatterMultiGrid
27
- : T extends 'multiValue' ? DataFormatterMultiValue
28
- : T extends 'relationship' ? DataFormatterRelationship
29
- : T extends 'tree' ? DataFormatterTree
30
- : DataFormatterBase<T>
31
-
32
- // 透過類型選擇DataFormatter(可選欄位)
33
- export type DataFormatterPartialTypeMap<T extends ChartType> = T extends 'series' ? DataFormatterSeriesPartial
34
- : T extends 'grid' ? DataFormatterGridPartial
35
- : T extends 'multiGrid' ? DataFormatterMultiGridPartial
36
- : T extends 'multiValue' ? DataFormatterMultiValuePartial
37
- : T extends 'relationship' ? DataFormatterRelationshipPartial
38
- : T extends 'tree' ? DataFormatterTreePartial
39
- : DataFormatterBasePartial<T>
40
-
41
- // 基本介面
42
- export interface DataFormatterBase<T extends ChartType> {
43
- type: T
44
- }
45
-
46
- export type DataFormatterBasePartial<T extends ChartType> = Partial<DataFormatterBase<T>>
47
-
48
- export interface DataFormatterValueAxis {
49
- position: AxisPosition
50
- scaleDomain: [number | 'min' | 'auto', number | 'max' | 'auto']
51
- scaleRange: [number, number]
52
- label: string
53
- }
54
-
55
- export interface DataFormatterGroupAxis {
56
- position: AxisPosition
57
- scaleDomain: [number, number | 'max']
58
- scalePadding: number
59
- label: string
60
- }
61
-
62
-
63
- // export type ValueFormat = string | ((text: d3.NumberValue) => string)
64
-
65
- export type VisibleFilter<T extends ChartType> = (datum: ComputedDatumTypeMap<T>, context: DataFormatterContext<T>) => boolean | null
66
-
67
- // export type TooltipContentFormat<T extends ChartType> = (datum: DatumTypeMap<T>, rowIndex: number, columnIndex: number, context: DataFormatterContext<T>) => string | null
68
-
69
- export interface DataFormatterContainer {
70
- gap: number
71
- rowAmount: number
72
- columnAmount: number
73
- }
74
-
@@ -1,68 +0,0 @@
1
- import type {
2
- DataFormatterBase,
3
- DataFormatterBasePartial,
4
- DataFormatterValueAxis,
5
- DataFormatterGroupAxis,
6
- VisibleFilter,
7
- DataFormatterContainer
8
- } from './DataFormatter'
9
-
10
-
11
- export type SeriesDirection = 'row' | 'column' // default: 'row'
12
-
13
- export interface DataFormatterGrid extends DataFormatterBase<'grid'> {
14
- visibleFilter: VisibleFilter<'grid'>
15
- grid: DataFormatterGridGrid
16
- container: DataFormatterContainer
17
- }
18
-
19
- export interface DataFormatterGridPartial extends DataFormatterBasePartial<'grid'> {
20
- visibleFilter?: VisibleFilter<'grid'>
21
- grid?: DataFormatterGridGridPartial
22
- container?: Partial<DataFormatterContainer>
23
- }
24
-
25
- export interface DataFormatterGridGrid {
26
- // gridData: DataFormatterGridGridData
27
- // slotIndex: number | null
28
- // seriesSlotIndexes: number[] | null
29
- seriesDirection: SeriesDirection
30
- rowLabels: string[]
31
- columnLabels: string[]
32
- valueAxis: DataFormatterValueAxis
33
- groupAxis: DataFormatterGroupAxis
34
- separateSeries: boolean
35
- }
36
-
37
- export interface DataFormatterGridGridPartial {
38
- // gridData?: Partial<DataFormatterGridGridData>
39
- // slotIndex?: number | null
40
- // seriesSlotIndexes?: number[] | null
41
- seriesDirection?: SeriesDirection
42
- rowLabels?: string[]
43
- columnLabels?: string[]
44
- valueAxis?: Partial<DataFormatterValueAxis>
45
- groupAxis?: Partial<DataFormatterGroupAxis>
46
- separateSeries?: boolean
47
- }
48
-
49
- export interface DataFormatterGridContainer {
50
- gap: number
51
- rowAmount: number
52
- columnAmount: number
53
- }
54
-
55
- // grid欄位
56
- // export interface DataFormatterGridGridData {
57
- // seriesDirection: SeriesDirection
58
- // rowLabels: string[]
59
- // columnLabels: string[]
60
- // }
61
-
62
- // const test: DataFormatterGridPartial = {
63
- // type: 'grid',
64
- // grid: {
65
- // rowLabels: [],
66
- // // a: ''
67
- // }
68
- // }
@@ -1,45 +0,0 @@
1
- import type { VisibleFilter, DataFormatterContainer } from './DataFormatter'
2
- import type { DataFormatterGridGrid, DataFormatterGridGridPartial } from './DataFormatterGrid'
3
- import type {
4
- DataFormatterBase,
5
- DataFormatterBasePartial,
6
- DataFormatterValueAxis,
7
- DataFormatterGroupAxis,
8
- DataFormatterContext } from './DataFormatter'
9
- import type { AxisPosition } from './Axis'
10
-
11
- export interface DataFormatterMultiGrid extends DataFormatterBase<'multiGrid'> {
12
- visibleFilter: VisibleFilter<'multiGrid'>
13
- gridList: Array<DataFormatterGridGrid>
14
- container: DataFormatterMultiGridContainer
15
- separateGrid: boolean
16
- }
17
-
18
- export interface DataFormatterMultiGridPartial extends DataFormatterBasePartial<'multiGrid'> {
19
- // visibleFilter?: VisibleFilter<'multiGrid'>
20
- gridList?: Array<DataFormatterGridGridPartial>
21
- container?: Partial<DataFormatterMultiGridContainer>
22
- separateGrid?: boolean
23
- }
24
-
25
- export interface DataFormatterMultiGridGrid extends DataFormatterGridGrid {
26
-
27
- }
28
-
29
- export interface DataFormatterMultiGridGridPartial extends DataFormatterGridGridPartial {
30
-
31
- }
32
-
33
- // container
34
- export interface DataFormatterMultiGridContainer extends DataFormatterContainer {
35
-
36
- }
37
-
38
- // multiGrid欄位
39
- // export interface DataFormatterMultiGridMultiGrid {
40
- // grid: DataFormatterGridGridData
41
- // valueAxis: DataFormatterValueAxis // default: 'left'
42
- // groupAxis: DataFormatterGroupAxis // default: 'bottom'
43
- // colorsPredicate: (datum: DataGridDatum | DataGridValue, rowIndex: number, columnIndex: number, context: DataFormatterContext<'grid'>) => string
44
- // // colors: Colors
45
- // }
@@ -1,24 +0,0 @@
1
- import { DataMultiValueDatum, DataMultiValue } from './DataMultiValue'
2
- import { DataFormatterBase, DataFormatterBasePartial, DataFormatterValueAxis, VisibleFilter } from './DataFormatter'
3
-
4
- export interface DataFormatterMultiValue extends DataFormatterBase<'multiValue'> {
5
- visibleFilter: VisibleFilter<'multiValue'>
6
- // labelFormat: (datum: unknown) => string
7
- categoryLabels: string[]
8
- multiValue: Array<DataFormatterMultiValueMultiValue>
9
- xAxis: DataFormatterValueAxis
10
- yAxis: DataFormatterValueAxis
11
- }
12
-
13
- export interface DataFormatterMultiValuePartial extends DataFormatterBasePartial<'multiValue'> {
14
- visibleFilter?: VisibleFilter<'multiValue'>
15
- categoryLabels?: string[]
16
- multiValue?: Array<Partial<DataFormatterMultiValueMultiValue>>
17
- xAxis?: Partial<DataFormatterValueAxis>
18
- yAxis?: Partial<DataFormatterValueAxis>
19
- }
20
-
21
- // multiValue欄位
22
- export interface DataFormatterMultiValueMultiValue {
23
- // unitLabel: string
24
- }
@@ -1,26 +0,0 @@
1
- import { Node, Edge, DataRelationship } from './DataRelationship'
2
- import { DataFormatterBase, DataFormatterBasePartial, VisibleFilter } from './DataFormatter'
3
-
4
- export interface DataFormatterRelationship extends DataFormatterBase<'relationship'> {
5
- visibleFilter: VisibleFilter<'relationship'>
6
- categoryLabels: string[]
7
- // node: DataFormatterRelationshipNode
8
- // edge: DataFormatterRelationshipEdge
9
- }
10
-
11
- export interface DataFormatterRelationshipPartial extends DataFormatterBasePartial<'relationship'> {
12
- visibleFilter?: VisibleFilter<'relationship'>
13
- categoryLabels?: string[]
14
- // node: Partial<DataFormatterRelationshipNode>
15
- // edge: Partial<DataFormatterRelationshipEdge>
16
- }
17
-
18
- // export interface DataFormatterRelationshipNode {
19
- // labelFormat: (node: unknown) => string
20
- // descriptionFormat: (node: unknown) => string
21
- // }
22
-
23
- // export interface DataFormatterRelationshipEdge {
24
- // labelFormat: (edge: unknown, startNode: unknown, endNode: unknown) => string
25
- // descriptionFormat: (edge: unknown, startNode: unknown, endNode: unknown) => string
26
- // }
@@ -1,20 +0,0 @@
1
- import type { ComputedDatumSeries } from './ComputedDataSeries'
2
- import type { DataFormatterBase, DataFormatterBasePartial, VisibleFilter, DataFormatterContainer } from './DataFormatter'
3
-
4
- export interface DataFormatterSeries extends DataFormatterBase<'series'> {
5
- visibleFilter: VisibleFilter<'series'>
6
- sort: ((a: ComputedDatumSeries, b: ComputedDatumSeries) => number) | null
7
- seriesLabels: string[]
8
- container: DataFormatterContainer
9
- separateSeries: boolean
10
- sumSeries: boolean
11
- }
12
-
13
- export interface DataFormatterSeriesPartial extends DataFormatterBasePartial<'series'> {
14
- visibleFilter?: VisibleFilter<'series'>
15
- sort?: ((a: ComputedDatumSeries, b: ComputedDatumSeries) => number) | null
16
- seriesLabels?: string[]
17
- container?: Partial<DataFormatterContainer>
18
- separateSeries?: boolean
19
- sumSeries?: boolean
20
- }
@@ -1,12 +0,0 @@
1
- import { DataTreeDatum, DataTree } from './DataTree'
2
- import { DataFormatterBase, VisibleFilter } from './DataFormatter'
3
-
4
- export interface DataFormatterTree
5
- extends DataFormatterBase<'tree'> {
6
- visibleFilter: VisibleFilter<'tree'>
7
- // labelFormat: (datum: unknown) => string
8
- // descriptionFormat: (datum: unknown) => string
9
- categoryLabels: string[]
10
- }
11
-
12
- export type DataFormatterTreePartial = Partial<DataFormatterTree>
@@ -1,11 +0,0 @@
1
- import type { DatumBase, DatumValue } from './Data'
2
-
3
- // export type DataGrid = DataGridDatum[][] | DataGridValue[][]
4
- export type DataGrid = (DataGridDatum | DataGridValue)[][]
5
-
6
- export type DataGridValue = number | null
7
-
8
- export interface DataGridDatum extends DatumBase, DatumValue {
9
- }
10
-
11
-
@@ -1,7 +0,0 @@
1
- import type { DataGrid, DataGridDatum, DataGridValue } from './DataGrid'
2
-
3
- export type DataMultiGrid = DataGrid[]
4
-
5
- export interface DataMultiGridDatum extends DataGridDatum {}
6
-
7
- export type DataMultiGridValue = DataGridValue
@@ -1,12 +0,0 @@
1
- import type { DatumBase, DatumValue } from './Data'
2
-
3
- // export type DataMultiValue = DataMultiValueDatum[][] | DataMultiValueValue[][]
4
- export type DataMultiValue = (DataMultiValueDatum | DataMultiValueValue)[][]
5
-
6
- export type DataMultiValueValue = number
7
-
8
- export interface DataMultiValueDatum extends DatumBase, DatumValue {
9
- categoryLabel?: string
10
- }
11
-
12
-
@@ -1,28 +0,0 @@
1
- import type { DatumBase } from './Data'
2
-
3
- export type DataRelationship = DataRelationshipObj | DataRelationshipList
4
-
5
- // 物件資料
6
- export interface DataRelationshipObj {
7
- nodes: Node[]
8
- edges: Edge[]
9
- }
10
-
11
- // 陣列資料
12
- export type DataRelationshipList = [
13
- Node[],
14
- Edge[]
15
- ]
16
-
17
-
18
- export interface Node extends DatumBase {
19
- id: string
20
- value?: number
21
- categoryLabel?: string
22
- }
23
-
24
- export interface Edge extends DatumBase {
25
- start: string
26
- end: string
27
- value?: number
28
- }
@@ -1,11 +0,0 @@
1
- import type { DatumBase, DatumValue } from './Data'
2
-
3
- // export type DataSeries = DataSeriesDatum[][] | DataSeriesDatum[] | DataSeriesValue[][] | DataSeriesValue[]
4
- export type DataSeries = (DataSeriesDatum | DataSeriesValue)[][] | (DataSeriesDatum | DataSeriesValue)[]
5
-
6
- export type DataSeriesValue = number | null
7
-
8
- export interface DataSeriesDatum extends DatumBase, DatumValue {
9
- }
10
-
11
-
@@ -1,20 +0,0 @@
1
- import type { DatumBase } from './Data'
2
-
3
- export type DataTree = DataTreeObj | DataTreeDatum[]
4
-
5
- // 樹狀結構
6
- export interface DataTreeObj extends DatumBase {
7
- id: string
8
- value?: number
9
- children?: DataTreeObj[]
10
- categoryLabel?: string
11
- }
12
-
13
- // 陣列資料
14
- export interface DataTreeDatum extends DatumBase {
15
- id: string
16
- value?: number
17
- parent?: string
18
- categoryLabel?: string
19
- }
20
-
@@ -1,153 +0,0 @@
1
- import * as d3 from 'd3'
2
- import type { ChartType } from './Chart'
3
- import type { ComputedDatumBase } from './ComputedData'
4
- import type { ComputedDataSeries, ComputedDatumSeries } from './ComputedDataSeries'
5
- import type { ComputedDataGrid, ComputedDatumGrid } from './ComputedDataGrid'
6
- import type { ComputedDataMultiGrid } from './ComputedDataMultiGrid'
7
- import type { ComputedDataMultiValue, ComputedDatumMultiValue } from './ComputedDataMultiValue'
8
- import type { ComputedDataRelationship, ComputedNode } from './ComputedDataRelationship'
9
- import type { ComputedDataTree } from './ComputedDataTree'
10
- import type { HighlightTarget } from './ChartParams'
11
-
12
- export type EventName = 'click'
13
- | 'mouseover'
14
- | 'mousemove'
15
- | 'mouseout'
16
- | 'dragstart'
17
- | 'drag'
18
- | 'dragend'
19
- | 'resize'
20
- | 'transitionMove'
21
- | 'transitionEnd'
22
- // | 'enterDuration'
23
-
24
- // export interface Event<EventData = unknown> {
25
- // eventName: EventName
26
- // data: EventData
27
- // }
28
-
29
- // export interface ShareEvent<EventData = unknown> extends Event<EventData> {
30
- // pluginName: string
31
- // }
32
-
33
- // export interface EventData {
34
-
35
- // }
36
-
37
- // 透過類型選擇Event
38
- export type EventTypeMap<T extends ChartType> = T extends 'series' ? EventSeries
39
- : T extends 'grid' ? EventGrid
40
- : T extends 'multiGrid' ? EventMultiGrid
41
- : T extends 'multiValue' ? EventMultiValue
42
- : T extends 'relationship' ? EventRelationship
43
- : T extends 'tree' ? EventTree
44
- : EventBase<any>
45
-
46
- export interface EventBase<T extends ChartType> {
47
- type: T
48
- eventName: EventName
49
- pluginName: string
50
- event: MouseEvent | undefined
51
- highlightTarget: HighlightTarget
52
- // datum: ComputedDatumBase | null
53
- tween?: number
54
- }
55
-
56
- export interface EventBaseSeriesValue<DatumType, DataType> {
57
- data: DataType
58
- series: DatumType[]
59
- seriesIndex: number
60
- seriesLabel: string
61
- datum: DatumType | null
62
- }
63
-
64
- export interface EventBaseGridValue<DatumType, DataType> {
65
- data: DataType
66
- gridIndex: number
67
- series: DatumType[]
68
- seriesIndex: number
69
- seriesLabel: string
70
- groups: DatumType[]
71
- groupIndex: number
72
- groupLabel: string
73
- datum: DatumType | null
74
- }
75
-
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
125
- }
126
-
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
134
- }
135
-
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
143
- }
144
-
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
152
- }
153
-
@@ -1,12 +0,0 @@
1
- import type { Padding } from './Padding'
2
-
3
- export interface Layout extends Padding {
4
- width: number
5
- height: number
6
- // top: number
7
- // right: number
8
- // bottom: number
9
- // left: number
10
- rootWidth: number
11
- rootHeight: number
12
- }
@@ -1,6 +0,0 @@
1
- export interface Padding {
2
- top: number
3
- right: number
4
- bottom: number
5
- left: number
6
- }