@orbcharts/core 3.0.0-alpha.39 → 3.0.0-alpha.40
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +200 -200
- package/dist/orbcharts-core.es.js +6 -6
- package/dist/orbcharts-core.umd.js +1 -1
- package/dist/src/types/ContextObserverGrid.d.ts +1 -1
- package/dist/src/types/ContextObserverSeries.d.ts +1 -1
- package/dist/src/types/ContextObserverTree.d.ts +1 -1
- package/dist/src/utils/observables.d.ts +5 -5
- package/package.json +41 -41
- package/src/AbstractChart.ts +48 -48
- package/src/GridChart.ts +20 -20
- package/src/MultiGridChart.ts +20 -20
- package/src/MultiValueChart.ts +20 -20
- package/src/RelationshipChart.ts +20 -20
- package/src/SeriesChart.ts +20 -20
- package/src/TreeChart.ts +20 -20
- package/src/base/createBaseChart.ts +367 -367
- package/src/base/createBasePlugin.ts +89 -89
- package/src/defaults.ts +247 -247
- package/src/defineGridPlugin.ts +3 -3
- package/src/defineMultiGridPlugin.ts +3 -3
- package/src/defineMultiValuePlugin.ts +3 -3
- package/src/defineNoneDataPlugin.ts +4 -4
- package/src/defineRelationshipPlugin.ts +3 -3
- package/src/defineSeriesPlugin.ts +3 -3
- package/src/defineTreePlugin.ts +3 -3
- package/src/grid/computeGridData.ts +205 -205
- package/src/grid/createGridContextObserver.ts +124 -124
- package/src/grid/gridObservables.ts +486 -486
- package/src/index.ts +21 -21
- package/src/multiGrid/computeMultiGridData.ts +173 -173
- package/src/multiGrid/createMultiGridContextObserver.ts +34 -34
- package/src/multiGrid/multiGridObservables.ts +285 -285
- package/src/multiValue/computeMultiValueData.ts +136 -136
- package/src/multiValue/createMultiValueContextObserver.ts +12 -12
- package/src/relationship/computeRelationshipData.ts +106 -106
- package/src/relationship/createRelationshipContextObserver.ts +12 -12
- package/src/series/computeSeriesData.ts +153 -153
- package/src/series/createSeriesContextObserver.ts +33 -33
- package/src/series/seriesObservables.ts +23 -23
- package/src/tree/computeTreeData.ts +128 -128
- package/src/tree/createTreeContextObserver.ts +56 -56
- package/src/tree/treeObservables.ts +94 -94
- package/src/types/Chart.ts +48 -48
- package/src/types/ChartParams.ts +51 -51
- package/src/types/ComputedData.ts +82 -82
- package/src/types/ComputedDataGrid.ts +13 -13
- package/src/types/ComputedDataMultiGrid.ts +2 -2
- package/src/types/ComputedDataMultiValue.ts +9 -9
- package/src/types/ComputedDataRelationship.ts +19 -19
- package/src/types/ComputedDataSeries.ts +7 -7
- package/src/types/ComputedDataTree.ts +19 -19
- package/src/types/ContextObserver.ts +38 -38
- package/src/types/ContextObserverGrid.ts +33 -33
- package/src/types/ContextObserverMultiGrid.ts +27 -27
- package/src/types/ContextObserverMultiValue.ts +4 -4
- package/src/types/ContextObserverRelationship.ts +4 -4
- package/src/types/ContextObserverSeries.ts +7 -7
- package/src/types/ContextObserverTree.ts +10 -10
- package/src/types/ContextSubject.ts +18 -18
- package/src/types/Data.ts +45 -45
- package/src/types/DataFormatter.ts +95 -95
- package/src/types/DataFormatterGrid.ts +55 -55
- package/src/types/DataFormatterMultiGrid.ts +42 -42
- package/src/types/DataFormatterMultiValue.ts +20 -20
- package/src/types/DataFormatterRelationship.ts +22 -22
- package/src/types/DataFormatterSeries.ts +29 -29
- package/src/types/DataFormatterTree.ts +12 -12
- package/src/types/DataGrid.ts +11 -11
- package/src/types/DataMultiGrid.ts +6 -6
- package/src/types/DataMultiValue.ts +12 -12
- package/src/types/DataRelationship.ts +27 -27
- package/src/types/DataSeries.ts +11 -11
- package/src/types/DataTree.ts +20 -20
- package/src/types/Event.ts +153 -153
- package/src/types/Layout.ts +11 -11
- package/src/types/Padding.ts +5 -5
- package/src/types/Plugin.ts +60 -60
- package/src/types/TransformData.ts +7 -7
- package/src/types/index.ts +37 -37
- package/src/utils/commonUtils.ts +50 -50
- package/src/utils/d3Utils.ts +89 -89
- package/src/utils/index.ts +4 -4
- package/src/utils/observables.ts +181 -183
- package/src/utils/orbchartsUtils.ts +253 -253
- package/tsconfig.json +13 -13
- package/vite.config.js +44 -44
package/src/defaults.ts
CHANGED
@@ -1,247 +1,247 @@
|
|
1
|
-
// import type { ChartGlobalDefault } from './types/Chart'
|
2
|
-
// import { ChartRenderOptions } from './types/Chart'
|
3
|
-
import type { ChartType, ChartOptionsPartial } from './types/Chart'
|
4
|
-
import type { DataSeries } from './types/DataSeries'
|
5
|
-
import type { DataGrid, DataGridDatum } from './types/DataGrid'
|
6
|
-
import type { DataMultiGrid } from './types/DataMultiGrid'
|
7
|
-
import type { DataMultiValue } from './types/DataMultiValue'
|
8
|
-
import type { DataTree } from './types/DataTree'
|
9
|
-
import type { DataRelationship } from './types/DataRelationship'
|
10
|
-
import type { DataFormatterBase, DataFormatterValueAxis, DataFormatterGroupAxis } from './types/DataFormatter'
|
11
|
-
import type { DataFormatterSeries } from './types/DataFormatterSeries'
|
12
|
-
import type { DataFormatterGrid, DataFormatterGridGrid } from './types/DataFormatterGrid'
|
13
|
-
import type { DataFormatterMultiGrid, DataFormatterMultiGridGrid } from './types/DataFormatterMultiGrid'
|
14
|
-
import type { DataFormatterMultiValue } from './types/DataFormatterMultiValue'
|
15
|
-
import type { DataFormatterTree } from './types/DataFormatterTree'
|
16
|
-
import type { DataFormatterRelationship } from './types/DataFormatterRelationship'
|
17
|
-
import type { ChartParams } from './types/ChartParams'
|
18
|
-
import type { Padding } from './types/Padding'
|
19
|
-
|
20
|
-
export const CHART_OPTIONS_DEFAULT: ChartOptionsPartial<any> = {
|
21
|
-
preset: {} // 預設為空
|
22
|
-
}
|
23
|
-
|
24
|
-
// export const GLOBAL_DEFAULT: ChartGlobalDefault = {
|
25
|
-
// colors: ['#67B7DC', '#6794DC', '#6771DC', '#8067DC', '#A367DC', '#C767DC', '#DC67CE', '#DC67AB', '#DC6788', '#DC6967', '#DC8C67', '#DCAF67'],
|
26
|
-
// padding: {
|
27
|
-
// top: 50,
|
28
|
-
// right: 70,
|
29
|
-
// bottom: 50,
|
30
|
-
// left: 70
|
31
|
-
// },
|
32
|
-
// // chartWidth: '100%',
|
33
|
-
// // chartHeight: 500
|
34
|
-
// }
|
35
|
-
|
36
|
-
// export const COLORS_DEFAULT = ['#67B7DC', '#6794DC', '#6771DC', '#8067DC', '#A367DC', '#C767DC', '#DC67CE', '#DC67AB', '#DC6788', '#DC6967', '#DC8C67', '#DCAF67']
|
37
|
-
// ['#ff7ab9', '#66dec8', '#84c8ff', '#30ad1b', '#f8c43e', '#fa5640', '#9d79d7', '#ea4f98']
|
38
|
-
|
39
|
-
export const PADDING_DEFAULT: Padding = {
|
40
|
-
top: 60,
|
41
|
-
right: 60,
|
42
|
-
bottom: 60,
|
43
|
-
left: 60
|
44
|
-
}
|
45
|
-
|
46
|
-
// export const HIGHLIGHT_DEFAULT: HighlightDefault = {
|
47
|
-
// // trigger: 'datum',
|
48
|
-
// id: null,
|
49
|
-
// label: null
|
50
|
-
// }
|
51
|
-
|
52
|
-
export const CHART_PARAMS_DEFAULT: ChartParams = {
|
53
|
-
padding: PADDING_DEFAULT,
|
54
|
-
highlightTarget: 'datum',
|
55
|
-
// highlightDefault: HIGHLIGHT_DEFAULT,
|
56
|
-
highlightDefault: null,
|
57
|
-
colorScheme: 'light',
|
58
|
-
colors: {
|
59
|
-
light: {
|
60
|
-
series: ['#67B7DC', '#6794DC', '#6771DC', '#8067DC', '#A367DC', '#C767DC', '#DC67CE', '#DC67AB', '#DC6788', '#DC6967', '#DC8C67', '#DCAF67'],
|
61
|
-
// primary: '#454545',
|
62
|
-
primary: '#1b1e23',
|
63
|
-
secondary: '#e1e1e1',
|
64
|
-
white: '#ffffff',
|
65
|
-
background: '#ffffff'
|
66
|
-
},
|
67
|
-
dark: {
|
68
|
-
series: ['#67B7DC', '#6794DC', '#6771DC', '#8067DC', '#A367DC', '#C767DC', '#DC67CE', '#DC67AB', '#DC6788', '#DC6967', '#DC8C67', '#DCAF67'],
|
69
|
-
primary: '#f0f0f0',
|
70
|
-
secondary: '#e1e1e1',
|
71
|
-
white: '#ffffff',
|
72
|
-
background: '#000000'
|
73
|
-
}
|
74
|
-
},
|
75
|
-
styles: {
|
76
|
-
textSize: 14,
|
77
|
-
unhighlightedOpacity: 0.3
|
78
|
-
},
|
79
|
-
transitionDuration: 800,
|
80
|
-
transitionEase: 'easeCubic'
|
81
|
-
}
|
82
|
-
|
83
|
-
export const CHART_WIDTH_DEFAULT = 800
|
84
|
-
|
85
|
-
export const CHART_HEIGHT_DEFAULT = 500
|
86
|
-
|
87
|
-
// -- Data --
|
88
|
-
|
89
|
-
export const DATA_SERIES_DEFAULT: DataSeries = []
|
90
|
-
|
91
|
-
export const DATA_GRID_DEFAULT: DataGrid = []
|
92
|
-
|
93
|
-
export const DATA_MULTI_GRID_DEFAULT: DataMultiGrid = []
|
94
|
-
|
95
|
-
export const DATA_MULTI_VALUE_DEFAULT: DataMultiValue = []
|
96
|
-
|
97
|
-
export const DATA_TREE_DEFAULT: DataTree = []
|
98
|
-
|
99
|
-
export const DATA_RELATIONA_DEFAULTL: DataRelationship = {
|
100
|
-
nodes: [],
|
101
|
-
edges: []
|
102
|
-
}
|
103
|
-
|
104
|
-
// -- Data Formatter --
|
105
|
-
|
106
|
-
// 基本欄位
|
107
|
-
// export const DATA_FORMATTER: DataFormatterBase<ChartType> = {
|
108
|
-
// // ...GLOBAL_DEFAULT,
|
109
|
-
// type: ('' as any), // 後面需複蓋掉否則會有問題
|
110
|
-
// }
|
111
|
-
// 有value
|
112
|
-
// export const DATA_FORMATTER_WITH_VALUE: DataFormatterValue = {
|
113
|
-
// valueFormat: ',.0f'
|
114
|
-
// }
|
115
|
-
// 有axis
|
116
|
-
// export const DATA_FORMATTER_WITH_AXIS: DataFormatterAxis = {
|
117
|
-
// // domainMinValue: 0,
|
118
|
-
// // domainMaxValue: undefined,
|
119
|
-
// // domainMinRange: undefined,
|
120
|
-
// // domainMaxRange: 0.9
|
121
|
-
// valueDomain: [0, 'auto'],
|
122
|
-
// valueRange: [0, 0.9]
|
123
|
-
// }
|
124
|
-
|
125
|
-
export const DATA_FORMATTER_VALUE_AXIS: DataFormatterValueAxis = {
|
126
|
-
position: 'left',
|
127
|
-
scaleDomain: [0, 'auto'],
|
128
|
-
scaleRange: [0, 0.9],
|
129
|
-
label: '',
|
130
|
-
}
|
131
|
-
|
132
|
-
export const DATA_FORMATTER_GROUP_AXIS: DataFormatterGroupAxis = {
|
133
|
-
position: 'bottom',
|
134
|
-
scaleDomain: [0, 'auto'],
|
135
|
-
scalePadding: 0.5,
|
136
|
-
label: ''
|
137
|
-
}
|
138
|
-
|
139
|
-
export const DATA_FORMATTER_SERIES_DEFAULT: DataFormatterSeries = {
|
140
|
-
// ...DATA_FORMATTER_WITH_VALUE,
|
141
|
-
type: 'series',
|
142
|
-
visibleFilter: (datum, rowIndex, columnIndex, context) => true,
|
143
|
-
// unitLabel: '',
|
144
|
-
seriesLabels: [],
|
145
|
-
// mapSeries: (datum, rowIndex, columnIndex, { data, dataFormatter }) => {
|
146
|
-
// const seriesIndex = rowIndex >= dataFormatter.seriesLabels.length
|
147
|
-
// ? rowIndex % dataFormatter.seriesLabels.length // 如果index大於所設定的seriesLabels的數量則從頭回來算
|
148
|
-
// : rowIndex
|
149
|
-
// return dataFormatter.seriesLabels[seriesIndex]
|
150
|
-
// },
|
151
|
-
// colorsPredicate: (datum, rowIndex, columnIndex, { chartParams }) => {
|
152
|
-
// return rowIndex < chartParams.colors[chartParams.colorScheme].series.length
|
153
|
-
// ? chartParams.colors[chartParams.colorScheme].series[rowIndex]
|
154
|
-
// : chartParams.colors[chartParams.colorScheme].series[
|
155
|
-
// rowIndex % chartParams.colors[chartParams.colorScheme].series.length
|
156
|
-
// ]
|
157
|
-
// },
|
158
|
-
sort: null,
|
159
|
-
}
|
160
|
-
|
161
|
-
export const DATA_FORMATTER_GRID_GRID_DEFAULT: DataFormatterGridGrid = {
|
162
|
-
visibleFilter: (datum, rowIndex, columnIndex, context) => true,
|
163
|
-
gridData: {
|
164
|
-
seriesDirection: 'row',
|
165
|
-
rowLabels: [],
|
166
|
-
columnLabels: [],
|
167
|
-
},
|
168
|
-
valueAxis: { ...DATA_FORMATTER_VALUE_AXIS },
|
169
|
-
groupAxis: { ...DATA_FORMATTER_GROUP_AXIS, },
|
170
|
-
slotIndex: 0,
|
171
|
-
seriesSlotIndexes: null
|
172
|
-
}
|
173
|
-
|
174
|
-
export const DATA_FORMATTER_GRID_DEFAULT: DataFormatterGrid = {
|
175
|
-
// ...DATA_FORMATTER_WITH_VALUE,
|
176
|
-
type: 'grid',
|
177
|
-
grid: {
|
178
|
-
...DATA_FORMATTER_GRID_GRID_DEFAULT
|
179
|
-
},
|
180
|
-
container: {
|
181
|
-
gap: 120,
|
182
|
-
rowAmount: 1,
|
183
|
-
columnAmount: 1
|
184
|
-
}
|
185
|
-
// visibleGroupRange: null,
|
186
|
-
// colorsPredicate: (datum, rowIndex, columnIndex, { chartParams, dataFormatter }) => {
|
187
|
-
// const seriesIndex = dataFormatter.grid.seriesDirection === 'row' ? rowIndex : columnIndex
|
188
|
-
// return chartParams.colors[chartParams.colorScheme].series[seriesIndex]
|
189
|
-
// },
|
190
|
-
}
|
191
|
-
|
192
|
-
// export const DATA_FORMATTER_MULTI_GRID_MULTI_GRID_DEFAULT: DataFormatterMultiGridMultiGrid = {
|
193
|
-
// ...DATA_FORMATTER_GRID_DEFAULT,
|
194
|
-
// slotIndex: 0,
|
195
|
-
// seriesSlotIndexes: null
|
196
|
-
// }
|
197
|
-
|
198
|
-
export const DATA_FORMATTER_MULTI_GRID_GRID_DEFAULT: DataFormatterMultiGridGrid = {
|
199
|
-
...DATA_FORMATTER_GRID_GRID_DEFAULT
|
200
|
-
}
|
201
|
-
|
202
|
-
export const DATA_FORMATTER_MULTI_GRID_DEFAULT: DataFormatterMultiGrid = {
|
203
|
-
type: 'multiGrid',
|
204
|
-
// visibleFilter: (datum, rowIndex, columnIndex, context) => true,
|
205
|
-
gridList: [
|
206
|
-
{
|
207
|
-
...DATA_FORMATTER_MULTI_GRID_GRID_DEFAULT
|
208
|
-
},
|
209
|
-
],
|
210
|
-
container: {
|
211
|
-
gap: 120,
|
212
|
-
rowAmount: 1,
|
213
|
-
columnAmount: 1
|
214
|
-
}
|
215
|
-
}
|
216
|
-
|
217
|
-
export const DATA_FORMATTER_MULTI_VALUE_DEFAULT: DataFormatterMultiValue = {
|
218
|
-
type: 'multiValue',
|
219
|
-
visibleFilter: (datum, rowIndex, columnIndex, context) => true,
|
220
|
-
// labelFormat: (datum: any) => (datum && datum.label) ?? '',
|
221
|
-
multiValue: [],
|
222
|
-
xAxis: { ...DATA_FORMATTER_VALUE_AXIS },
|
223
|
-
yAxis: { ...DATA_FORMATTER_VALUE_AXIS },
|
224
|
-
}
|
225
|
-
|
226
|
-
export const DATA_FORMATTER_TREE_DEFAULT: DataFormatterTree = {
|
227
|
-
type: 'tree',
|
228
|
-
visibleFilter: (datum, rowIndex, columnIndex, context) => true,
|
229
|
-
// labelFormat: (datum: any) => (datum && datum.label) ?? '',
|
230
|
-
categoryLabels: []
|
231
|
-
}
|
232
|
-
|
233
|
-
export const DATA_FORMATTER_RELATIONAL_DEFAULT: DataFormatterRelationship = {
|
234
|
-
type: 'relationship',
|
235
|
-
visibleFilter: (datum, rowIndex, columnIndex, context) => true,
|
236
|
-
// node: {
|
237
|
-
// // labelFormat: (node: any) => (node && node.label) ?? '',
|
238
|
-
// descriptionFormat: (node: any) => (node && node.label) ?? ''
|
239
|
-
// },
|
240
|
-
// edge: {
|
241
|
-
// // labelFormat: (edge: any) => (edge && edge.label) ?? '',
|
242
|
-
// descriptionFormat: (edge: any) => (edge && edge.label) ?? ''
|
243
|
-
// },
|
244
|
-
}
|
245
|
-
|
246
|
-
// -- Render Data --
|
247
|
-
|
1
|
+
// import type { ChartGlobalDefault } from './types/Chart'
|
2
|
+
// import { ChartRenderOptions } from './types/Chart'
|
3
|
+
import type { ChartType, ChartOptionsPartial } from './types/Chart'
|
4
|
+
import type { DataSeries } from './types/DataSeries'
|
5
|
+
import type { DataGrid, DataGridDatum } from './types/DataGrid'
|
6
|
+
import type { DataMultiGrid } from './types/DataMultiGrid'
|
7
|
+
import type { DataMultiValue } from './types/DataMultiValue'
|
8
|
+
import type { DataTree } from './types/DataTree'
|
9
|
+
import type { DataRelationship } from './types/DataRelationship'
|
10
|
+
import type { DataFormatterBase, DataFormatterValueAxis, DataFormatterGroupAxis } from './types/DataFormatter'
|
11
|
+
import type { DataFormatterSeries } from './types/DataFormatterSeries'
|
12
|
+
import type { DataFormatterGrid, DataFormatterGridGrid } from './types/DataFormatterGrid'
|
13
|
+
import type { DataFormatterMultiGrid, DataFormatterMultiGridGrid } from './types/DataFormatterMultiGrid'
|
14
|
+
import type { DataFormatterMultiValue } from './types/DataFormatterMultiValue'
|
15
|
+
import type { DataFormatterTree } from './types/DataFormatterTree'
|
16
|
+
import type { DataFormatterRelationship } from './types/DataFormatterRelationship'
|
17
|
+
import type { ChartParams } from './types/ChartParams'
|
18
|
+
import type { Padding } from './types/Padding'
|
19
|
+
|
20
|
+
export const CHART_OPTIONS_DEFAULT: ChartOptionsPartial<any> = {
|
21
|
+
preset: {} // 預設為空
|
22
|
+
}
|
23
|
+
|
24
|
+
// export const GLOBAL_DEFAULT: ChartGlobalDefault = {
|
25
|
+
// colors: ['#67B7DC', '#6794DC', '#6771DC', '#8067DC', '#A367DC', '#C767DC', '#DC67CE', '#DC67AB', '#DC6788', '#DC6967', '#DC8C67', '#DCAF67'],
|
26
|
+
// padding: {
|
27
|
+
// top: 50,
|
28
|
+
// right: 70,
|
29
|
+
// bottom: 50,
|
30
|
+
// left: 70
|
31
|
+
// },
|
32
|
+
// // chartWidth: '100%',
|
33
|
+
// // chartHeight: 500
|
34
|
+
// }
|
35
|
+
|
36
|
+
// export const COLORS_DEFAULT = ['#67B7DC', '#6794DC', '#6771DC', '#8067DC', '#A367DC', '#C767DC', '#DC67CE', '#DC67AB', '#DC6788', '#DC6967', '#DC8C67', '#DCAF67']
|
37
|
+
// ['#ff7ab9', '#66dec8', '#84c8ff', '#30ad1b', '#f8c43e', '#fa5640', '#9d79d7', '#ea4f98']
|
38
|
+
|
39
|
+
export const PADDING_DEFAULT: Padding = {
|
40
|
+
top: 60,
|
41
|
+
right: 60,
|
42
|
+
bottom: 60,
|
43
|
+
left: 60
|
44
|
+
}
|
45
|
+
|
46
|
+
// export const HIGHLIGHT_DEFAULT: HighlightDefault = {
|
47
|
+
// // trigger: 'datum',
|
48
|
+
// id: null,
|
49
|
+
// label: null
|
50
|
+
// }
|
51
|
+
|
52
|
+
export const CHART_PARAMS_DEFAULT: ChartParams = {
|
53
|
+
padding: PADDING_DEFAULT,
|
54
|
+
highlightTarget: 'datum',
|
55
|
+
// highlightDefault: HIGHLIGHT_DEFAULT,
|
56
|
+
highlightDefault: null,
|
57
|
+
colorScheme: 'light',
|
58
|
+
colors: {
|
59
|
+
light: {
|
60
|
+
series: ['#67B7DC', '#6794DC', '#6771DC', '#8067DC', '#A367DC', '#C767DC', '#DC67CE', '#DC67AB', '#DC6788', '#DC6967', '#DC8C67', '#DCAF67'],
|
61
|
+
// primary: '#454545',
|
62
|
+
primary: '#1b1e23',
|
63
|
+
secondary: '#e1e1e1',
|
64
|
+
white: '#ffffff',
|
65
|
+
background: '#ffffff'
|
66
|
+
},
|
67
|
+
dark: {
|
68
|
+
series: ['#67B7DC', '#6794DC', '#6771DC', '#8067DC', '#A367DC', '#C767DC', '#DC67CE', '#DC67AB', '#DC6788', '#DC6967', '#DC8C67', '#DCAF67'],
|
69
|
+
primary: '#f0f0f0',
|
70
|
+
secondary: '#e1e1e1',
|
71
|
+
white: '#ffffff',
|
72
|
+
background: '#000000'
|
73
|
+
}
|
74
|
+
},
|
75
|
+
styles: {
|
76
|
+
textSize: 14,
|
77
|
+
unhighlightedOpacity: 0.3
|
78
|
+
},
|
79
|
+
transitionDuration: 800,
|
80
|
+
transitionEase: 'easeCubic'
|
81
|
+
}
|
82
|
+
|
83
|
+
export const CHART_WIDTH_DEFAULT = 800
|
84
|
+
|
85
|
+
export const CHART_HEIGHT_DEFAULT = 500
|
86
|
+
|
87
|
+
// -- Data --
|
88
|
+
|
89
|
+
export const DATA_SERIES_DEFAULT: DataSeries = []
|
90
|
+
|
91
|
+
export const DATA_GRID_DEFAULT: DataGrid = []
|
92
|
+
|
93
|
+
export const DATA_MULTI_GRID_DEFAULT: DataMultiGrid = []
|
94
|
+
|
95
|
+
export const DATA_MULTI_VALUE_DEFAULT: DataMultiValue = []
|
96
|
+
|
97
|
+
export const DATA_TREE_DEFAULT: DataTree = []
|
98
|
+
|
99
|
+
export const DATA_RELATIONA_DEFAULTL: DataRelationship = {
|
100
|
+
nodes: [],
|
101
|
+
edges: []
|
102
|
+
}
|
103
|
+
|
104
|
+
// -- Data Formatter --
|
105
|
+
|
106
|
+
// 基本欄位
|
107
|
+
// export const DATA_FORMATTER: DataFormatterBase<ChartType> = {
|
108
|
+
// // ...GLOBAL_DEFAULT,
|
109
|
+
// type: ('' as any), // 後面需複蓋掉否則會有問題
|
110
|
+
// }
|
111
|
+
// 有value
|
112
|
+
// export const DATA_FORMATTER_WITH_VALUE: DataFormatterValue = {
|
113
|
+
// valueFormat: ',.0f'
|
114
|
+
// }
|
115
|
+
// 有axis
|
116
|
+
// export const DATA_FORMATTER_WITH_AXIS: DataFormatterAxis = {
|
117
|
+
// // domainMinValue: 0,
|
118
|
+
// // domainMaxValue: undefined,
|
119
|
+
// // domainMinRange: undefined,
|
120
|
+
// // domainMaxRange: 0.9
|
121
|
+
// valueDomain: [0, 'auto'],
|
122
|
+
// valueRange: [0, 0.9]
|
123
|
+
// }
|
124
|
+
|
125
|
+
export const DATA_FORMATTER_VALUE_AXIS: DataFormatterValueAxis = {
|
126
|
+
position: 'left',
|
127
|
+
scaleDomain: [0, 'auto'],
|
128
|
+
scaleRange: [0, 0.9],
|
129
|
+
label: '',
|
130
|
+
}
|
131
|
+
|
132
|
+
export const DATA_FORMATTER_GROUP_AXIS: DataFormatterGroupAxis = {
|
133
|
+
position: 'bottom',
|
134
|
+
scaleDomain: [0, 'auto'],
|
135
|
+
scalePadding: 0.5,
|
136
|
+
label: ''
|
137
|
+
}
|
138
|
+
|
139
|
+
export const DATA_FORMATTER_SERIES_DEFAULT: DataFormatterSeries = {
|
140
|
+
// ...DATA_FORMATTER_WITH_VALUE,
|
141
|
+
type: 'series',
|
142
|
+
visibleFilter: (datum, rowIndex, columnIndex, context) => true,
|
143
|
+
// unitLabel: '',
|
144
|
+
seriesLabels: [],
|
145
|
+
// mapSeries: (datum, rowIndex, columnIndex, { data, dataFormatter }) => {
|
146
|
+
// const seriesIndex = rowIndex >= dataFormatter.seriesLabels.length
|
147
|
+
// ? rowIndex % dataFormatter.seriesLabels.length // 如果index大於所設定的seriesLabels的數量則從頭回來算
|
148
|
+
// : rowIndex
|
149
|
+
// return dataFormatter.seriesLabels[seriesIndex]
|
150
|
+
// },
|
151
|
+
// colorsPredicate: (datum, rowIndex, columnIndex, { chartParams }) => {
|
152
|
+
// return rowIndex < chartParams.colors[chartParams.colorScheme].series.length
|
153
|
+
// ? chartParams.colors[chartParams.colorScheme].series[rowIndex]
|
154
|
+
// : chartParams.colors[chartParams.colorScheme].series[
|
155
|
+
// rowIndex % chartParams.colors[chartParams.colorScheme].series.length
|
156
|
+
// ]
|
157
|
+
// },
|
158
|
+
sort: null,
|
159
|
+
}
|
160
|
+
|
161
|
+
export const DATA_FORMATTER_GRID_GRID_DEFAULT: DataFormatterGridGrid = {
|
162
|
+
visibleFilter: (datum, rowIndex, columnIndex, context) => true,
|
163
|
+
gridData: {
|
164
|
+
seriesDirection: 'row',
|
165
|
+
rowLabels: [],
|
166
|
+
columnLabels: [],
|
167
|
+
},
|
168
|
+
valueAxis: { ...DATA_FORMATTER_VALUE_AXIS },
|
169
|
+
groupAxis: { ...DATA_FORMATTER_GROUP_AXIS, },
|
170
|
+
slotIndex: 0,
|
171
|
+
seriesSlotIndexes: null
|
172
|
+
}
|
173
|
+
|
174
|
+
export const DATA_FORMATTER_GRID_DEFAULT: DataFormatterGrid = {
|
175
|
+
// ...DATA_FORMATTER_WITH_VALUE,
|
176
|
+
type: 'grid',
|
177
|
+
grid: {
|
178
|
+
...DATA_FORMATTER_GRID_GRID_DEFAULT
|
179
|
+
},
|
180
|
+
container: {
|
181
|
+
gap: 120,
|
182
|
+
rowAmount: 1,
|
183
|
+
columnAmount: 1
|
184
|
+
}
|
185
|
+
// visibleGroupRange: null,
|
186
|
+
// colorsPredicate: (datum, rowIndex, columnIndex, { chartParams, dataFormatter }) => {
|
187
|
+
// const seriesIndex = dataFormatter.grid.seriesDirection === 'row' ? rowIndex : columnIndex
|
188
|
+
// return chartParams.colors[chartParams.colorScheme].series[seriesIndex]
|
189
|
+
// },
|
190
|
+
}
|
191
|
+
|
192
|
+
// export const DATA_FORMATTER_MULTI_GRID_MULTI_GRID_DEFAULT: DataFormatterMultiGridMultiGrid = {
|
193
|
+
// ...DATA_FORMATTER_GRID_DEFAULT,
|
194
|
+
// slotIndex: 0,
|
195
|
+
// seriesSlotIndexes: null
|
196
|
+
// }
|
197
|
+
|
198
|
+
export const DATA_FORMATTER_MULTI_GRID_GRID_DEFAULT: DataFormatterMultiGridGrid = {
|
199
|
+
...DATA_FORMATTER_GRID_GRID_DEFAULT
|
200
|
+
}
|
201
|
+
|
202
|
+
export const DATA_FORMATTER_MULTI_GRID_DEFAULT: DataFormatterMultiGrid = {
|
203
|
+
type: 'multiGrid',
|
204
|
+
// visibleFilter: (datum, rowIndex, columnIndex, context) => true,
|
205
|
+
gridList: [
|
206
|
+
{
|
207
|
+
...DATA_FORMATTER_MULTI_GRID_GRID_DEFAULT
|
208
|
+
},
|
209
|
+
],
|
210
|
+
container: {
|
211
|
+
gap: 120,
|
212
|
+
rowAmount: 1,
|
213
|
+
columnAmount: 1
|
214
|
+
}
|
215
|
+
}
|
216
|
+
|
217
|
+
export const DATA_FORMATTER_MULTI_VALUE_DEFAULT: DataFormatterMultiValue = {
|
218
|
+
type: 'multiValue',
|
219
|
+
visibleFilter: (datum, rowIndex, columnIndex, context) => true,
|
220
|
+
// labelFormat: (datum: any) => (datum && datum.label) ?? '',
|
221
|
+
multiValue: [],
|
222
|
+
xAxis: { ...DATA_FORMATTER_VALUE_AXIS },
|
223
|
+
yAxis: { ...DATA_FORMATTER_VALUE_AXIS },
|
224
|
+
}
|
225
|
+
|
226
|
+
export const DATA_FORMATTER_TREE_DEFAULT: DataFormatterTree = {
|
227
|
+
type: 'tree',
|
228
|
+
visibleFilter: (datum, rowIndex, columnIndex, context) => true,
|
229
|
+
// labelFormat: (datum: any) => (datum && datum.label) ?? '',
|
230
|
+
categoryLabels: []
|
231
|
+
}
|
232
|
+
|
233
|
+
export const DATA_FORMATTER_RELATIONAL_DEFAULT: DataFormatterRelationship = {
|
234
|
+
type: 'relationship',
|
235
|
+
visibleFilter: (datum, rowIndex, columnIndex, context) => true,
|
236
|
+
// node: {
|
237
|
+
// // labelFormat: (node: any) => (node && node.label) ?? '',
|
238
|
+
// descriptionFormat: (node: any) => (node && node.label) ?? ''
|
239
|
+
// },
|
240
|
+
// edge: {
|
241
|
+
// // labelFormat: (edge: any) => (edge && edge.label) ?? '',
|
242
|
+
// descriptionFormat: (edge: any) => (edge && edge.label) ?? ''
|
243
|
+
// },
|
244
|
+
}
|
245
|
+
|
246
|
+
// -- Render Data --
|
247
|
+
|
package/src/defineGridPlugin.ts
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
import { createBasePlugin } from './base/createBasePlugin'
|
2
|
-
|
3
|
-
export const defineGridPlugin = createBasePlugin<'grid'>()
|
1
|
+
import { createBasePlugin } from './base/createBasePlugin'
|
2
|
+
|
3
|
+
export const defineGridPlugin = createBasePlugin<'grid'>()
|
@@ -1,3 +1,3 @@
|
|
1
|
-
import { createBasePlugin } from './base/createBasePlugin'
|
2
|
-
|
3
|
-
export const defineMultiGridPlugin = createBasePlugin<'multiGrid'>()
|
1
|
+
import { createBasePlugin } from './base/createBasePlugin'
|
2
|
+
|
3
|
+
export const defineMultiGridPlugin = createBasePlugin<'multiGrid'>()
|
@@ -1,3 +1,3 @@
|
|
1
|
-
import { createBasePlugin } from './base/createBasePlugin'
|
2
|
-
|
3
|
-
export const defineMultiValuePlugin = createBasePlugin<'multiValue'>()
|
1
|
+
import { createBasePlugin } from './base/createBasePlugin'
|
2
|
+
|
3
|
+
export const defineMultiValuePlugin = createBasePlugin<'multiValue'>()
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { createBasePlugin } from './base/createBasePlugin'
|
2
|
-
import { ChartType } from './types/Chart'
|
3
|
-
|
4
|
-
export const defineNoneDataPlugin = createBasePlugin<any>() // noneDataPlugin 可以使用在任何的 chartType
|
1
|
+
import { createBasePlugin } from './base/createBasePlugin'
|
2
|
+
import { ChartType } from './types/Chart'
|
3
|
+
|
4
|
+
export const defineNoneDataPlugin = createBasePlugin<any>() // noneDataPlugin 可以使用在任何的 chartType
|
@@ -1,3 +1,3 @@
|
|
1
|
-
import { createBasePlugin } from './base/createBasePlugin'
|
2
|
-
|
3
|
-
export const defineRelationshipPlugin = createBasePlugin<'relationship'>()
|
1
|
+
import { createBasePlugin } from './base/createBasePlugin'
|
2
|
+
|
3
|
+
export const defineRelationshipPlugin = createBasePlugin<'relationship'>()
|
@@ -1,3 +1,3 @@
|
|
1
|
-
import { createBasePlugin } from './base/createBasePlugin'
|
2
|
-
|
3
|
-
export const defineSeriesPlugin = createBasePlugin<'series'>()
|
1
|
+
import { createBasePlugin } from './base/createBasePlugin'
|
2
|
+
|
3
|
+
export const defineSeriesPlugin = createBasePlugin<'series'>()
|
package/src/defineTreePlugin.ts
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
import { createBasePlugin } from './base/createBasePlugin'
|
2
|
-
|
3
|
-
export const defineTreePlugin = createBasePlugin<'tree'>()
|
1
|
+
import { createBasePlugin } from './base/createBasePlugin'
|
2
|
+
|
3
|
+
export const defineTreePlugin = createBasePlugin<'tree'>()
|