@orbcharts/core 3.0.0-beta.3 → 3.0.0-beta.4
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/LICENSE +200 -200
- package/dist/orbcharts-core.es.js +2623 -2338
- package/dist/orbcharts-core.umd.js +4 -4
- package/dist/src/utils/d3Scale.d.ts +28 -0
- package/dist/src/utils/gridObservables.d.ts +29 -19
- package/dist/src/utils/index.d.ts +1 -1
- package/dist/src/utils/multiGridObservables.d.ts +2 -2
- package/dist/src/utils/multiValueObservables.d.ts +73 -0
- package/dist/src/utils/orbchartsUtils.d.ts +19 -5
- package/dist/src/utils/seriesObservables.d.ts +4 -4
- package/dist/src/utils/treeObservables.d.ts +2 -5
- package/lib/core-types.ts +7 -7
- package/package.json +42 -42
- package/src/AbstractChart.ts +57 -57
- package/src/GridChart.ts +24 -24
- package/src/MultiGridChart.ts +24 -24
- package/src/MultiValueChart.ts +24 -24
- package/src/RelationshipChart.ts +24 -24
- package/src/SeriesChart.ts +24 -24
- package/src/TreeChart.ts +24 -24
- package/src/base/createBaseChart.ts +505 -505
- package/src/base/createBasePlugin.ts +153 -153
- package/src/base/validators/chartOptionsValidator.ts +23 -23
- package/src/base/validators/chartParamsValidator.ts +133 -133
- package/src/base/validators/elementValidator.ts +13 -13
- package/src/base/validators/pluginsValidator.ts +14 -14
- package/src/defaults.ts +235 -232
- 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/computedDataFn.ts +129 -129
- package/src/grid/contextObserverCallback.ts +176 -155
- package/src/grid/dataFormatterValidator.ts +101 -101
- package/src/grid/dataValidator.ts +12 -12
- package/src/index.ts +20 -20
- package/src/multiGrid/computedDataFn.ts +123 -123
- package/src/multiGrid/contextObserverCallback.ts +41 -41
- package/src/multiGrid/dataFormatterValidator.ts +115 -115
- package/src/multiGrid/dataValidator.ts +12 -12
- package/src/multiValue/computedDataFn.ts +110 -176
- package/src/multiValue/contextObserverCallback.ts +160 -12
- package/src/multiValue/dataFormatterValidator.ts +9 -9
- package/src/multiValue/dataValidator.ts +9 -9
- package/src/relationship/computedDataFn.ts +125 -125
- package/src/relationship/contextObserverCallback.ts +12 -12
- package/src/relationship/dataFormatterValidator.ts +9 -9
- package/src/relationship/dataValidator.ts +9 -9
- package/src/series/computedDataFn.ts +88 -88
- package/src/series/contextObserverCallback.ts +100 -100
- package/src/series/dataFormatterValidator.ts +41 -41
- package/src/series/dataValidator.ts +12 -12
- package/src/tree/computedDataFn.ts +129 -130
- package/src/tree/contextObserverCallback.ts +58 -61
- package/src/tree/dataFormatterValidator.ts +13 -13
- package/src/tree/dataValidator.ts +13 -13
- package/src/utils/commonUtils.ts +55 -55
- package/src/utils/d3Scale.ts +198 -0
- package/src/utils/errorMessage.ts +42 -42
- package/src/utils/gridObservables.ts +671 -614
- package/src/utils/index.ts +9 -9
- package/src/utils/multiGridObservables.ts +392 -366
- package/src/utils/multiValueObservables.ts +643 -0
- package/src/utils/observables.ts +219 -219
- package/src/utils/orbchartsUtils.ts +377 -352
- package/src/utils/seriesObservables.ts +175 -175
- package/src/utils/treeObservables.ts +105 -94
- package/src/utils/validator.ts +126 -125
- package/tsconfig.base.json +13 -13
- package/tsconfig.json +2 -2
- package/vite-env.d.ts +6 -6
- package/vite.config.js +22 -22
- package/dist/src/utils/d3Utils.d.ts +0 -19
- package/src/utils/d3Utils.ts +0 -108
@@ -1,15 +1,15 @@
|
|
1
|
-
import type { ChartType, PluginEntity, ValidatorResult } from '../../../lib/core-types'
|
2
|
-
import { validateColumns } from '../../utils/validator'
|
3
|
-
|
4
|
-
export function pluginsValidator (chartType: ChartType, pluginEntities: PluginEntity<any, any, any>[]): ValidatorResult {
|
5
|
-
const result = validateColumns({ pluginEntities }, {
|
6
|
-
pluginEntities: {
|
7
|
-
toBe: `PluginEntity<'${chartType}'>[]`,
|
8
|
-
test: (value: PluginEntity<any, any, any>[]) => {
|
9
|
-
return Array.isArray(value) && value.every((v) => v.chartType === chartType || v.chartType === 'noneData')
|
10
|
-
}
|
11
|
-
}
|
12
|
-
})
|
13
|
-
|
14
|
-
return result
|
1
|
+
import type { ChartType, PluginEntity, ValidatorResult } from '../../../lib/core-types'
|
2
|
+
import { validateColumns } from '../../utils/validator'
|
3
|
+
|
4
|
+
export function pluginsValidator (chartType: ChartType, pluginEntities: PluginEntity<any, any, any>[]): ValidatorResult {
|
5
|
+
const result = validateColumns({ pluginEntities }, {
|
6
|
+
pluginEntities: {
|
7
|
+
toBe: `PluginEntity<'${chartType}'>[]`,
|
8
|
+
test: (value: PluginEntity<any, any, any>[]) => {
|
9
|
+
return Array.isArray(value) && value.every((v) => v.chartType === chartType || v.chartType === 'noneData')
|
10
|
+
}
|
11
|
+
}
|
12
|
+
})
|
13
|
+
|
14
|
+
return result
|
15
15
|
}
|
package/src/defaults.ts
CHANGED
@@ -1,232 +1,235 @@
|
|
1
|
-
import type {
|
2
|
-
ChartOptionsPartial,
|
3
|
-
DataSeries,
|
4
|
-
DataGrid,
|
5
|
-
DataMultiGrid,
|
6
|
-
DataMultiValue,
|
7
|
-
DataTree,
|
8
|
-
DataRelationship,
|
9
|
-
DataFormatterValueAxis,
|
10
|
-
DataFormatterGroupAxis,
|
11
|
-
DataFormatterContainer,
|
12
|
-
DataFormatterSeries,
|
13
|
-
DataFormatterGrid,
|
14
|
-
DataFormatterGridGrid,
|
15
|
-
DataFormatterMultiGrid,
|
16
|
-
DataFormatterMultiGridGrid,
|
17
|
-
DataFormatterMultiValue,
|
18
|
-
DataFormatterTree,
|
19
|
-
DataFormatterRelationship,
|
20
|
-
ChartParams,
|
21
|
-
Padding
|
22
|
-
} from '../lib/core-types'
|
23
|
-
|
24
|
-
export const CHART_OPTIONS_DEFAULT: ChartOptionsPartial<any> = {
|
25
|
-
// preset: {} // 預設為空
|
26
|
-
width: 'auto',
|
27
|
-
height: 'auto'
|
28
|
-
}
|
29
|
-
|
30
|
-
// export const GLOBAL_DEFAULT: ChartGlobalDefault = {
|
31
|
-
// colors: ['#67B7DC', '#6794DC', '#6771DC', '#8067DC', '#A367DC', '#C767DC', '#DC67CE', '#DC67AB', '#DC6788', '#DC6967', '#DC8C67', '#DCAF67'],
|
32
|
-
// padding: {
|
33
|
-
// top: 50,
|
34
|
-
// right: 70,
|
35
|
-
// bottom: 50,
|
36
|
-
// left: 70
|
37
|
-
// },
|
38
|
-
// // chartWidth: '100%',
|
39
|
-
// // chartHeight: 500
|
40
|
-
// }
|
41
|
-
|
42
|
-
// export const COLORS_DEFAULT = ['#67B7DC', '#6794DC', '#6771DC', '#8067DC', '#A367DC', '#C767DC', '#DC67CE', '#DC67AB', '#DC6788', '#DC6967', '#DC8C67', '#DCAF67']
|
43
|
-
// ['#ff7ab9', '#66dec8', '#84c8ff', '#30ad1b', '#f8c43e', '#fa5640', '#9d79d7', '#ea4f98']
|
44
|
-
|
45
|
-
export const PADDING_DEFAULT: Padding = {
|
46
|
-
top: 60,
|
47
|
-
right: 60,
|
48
|
-
bottom: 60,
|
49
|
-
left: 60
|
50
|
-
}
|
51
|
-
|
52
|
-
export const CHART_PARAMS_DEFAULT: ChartParams = {
|
53
|
-
padding: PADDING_DEFAULT,
|
54
|
-
highlightTarget: 'datum',
|
55
|
-
highlightDefault: null,
|
56
|
-
colorScheme: 'light',
|
57
|
-
colors: {
|
58
|
-
light: {
|
59
|
-
series: ['#67B7DC', '#6794DC', '#6771DC', '#8067DC', '#A367DC', '#C767DC', '#DC67CE', '#DC67AB', '#DC6788', '#DC6967', '#DC8C67', '#DCAF67'],
|
60
|
-
// primary: '#454545',
|
61
|
-
primary: '#1b1e23',
|
62
|
-
secondary: '#e1e1e1',
|
63
|
-
white: '#ffffff',
|
64
|
-
background: '#ffffff'
|
65
|
-
},
|
66
|
-
dark: {
|
67
|
-
series: ['#67B7DC', '#6794DC', '#6771DC', '#8067DC', '#A367DC', '#C767DC', '#DC67CE', '#DC67AB', '#DC6788', '#DC6967', '#DC8C67', '#DCAF67'],
|
68
|
-
primary: '#f0f0f0',
|
69
|
-
secondary: '#e1e1e1',
|
70
|
-
white: '#ffffff',
|
71
|
-
background: '#000000'
|
72
|
-
}
|
73
|
-
},
|
74
|
-
styles: {
|
75
|
-
// textSize: 14,
|
76
|
-
textSize: '0.875rem',
|
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
|
-
export const DATA_FORMATTER_VALUE_AXIS_DEFAULT: DataFormatterValueAxis = {
|
107
|
-
position: 'left',
|
108
|
-
scaleDomain: ['auto', 'auto'],
|
109
|
-
scaleRange: [0, 0.9],
|
110
|
-
label: '',
|
111
|
-
}
|
112
|
-
|
113
|
-
export const DATA_FORMATTER_GROUP_AXIS_DEFAULT: DataFormatterGroupAxis = {
|
114
|
-
position: 'bottom',
|
115
|
-
scaleDomain: [0, 'max'],
|
116
|
-
scalePadding: 0.5,
|
117
|
-
label: ''
|
118
|
-
}
|
119
|
-
|
120
|
-
export const DATA_FORMATTER_CONTAINER_DEFAULT: DataFormatterContainer = {
|
121
|
-
gap: 120,
|
122
|
-
rowAmount: 1,
|
123
|
-
columnAmount: 1
|
124
|
-
}
|
125
|
-
|
126
|
-
export const DATA_FORMATTER_SERIES_DEFAULT: DataFormatterSeries = {
|
127
|
-
type: 'series',
|
128
|
-
visibleFilter: (datum, context) => true,
|
129
|
-
sort: null,
|
130
|
-
seriesLabels: [],
|
131
|
-
container: {
|
132
|
-
...DATA_FORMATTER_CONTAINER_DEFAULT
|
133
|
-
},
|
134
|
-
separateSeries: false,
|
135
|
-
sumSeries: false
|
136
|
-
// mapSeries: (datum, rowIndex, columnIndex, { data, dataFormatter }) => {
|
137
|
-
// const seriesIndex = rowIndex >= dataFormatter.seriesLabels.length
|
138
|
-
// ? rowIndex % dataFormatter.seriesLabels.length // 如果index大於所設定的seriesLabels的數量則從頭回來算
|
139
|
-
// : rowIndex
|
140
|
-
// return dataFormatter.seriesLabels[seriesIndex]
|
141
|
-
// },
|
142
|
-
// colorsPredicate: (datum, rowIndex, columnIndex, { chartParams }) => {
|
143
|
-
// return rowIndex < chartParams.colors[chartParams.colorScheme].series.length
|
144
|
-
// ? chartParams.colors[chartParams.colorScheme].series[rowIndex]
|
145
|
-
// : chartParams.colors[chartParams.colorScheme].series[
|
146
|
-
// rowIndex % chartParams.colors[chartParams.colorScheme].series.length
|
147
|
-
// ]
|
148
|
-
// },
|
149
|
-
}
|
150
|
-
DATA_FORMATTER_SERIES_DEFAULT.visibleFilter.toString = () => `(datum, context) => true`
|
151
|
-
|
152
|
-
export const DATA_FORMATTER_GRID_GRID_DEFAULT: DataFormatterGridGrid = {
|
153
|
-
seriesDirection: 'row',
|
154
|
-
rowLabels: [],
|
155
|
-
columnLabels: [],
|
156
|
-
valueAxis: { ...DATA_FORMATTER_VALUE_AXIS_DEFAULT },
|
157
|
-
groupAxis: { ...DATA_FORMATTER_GROUP_AXIS_DEFAULT, },
|
158
|
-
separateSeries: false,
|
159
|
-
// slotIndex: 0,
|
160
|
-
// seriesSlotIndexes: null
|
161
|
-
}
|
162
|
-
|
163
|
-
export const DATA_FORMATTER_GRID_DEFAULT: DataFormatterGrid = {
|
164
|
-
type: 'grid',
|
165
|
-
visibleFilter: (datum, context) => true,
|
166
|
-
grid: {
|
167
|
-
...DATA_FORMATTER_GRID_GRID_DEFAULT
|
168
|
-
},
|
169
|
-
container: {
|
170
|
-
...DATA_FORMATTER_CONTAINER_DEFAULT
|
171
|
-
}
|
172
|
-
}
|
173
|
-
DATA_FORMATTER_GRID_DEFAULT.visibleFilter.toString = () => `(datum, context) => true`
|
174
|
-
|
175
|
-
// export const DATA_FORMATTER_MULTI_GRID_MULTI_GRID_DEFAULT: DataFormatterMultiGridMultiGrid = {
|
176
|
-
// ...DATA_FORMATTER_GRID_DEFAULT,
|
177
|
-
// slotIndex: 0,
|
178
|
-
// seriesSlotIndexes: null
|
179
|
-
// }
|
180
|
-
|
181
|
-
export const DATA_FORMATTER_MULTI_GRID_GRID_DEFAULT: DataFormatterMultiGridGrid = {
|
182
|
-
...DATA_FORMATTER_GRID_GRID_DEFAULT
|
183
|
-
}
|
184
|
-
|
185
|
-
export const DATA_FORMATTER_MULTI_GRID_DEFAULT: DataFormatterMultiGrid = {
|
186
|
-
type: 'multiGrid',
|
187
|
-
visibleFilter: (datum, context) => true,
|
188
|
-
gridList: [
|
189
|
-
{
|
190
|
-
...DATA_FORMATTER_MULTI_GRID_GRID_DEFAULT
|
191
|
-
},
|
192
|
-
],
|
193
|
-
separateGrid: false,
|
194
|
-
container: {
|
195
|
-
...DATA_FORMATTER_CONTAINER_DEFAULT
|
196
|
-
}
|
197
|
-
}
|
198
|
-
DATA_FORMATTER_MULTI_GRID_DEFAULT.visibleFilter.toString = () => `(datum, context) => true`
|
199
|
-
|
200
|
-
export const DATA_FORMATTER_MULTI_VALUE_DEFAULT: DataFormatterMultiValue = {
|
201
|
-
type: 'multiValue',
|
202
|
-
visibleFilter: (datum, context) => true,
|
203
|
-
categoryLabels: [],
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
//
|
226
|
-
//
|
227
|
-
//
|
228
|
-
//
|
229
|
-
//
|
230
|
-
|
231
|
-
|
232
|
-
|
1
|
+
import type {
|
2
|
+
ChartOptionsPartial,
|
3
|
+
DataSeries,
|
4
|
+
DataGrid,
|
5
|
+
DataMultiGrid,
|
6
|
+
DataMultiValue,
|
7
|
+
DataTree,
|
8
|
+
DataRelationship,
|
9
|
+
DataFormatterValueAxis,
|
10
|
+
DataFormatterGroupAxis,
|
11
|
+
DataFormatterContainer,
|
12
|
+
DataFormatterSeries,
|
13
|
+
DataFormatterGrid,
|
14
|
+
DataFormatterGridGrid,
|
15
|
+
DataFormatterMultiGrid,
|
16
|
+
DataFormatterMultiGridGrid,
|
17
|
+
DataFormatterMultiValue,
|
18
|
+
DataFormatterTree,
|
19
|
+
DataFormatterRelationship,
|
20
|
+
ChartParams,
|
21
|
+
Padding
|
22
|
+
} from '../lib/core-types'
|
23
|
+
|
24
|
+
export const CHART_OPTIONS_DEFAULT: ChartOptionsPartial<any> = {
|
25
|
+
// preset: {} // 預設為空
|
26
|
+
width: 'auto',
|
27
|
+
height: 'auto'
|
28
|
+
}
|
29
|
+
|
30
|
+
// export const GLOBAL_DEFAULT: ChartGlobalDefault = {
|
31
|
+
// colors: ['#67B7DC', '#6794DC', '#6771DC', '#8067DC', '#A367DC', '#C767DC', '#DC67CE', '#DC67AB', '#DC6788', '#DC6967', '#DC8C67', '#DCAF67'],
|
32
|
+
// padding: {
|
33
|
+
// top: 50,
|
34
|
+
// right: 70,
|
35
|
+
// bottom: 50,
|
36
|
+
// left: 70
|
37
|
+
// },
|
38
|
+
// // chartWidth: '100%',
|
39
|
+
// // chartHeight: 500
|
40
|
+
// }
|
41
|
+
|
42
|
+
// export const COLORS_DEFAULT = ['#67B7DC', '#6794DC', '#6771DC', '#8067DC', '#A367DC', '#C767DC', '#DC67CE', '#DC67AB', '#DC6788', '#DC6967', '#DC8C67', '#DCAF67']
|
43
|
+
// ['#ff7ab9', '#66dec8', '#84c8ff', '#30ad1b', '#f8c43e', '#fa5640', '#9d79d7', '#ea4f98']
|
44
|
+
|
45
|
+
export const PADDING_DEFAULT: Padding = {
|
46
|
+
top: 60,
|
47
|
+
right: 60,
|
48
|
+
bottom: 60,
|
49
|
+
left: 60
|
50
|
+
}
|
51
|
+
|
52
|
+
export const CHART_PARAMS_DEFAULT: ChartParams = {
|
53
|
+
padding: PADDING_DEFAULT,
|
54
|
+
highlightTarget: 'datum',
|
55
|
+
highlightDefault: null,
|
56
|
+
colorScheme: 'light',
|
57
|
+
colors: {
|
58
|
+
light: {
|
59
|
+
series: ['#67B7DC', '#6794DC', '#6771DC', '#8067DC', '#A367DC', '#C767DC', '#DC67CE', '#DC67AB', '#DC6788', '#DC6967', '#DC8C67', '#DCAF67'],
|
60
|
+
// primary: '#454545',
|
61
|
+
primary: '#1b1e23',
|
62
|
+
secondary: '#e1e1e1',
|
63
|
+
white: '#ffffff',
|
64
|
+
background: '#ffffff'
|
65
|
+
},
|
66
|
+
dark: {
|
67
|
+
series: ['#67B7DC', '#6794DC', '#6771DC', '#8067DC', '#A367DC', '#C767DC', '#DC67CE', '#DC67AB', '#DC6788', '#DC6967', '#DC8C67', '#DCAF67'],
|
68
|
+
primary: '#f0f0f0',
|
69
|
+
secondary: '#e1e1e1',
|
70
|
+
white: '#ffffff',
|
71
|
+
background: '#000000'
|
72
|
+
}
|
73
|
+
},
|
74
|
+
styles: {
|
75
|
+
// textSize: 14,
|
76
|
+
textSize: '0.875rem',
|
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
|
+
export const DATA_FORMATTER_VALUE_AXIS_DEFAULT: DataFormatterValueAxis = {
|
107
|
+
position: 'left',
|
108
|
+
scaleDomain: ['auto', 'auto'],
|
109
|
+
scaleRange: [0, 0.9],
|
110
|
+
label: '',
|
111
|
+
}
|
112
|
+
|
113
|
+
export const DATA_FORMATTER_GROUP_AXIS_DEFAULT: DataFormatterGroupAxis = {
|
114
|
+
position: 'bottom',
|
115
|
+
scaleDomain: [0, 'max'],
|
116
|
+
scalePadding: 0.5,
|
117
|
+
label: ''
|
118
|
+
}
|
119
|
+
|
120
|
+
export const DATA_FORMATTER_CONTAINER_DEFAULT: DataFormatterContainer = {
|
121
|
+
gap: 120,
|
122
|
+
rowAmount: 1,
|
123
|
+
columnAmount: 1
|
124
|
+
}
|
125
|
+
|
126
|
+
export const DATA_FORMATTER_SERIES_DEFAULT: DataFormatterSeries = {
|
127
|
+
type: 'series',
|
128
|
+
visibleFilter: (datum, context) => true,
|
129
|
+
sort: null,
|
130
|
+
seriesLabels: [],
|
131
|
+
container: {
|
132
|
+
...DATA_FORMATTER_CONTAINER_DEFAULT
|
133
|
+
},
|
134
|
+
separateSeries: false,
|
135
|
+
sumSeries: false
|
136
|
+
// mapSeries: (datum, rowIndex, columnIndex, { data, dataFormatter }) => {
|
137
|
+
// const seriesIndex = rowIndex >= dataFormatter.seriesLabels.length
|
138
|
+
// ? rowIndex % dataFormatter.seriesLabels.length // 如果index大於所設定的seriesLabels的數量則從頭回來算
|
139
|
+
// : rowIndex
|
140
|
+
// return dataFormatter.seriesLabels[seriesIndex]
|
141
|
+
// },
|
142
|
+
// colorsPredicate: (datum, rowIndex, columnIndex, { chartParams }) => {
|
143
|
+
// return rowIndex < chartParams.colors[chartParams.colorScheme].series.length
|
144
|
+
// ? chartParams.colors[chartParams.colorScheme].series[rowIndex]
|
145
|
+
// : chartParams.colors[chartParams.colorScheme].series[
|
146
|
+
// rowIndex % chartParams.colors[chartParams.colorScheme].series.length
|
147
|
+
// ]
|
148
|
+
// },
|
149
|
+
}
|
150
|
+
DATA_FORMATTER_SERIES_DEFAULT.visibleFilter.toString = () => `(datum, context) => true`
|
151
|
+
|
152
|
+
export const DATA_FORMATTER_GRID_GRID_DEFAULT: DataFormatterGridGrid = {
|
153
|
+
seriesDirection: 'row',
|
154
|
+
rowLabels: [],
|
155
|
+
columnLabels: [],
|
156
|
+
valueAxis: { ...DATA_FORMATTER_VALUE_AXIS_DEFAULT },
|
157
|
+
groupAxis: { ...DATA_FORMATTER_GROUP_AXIS_DEFAULT, },
|
158
|
+
separateSeries: false,
|
159
|
+
// slotIndex: 0,
|
160
|
+
// seriesSlotIndexes: null
|
161
|
+
}
|
162
|
+
|
163
|
+
export const DATA_FORMATTER_GRID_DEFAULT: DataFormatterGrid = {
|
164
|
+
type: 'grid',
|
165
|
+
visibleFilter: (datum, context) => true,
|
166
|
+
grid: {
|
167
|
+
...DATA_FORMATTER_GRID_GRID_DEFAULT
|
168
|
+
},
|
169
|
+
container: {
|
170
|
+
...DATA_FORMATTER_CONTAINER_DEFAULT
|
171
|
+
}
|
172
|
+
}
|
173
|
+
DATA_FORMATTER_GRID_DEFAULT.visibleFilter.toString = () => `(datum, context) => true`
|
174
|
+
|
175
|
+
// export const DATA_FORMATTER_MULTI_GRID_MULTI_GRID_DEFAULT: DataFormatterMultiGridMultiGrid = {
|
176
|
+
// ...DATA_FORMATTER_GRID_DEFAULT,
|
177
|
+
// slotIndex: 0,
|
178
|
+
// seriesSlotIndexes: null
|
179
|
+
// }
|
180
|
+
|
181
|
+
export const DATA_FORMATTER_MULTI_GRID_GRID_DEFAULT: DataFormatterMultiGridGrid = {
|
182
|
+
...DATA_FORMATTER_GRID_GRID_DEFAULT
|
183
|
+
}
|
184
|
+
|
185
|
+
export const DATA_FORMATTER_MULTI_GRID_DEFAULT: DataFormatterMultiGrid = {
|
186
|
+
type: 'multiGrid',
|
187
|
+
visibleFilter: (datum, context) => true,
|
188
|
+
gridList: [
|
189
|
+
{
|
190
|
+
...DATA_FORMATTER_MULTI_GRID_GRID_DEFAULT
|
191
|
+
},
|
192
|
+
],
|
193
|
+
separateGrid: false,
|
194
|
+
container: {
|
195
|
+
...DATA_FORMATTER_CONTAINER_DEFAULT
|
196
|
+
}
|
197
|
+
}
|
198
|
+
DATA_FORMATTER_MULTI_GRID_DEFAULT.visibleFilter.toString = () => `(datum, context) => true`
|
199
|
+
|
200
|
+
export const DATA_FORMATTER_MULTI_VALUE_DEFAULT: DataFormatterMultiValue = {
|
201
|
+
type: 'multiValue',
|
202
|
+
visibleFilter: (datum, context) => true,
|
203
|
+
categoryLabels: [],
|
204
|
+
xAxis: { ...DATA_FORMATTER_VALUE_AXIS_DEFAULT },
|
205
|
+
yAxis: { ...DATA_FORMATTER_VALUE_AXIS_DEFAULT },
|
206
|
+
container: {
|
207
|
+
...DATA_FORMATTER_CONTAINER_DEFAULT
|
208
|
+
},
|
209
|
+
separateCategory: false
|
210
|
+
}
|
211
|
+
DATA_FORMATTER_MULTI_VALUE_DEFAULT.visibleFilter.toString = () => `(datum, context) => true`
|
212
|
+
|
213
|
+
export const DATA_FORMATTER_TREE_DEFAULT: DataFormatterTree = {
|
214
|
+
type: 'tree',
|
215
|
+
visibleFilter: (datum, context) => true,
|
216
|
+
// labelFormat: (datum: any) => (datum && datum.label) ?? '',
|
217
|
+
categoryLabels: []
|
218
|
+
}
|
219
|
+
DATA_FORMATTER_TREE_DEFAULT.visibleFilter.toString = () => `(datum, context) => true`
|
220
|
+
|
221
|
+
export const DATA_FORMATTER_RELATIONAL_DEFAULT: DataFormatterRelationship = {
|
222
|
+
type: 'relationship',
|
223
|
+
visibleFilter: (datum, context) => true,
|
224
|
+
categoryLabels: []
|
225
|
+
// node: {
|
226
|
+
// // labelFormat: (node: any) => (node && node.label) ?? '',
|
227
|
+
// descriptionFormat: (node: any) => (node && node.label) ?? ''
|
228
|
+
// },
|
229
|
+
// edge: {
|
230
|
+
// // labelFormat: (edge: any) => (edge && edge.label) ?? '',
|
231
|
+
// descriptionFormat: (edge: any) => (edge && edge.label) ?? ''
|
232
|
+
// },
|
233
|
+
}
|
234
|
+
DATA_FORMATTER_RELATIONAL_DEFAULT.visibleFilter.toString = () => `(datum, context) => true`
|
235
|
+
|
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
|
-
|
3
|
-
// chartType型別使用 'any' 是為了讓 plugin entity 能夠被加入到所有類別的 chart.plugins$ 中
|
4
|
-
export const defineNoneDataPlugin = createBasePlugin<any>('noneData')
|
1
|
+
import { createBasePlugin } from './base/createBasePlugin'
|
2
|
+
|
3
|
+
// chartType型別使用 'any' 是為了讓 plugin entity 能夠被加入到所有類別的 chart.plugins$ 中
|
4
|
+
export const defineNoneDataPlugin = createBasePlugin<any>('noneData')
|
@@ -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')
|