@orbcharts/core 3.0.5 → 3.0.6

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.
Files changed (68) hide show
  1. package/LICENSE +200 -200
  2. package/dist/orbcharts-core.es.js +2217 -2164
  3. package/dist/orbcharts-core.umd.js +5 -5
  4. package/lib/core-types.ts +7 -7
  5. package/package.json +46 -46
  6. package/src/AbstractChart.ts +57 -57
  7. package/src/GridChart.ts +24 -24
  8. package/src/MultiGridChart.ts +24 -24
  9. package/src/MultiValueChart.ts +24 -24
  10. package/src/RelationshipChart.ts +24 -24
  11. package/src/SeriesChart.ts +24 -24
  12. package/src/TreeChart.ts +24 -24
  13. package/src/base/createBaseChart.ts +524 -524
  14. package/src/base/createBasePlugin.ts +154 -154
  15. package/src/base/validators/chartOptionsValidator.ts +23 -23
  16. package/src/base/validators/chartParamsValidator.ts +133 -133
  17. package/src/base/validators/elementValidator.ts +13 -13
  18. package/src/base/validators/pluginsValidator.ts +14 -14
  19. package/src/defaults.ts +284 -284
  20. package/src/defineGridPlugin.ts +3 -3
  21. package/src/defineMultiGridPlugin.ts +3 -3
  22. package/src/defineMultiValuePlugin.ts +3 -3
  23. package/src/defineNoneDataPlugin.ts +4 -4
  24. package/src/defineRelationshipPlugin.ts +3 -3
  25. package/src/defineSeriesPlugin.ts +3 -3
  26. package/src/defineTreePlugin.ts +3 -3
  27. package/src/grid/computedDataFn.ts +129 -129
  28. package/src/grid/contextObserverCallback.ts +209 -201
  29. package/src/grid/dataFormatterValidator.ts +125 -125
  30. package/src/grid/dataValidator.ts +12 -12
  31. package/src/grid/gridObservables.ts +698 -694
  32. package/src/index.ts +20 -20
  33. package/src/multiGrid/computedDataFn.ts +123 -123
  34. package/src/multiGrid/contextObserverCallback.ts +109 -75
  35. package/src/multiGrid/dataFormatterValidator.ts +120 -120
  36. package/src/multiGrid/dataValidator.ts +12 -12
  37. package/src/multiGrid/multiGridObservables.ts +366 -357
  38. package/src/multiValue/computedDataFn.ts +113 -113
  39. package/src/multiValue/contextObserverCallback.ts +328 -328
  40. package/src/multiValue/dataFormatterValidator.ts +94 -94
  41. package/src/multiValue/dataValidator.ts +12 -12
  42. package/src/multiValue/multiValueObservables.ts +865 -865
  43. package/src/relationship/computedDataFn.ts +159 -159
  44. package/src/relationship/contextObserverCallback.ts +80 -80
  45. package/src/relationship/dataFormatterValidator.ts +13 -13
  46. package/src/relationship/dataValidator.ts +13 -13
  47. package/src/relationship/relationshipObservables.ts +84 -84
  48. package/src/series/computedDataFn.ts +88 -88
  49. package/src/series/contextObserverCallback.ts +132 -132
  50. package/src/series/dataFormatterValidator.ts +46 -46
  51. package/src/series/dataValidator.ts +12 -12
  52. package/src/series/seriesObservables.ts +209 -209
  53. package/src/tree/computedDataFn.ts +129 -129
  54. package/src/tree/contextObserverCallback.ts +58 -58
  55. package/src/tree/dataFormatterValidator.ts +13 -13
  56. package/src/tree/dataValidator.ts +13 -13
  57. package/src/tree/treeObservables.ts +105 -105
  58. package/src/utils/commonUtils.ts +55 -55
  59. package/src/utils/d3Scale.ts +198 -198
  60. package/src/utils/errorMessage.ts +40 -40
  61. package/src/utils/index.ts +3 -3
  62. package/src/utils/observables.ts +308 -308
  63. package/src/utils/orbchartsUtils.ts +396 -396
  64. package/src/utils/validator.ts +126 -126
  65. package/tsconfig.base.json +13 -13
  66. package/tsconfig.json +2 -2
  67. package/vite-env.d.ts +6 -6
  68. package/vite.config.js +22 -22
@@ -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,284 +1,284 @@
1
- import type {
2
- ChartOptionsPartial,
3
- DataSeries,
4
- DataGrid,
5
- DataMultiGrid,
6
- DataMultiValue,
7
- DataTree,
8
- DataRelationship,
9
- DataFormatterValueAxis,
10
- DataFormatterGroupAxis,
11
- DataFormatterXYAxis,
12
- DataFormatterContainer,
13
- DataFormatterSeries,
14
- DataFormatterGrid,
15
- DataFormatterGridGrid,
16
- DataFormatterMultiGrid,
17
- DataFormatterMultiGridGrid,
18
- DataFormatterMultiValue,
19
- DataFormatterTree,
20
- DataFormatterRelationship,
21
- ChartParams,
22
- Padding
23
- } from '../lib/core-types'
24
-
25
- export const DEFAULT_CHART_OPTIONS: ChartOptionsPartial<any> = {
26
- // preset: {} // 預設為空
27
- width: 'auto',
28
- height: 'auto'
29
- }
30
-
31
- // export const GLOBAL_DEFAULT: ChartGlobalDefault = {
32
- // colors: ['#67B7DC', '#6794DC', '#6771DC', '#8067DC', '#A367DC', '#C767DC', '#DC67CE', '#DC67AB', '#DC6788', '#DC6967', '#DC8C67', '#DCAF67'],
33
- // padding: {
34
- // top: 50,
35
- // right: 70,
36
- // bottom: 50,
37
- // left: 70
38
- // },
39
- // // chartWidth: '100%',
40
- // // chartHeight: 500
41
- // }
42
-
43
- // export const COLORS_DEFAULT = ['#67B7DC', '#6794DC', '#6771DC', '#8067DC', '#A367DC', '#C767DC', '#DC67CE', '#DC67AB', '#DC6788', '#DC6967', '#DC8C67', '#DCAF67']
44
- // ['#ff7ab9', '#66dec8', '#84c8ff', '#30ad1b', '#f8c43e', '#fa5640', '#9d79d7', '#ea4f98']
45
-
46
- export const DEFAULT_PADDING: Padding = {
47
- top: 60,
48
- right: 60,
49
- bottom: 60,
50
- left: 60
51
- }
52
-
53
- export const DEFAULT_CHART_PARAMS: ChartParams = {
54
- padding: DEFAULT_PADDING,
55
- highlightTarget: 'datum',
56
- highlightDefault: null,
57
- colorScheme: 'light',
58
- colors: {
59
- light: {
60
- label: [
61
- "#0088FF",
62
- "#FF3232",
63
- "#38BEA8",
64
- "#6F3BD5",
65
- "#314285",
66
- "#42C724",
67
- "#D52580",
68
- "#F4721B",
69
- "#D117EA",
70
- "#7E7D7D"
71
- ],
72
- // label: ['#67B7DC', '#6794DC', '#6771DC', '#8067DC', '#A367DC', '#C767DC', '#DC67CE', '#DC67AB', '#DC6788', '#DC6967', '#DC8C67', '#DCAF67'],
73
- // label: ['#F3A356', '#7A60F0', '#38B1AF', '#60A2F0', '#F06062', '#FF383C', '#6580EA', '#079F9C', '#9F65EA', '#EA7465', '#EA7465', '#8657D2', '#59B757', '#2797FF', '#D25786', '#F54BA6', '#4BECF5', '#74FD72', '#CA4BF5', '#EFE26E'],
74
- // label: ['#60A2F0', '#F3A356', '#7A60F0', '#38B1AF', '#F06062', '#FF383C', '#6580EA', '#079F9C', '#9F65EA', '#EA7465', '#EA7465', '#8657D2', '#59B757', '#2797FF', '#D25786', '#F54BA6', '#4BECF5', '#74FD72', '#CA4BF5', '#EFE26E'],
75
- // primary: '#454545',
76
- // primary: '#1b1e23',
77
- primary: '#000000',
78
- secondary: '#e0e0e0',
79
- // white: '#ffffff',
80
- labelContrast: ['#ffffff', '#000000'],
81
- background: '#ffffff'
82
- },
83
- dark: {
84
- label: [
85
- "#4BABFF",
86
- "#FF6C6C",
87
- "#7DD3C4",
88
- "#8E6BC9",
89
- "#5366AC",
90
- "#86DC72",
91
- "#FF72BB",
92
- "#F9B052",
93
- "#EF76FF",
94
- "#C4C4C4"
95
- ],
96
- // label: ['#67B7DC', '#6794DC', '#6771DC', '#8067DC', '#A367DC', '#C767DC', '#DC67CE', '#DC67AB', '#DC6788', '#DC6967', '#DC8C67', '#DCAF67'],
97
- // label: ['#67B7DC', '#6794DC', '#38B1AF', '#6771DC', '#8067DC', '#A367DC', '#C767DC', '#DC67CE', '#DC67AB', '#DC6788', '#DC6967', '#DC8C67', '#DCAF67'],
98
- // label: ['#60A2F0', '#F3A356', '#7A60F0', '#38B1AF', '#F06062', '#FF383C', '#6580EA', '#079F9C', '#9F65EA', '#EA7465', '#EA7465', '#8657D2', '#59B757', '#2797FF', '#D25786', '#F54BA6', '#4BECF5', '#74FD72', '#CA4BF5', '#EFE26E'],
99
- // primary: '#f0f0f0',
100
- primary: '#ffffff',
101
- secondary: '#e0e0e0',
102
- // white: '#ffffff',
103
- labelContrast: ['#ffffff', '#000000'],
104
- background: '#000000'
105
- }
106
- },
107
- styles: {
108
- // textSize: 14,
109
- textSize: '0.875rem',
110
- unhighlightedOpacity: 0.3
111
- },
112
- transitionDuration: 800,
113
- transitionEase: 'easeCubic'
114
- }
115
-
116
- export const DEFAULT_CHART_WIDTH = 800
117
-
118
- export const DEFAULT_CHART_HEIGHT = 500
119
-
120
- // -- Data --
121
-
122
- export const DEFAULT_DATA_SERIES: DataSeries = []
123
-
124
- export const DEFAULT_DATA_GRID: DataGrid = []
125
-
126
- export const DEFAULT_DATA_MULTI_GRID: DataMultiGrid = []
127
-
128
- export const DEFAULT_DATA_MULTI_VALUE: DataMultiValue = []
129
-
130
- export const DEFAULT_DATA_TREE: DataTree = []
131
-
132
- export const DEFAULTL_DATA_RELATIONA: DataRelationship = {
133
- nodes: [],
134
- edges: []
135
- }
136
-
137
- // -- Data Formatter --
138
-
139
- export const DEFAULT_DATA_FORMATTER_VALUE_AXIS: DataFormatterValueAxis = {
140
- position: 'left',
141
- scaleDomain: ['auto', 'auto'],
142
- scaleRange: [0, 0.9],
143
- label: '',
144
- }
145
-
146
- export const DEFAULT_DATA_FORMATTER_GROUP_AXIS: DataFormatterGroupAxis = {
147
- position: 'bottom',
148
- scaleDomain: [0, 'max'],
149
- scalePadding: 0.5,
150
- label: ''
151
- }
152
-
153
- export const DEFAULT_DATA_FORMATTER_X_Y_AXIS: DataFormatterXYAxis = {
154
- scaleDomain: ['auto', 'auto'],
155
- scaleRange: [0, 0.9],
156
- label: '',
157
- valueIndex: 0
158
- }
159
-
160
- export const DEFAULT_DATA_FORMATTER_CONTAINER: DataFormatterContainer = {
161
- columnAmount: 1,
162
- rowAmount: 1,
163
- columnGap: 'auto',
164
- rowGap: 'auto'
165
- }
166
-
167
- export const DEFAULT_DATA_FORMATTER_SERIES: DataFormatterSeries = {
168
- type: 'series',
169
- visibleFilter: (datum, context) => true,
170
- sort: null,
171
- seriesLabels: [],
172
- container: {
173
- ...DEFAULT_DATA_FORMATTER_CONTAINER
174
- },
175
- separateSeries: false,
176
- separateLabel: false,
177
- sumSeries: false
178
- // mapSeries: (datum, rowIndex, columnIndex, { data, dataFormatter }) => {
179
- // const seriesIndex = rowIndex >= dataFormatter.seriesLabels.length
180
- // ? rowIndex % dataFormatter.seriesLabels.length // 如果index大於所設定的seriesLabels的數量則從頭回來算
181
- // : rowIndex
182
- // return dataFormatter.seriesLabels[seriesIndex]
183
- // },
184
- // colorsPredicate: (datum, rowIndex, columnIndex, { chartParams }) => {
185
- // return rowIndex < chartParams.colors[chartParams.colorScheme].series.length
186
- // ? chartParams.colors[chartParams.colorScheme].series[rowIndex]
187
- // : chartParams.colors[chartParams.colorScheme].series[
188
- // rowIndex % chartParams.colors[chartParams.colorScheme].series.length
189
- // ]
190
- // },
191
- }
192
- DEFAULT_DATA_FORMATTER_SERIES.visibleFilter.toString = () => `(datum, context) => true`
193
-
194
- export const DEFAULT_DATA_FORMATTER_GRID_GRID: DataFormatterGridGrid = {
195
- seriesDirection: 'row',
196
- rowLabels: [],
197
- columnLabels: [],
198
- valueAxis: { ...DEFAULT_DATA_FORMATTER_VALUE_AXIS },
199
- groupAxis: { ...DEFAULT_DATA_FORMATTER_GROUP_AXIS, },
200
- separateSeries: false,
201
- // slotIndex: 0,
202
- // seriesSlotIndexes: null
203
- }
204
-
205
- export const DEFAULT_DATA_FORMATTER_GRID: DataFormatterGrid = {
206
- type: 'grid',
207
- visibleFilter: (datum, context) => true,
208
- // grid: {
209
- ...DEFAULT_DATA_FORMATTER_GRID_GRID,
210
- // },
211
- container: {
212
- ...DEFAULT_DATA_FORMATTER_CONTAINER
213
- }
214
- }
215
- DEFAULT_DATA_FORMATTER_GRID.visibleFilter.toString = () => `(datum, context) => true`
216
-
217
- // export const DATA_FORMATTER_MULTI_GRID_MULTI_GRID_DEFAULT: DataFormatterMultiGridMultiGrid = {
218
- // ...DEFAULT_DATA_FORMATTER_GRID,
219
- // slotIndex: 0,
220
- // seriesSlotIndexes: null
221
- // }
222
-
223
- export const DEFAULT_DATA_FORMATTER_MULTI_GRID_GRID: DataFormatterMultiGridGrid = {
224
- ...DEFAULT_DATA_FORMATTER_GRID_GRID
225
- }
226
-
227
- export const DEFAULT_DATA_FORMATTER_MULTI_GRID: DataFormatterMultiGrid = {
228
- type: 'multiGrid',
229
- visibleFilter: (datum, context) => true,
230
- gridList: [
231
- {
232
- ...DEFAULT_DATA_FORMATTER_MULTI_GRID_GRID
233
- },
234
- ],
235
- separateGrid: false,
236
- container: {
237
- ...DEFAULT_DATA_FORMATTER_CONTAINER
238
- }
239
- }
240
- DEFAULT_DATA_FORMATTER_MULTI_GRID.visibleFilter.toString = () => `(datum, context) => true`
241
-
242
- export const DEFAULT_DATA_FORMATTER_MULTI_VALUE: DataFormatterMultiValue = {
243
- type: 'multiValue',
244
- visibleFilter: (datum, context) => true,
245
- categoryLabels: [],
246
- valueLabels: [],
247
- xAxis: {
248
- ...DEFAULT_DATA_FORMATTER_X_Y_AXIS,
249
- valueIndex: 0
250
- },
251
- yAxis: {
252
- ...DEFAULT_DATA_FORMATTER_X_Y_AXIS,
253
- valueIndex: 1
254
- },
255
- container: {
256
- ...DEFAULT_DATA_FORMATTER_CONTAINER
257
- },
258
- separateCategory: false
259
- }
260
- DEFAULT_DATA_FORMATTER_MULTI_VALUE.visibleFilter.toString = () => `(datum, context) => true`
261
-
262
- export const DEFAULT_DATA_FORMATTER_TREE: DataFormatterTree = {
263
- type: 'tree',
264
- visibleFilter: (datum, context) => true,
265
- // labelFormat: (datum: any) => (datum && datum.label) ?? '',
266
- categoryLabels: []
267
- }
268
- DEFAULT_DATA_FORMATTER_TREE.visibleFilter.toString = () => `(datum, context) => true`
269
-
270
- export const DEFAULT_DATA_FORMATTER_RELATIONSHIP: DataFormatterRelationship = {
271
- type: 'relationship',
272
- visibleFilter: (datum, context) => true,
273
- categoryLabels: []
274
- // node: {
275
- // // labelFormat: (node: any) => (node && node.label) ?? '',
276
- // descriptionFormat: (node: any) => (node && node.label) ?? ''
277
- // },
278
- // edge: {
279
- // // labelFormat: (edge: any) => (edge && edge.label) ?? '',
280
- // descriptionFormat: (edge: any) => (edge && edge.label) ?? ''
281
- // },
282
- }
283
- DEFAULT_DATA_FORMATTER_RELATIONSHIP.visibleFilter.toString = () => `(datum, context) => true`
284
-
1
+ import type {
2
+ ChartOptionsPartial,
3
+ DataSeries,
4
+ DataGrid,
5
+ DataMultiGrid,
6
+ DataMultiValue,
7
+ DataTree,
8
+ DataRelationship,
9
+ DataFormatterValueAxis,
10
+ DataFormatterGroupAxis,
11
+ DataFormatterXYAxis,
12
+ DataFormatterContainer,
13
+ DataFormatterSeries,
14
+ DataFormatterGrid,
15
+ DataFormatterGridGrid,
16
+ DataFormatterMultiGrid,
17
+ DataFormatterMultiGridGrid,
18
+ DataFormatterMultiValue,
19
+ DataFormatterTree,
20
+ DataFormatterRelationship,
21
+ ChartParams,
22
+ Padding
23
+ } from '../lib/core-types'
24
+
25
+ export const DEFAULT_CHART_OPTIONS: ChartOptionsPartial<any> = {
26
+ // preset: {} // 預設為空
27
+ width: 'auto',
28
+ height: 'auto'
29
+ }
30
+
31
+ // export const GLOBAL_DEFAULT: ChartGlobalDefault = {
32
+ // colors: ['#67B7DC', '#6794DC', '#6771DC', '#8067DC', '#A367DC', '#C767DC', '#DC67CE', '#DC67AB', '#DC6788', '#DC6967', '#DC8C67', '#DCAF67'],
33
+ // padding: {
34
+ // top: 50,
35
+ // right: 70,
36
+ // bottom: 50,
37
+ // left: 70
38
+ // },
39
+ // // chartWidth: '100%',
40
+ // // chartHeight: 500
41
+ // }
42
+
43
+ // export const COLORS_DEFAULT = ['#67B7DC', '#6794DC', '#6771DC', '#8067DC', '#A367DC', '#C767DC', '#DC67CE', '#DC67AB', '#DC6788', '#DC6967', '#DC8C67', '#DCAF67']
44
+ // ['#ff7ab9', '#66dec8', '#84c8ff', '#30ad1b', '#f8c43e', '#fa5640', '#9d79d7', '#ea4f98']
45
+
46
+ export const DEFAULT_PADDING: Padding = {
47
+ top: 60,
48
+ right: 60,
49
+ bottom: 60,
50
+ left: 60
51
+ }
52
+
53
+ export const DEFAULT_CHART_PARAMS: ChartParams = {
54
+ padding: DEFAULT_PADDING,
55
+ highlightTarget: 'datum',
56
+ highlightDefault: null,
57
+ colorScheme: 'light',
58
+ colors: {
59
+ light: {
60
+ label: [
61
+ "#0088FF",
62
+ "#FF3232",
63
+ "#38BEA8",
64
+ "#6F3BD5",
65
+ "#314285",
66
+ "#42C724",
67
+ "#D52580",
68
+ "#F4721B",
69
+ "#D117EA",
70
+ "#7E7D7D"
71
+ ],
72
+ // label: ['#67B7DC', '#6794DC', '#6771DC', '#8067DC', '#A367DC', '#C767DC', '#DC67CE', '#DC67AB', '#DC6788', '#DC6967', '#DC8C67', '#DCAF67'],
73
+ // label: ['#F3A356', '#7A60F0', '#38B1AF', '#60A2F0', '#F06062', '#FF383C', '#6580EA', '#079F9C', '#9F65EA', '#EA7465', '#EA7465', '#8657D2', '#59B757', '#2797FF', '#D25786', '#F54BA6', '#4BECF5', '#74FD72', '#CA4BF5', '#EFE26E'],
74
+ // label: ['#60A2F0', '#F3A356', '#7A60F0', '#38B1AF', '#F06062', '#FF383C', '#6580EA', '#079F9C', '#9F65EA', '#EA7465', '#EA7465', '#8657D2', '#59B757', '#2797FF', '#D25786', '#F54BA6', '#4BECF5', '#74FD72', '#CA4BF5', '#EFE26E'],
75
+ // primary: '#454545',
76
+ // primary: '#1b1e23',
77
+ primary: '#000000',
78
+ secondary: '#e0e0e0',
79
+ // white: '#ffffff',
80
+ labelContrast: ['#ffffff', '#000000'],
81
+ background: '#ffffff'
82
+ },
83
+ dark: {
84
+ label: [
85
+ "#4BABFF",
86
+ "#FF6C6C",
87
+ "#7DD3C4",
88
+ "#8E6BC9",
89
+ "#5366AC",
90
+ "#86DC72",
91
+ "#FF72BB",
92
+ "#F9B052",
93
+ "#EF76FF",
94
+ "#C4C4C4"
95
+ ],
96
+ // label: ['#67B7DC', '#6794DC', '#6771DC', '#8067DC', '#A367DC', '#C767DC', '#DC67CE', '#DC67AB', '#DC6788', '#DC6967', '#DC8C67', '#DCAF67'],
97
+ // label: ['#67B7DC', '#6794DC', '#38B1AF', '#6771DC', '#8067DC', '#A367DC', '#C767DC', '#DC67CE', '#DC67AB', '#DC6788', '#DC6967', '#DC8C67', '#DCAF67'],
98
+ // label: ['#60A2F0', '#F3A356', '#7A60F0', '#38B1AF', '#F06062', '#FF383C', '#6580EA', '#079F9C', '#9F65EA', '#EA7465', '#EA7465', '#8657D2', '#59B757', '#2797FF', '#D25786', '#F54BA6', '#4BECF5', '#74FD72', '#CA4BF5', '#EFE26E'],
99
+ // primary: '#f0f0f0',
100
+ primary: '#ffffff',
101
+ secondary: '#e0e0e0',
102
+ // white: '#ffffff',
103
+ labelContrast: ['#ffffff', '#000000'],
104
+ background: '#000000'
105
+ }
106
+ },
107
+ styles: {
108
+ // textSize: 14,
109
+ textSize: '0.875rem',
110
+ unhighlightedOpacity: 0.3
111
+ },
112
+ transitionDuration: 800,
113
+ transitionEase: 'easeCubic'
114
+ }
115
+
116
+ export const DEFAULT_CHART_WIDTH = 800
117
+
118
+ export const DEFAULT_CHART_HEIGHT = 500
119
+
120
+ // -- Data --
121
+
122
+ export const DEFAULT_DATA_SERIES: DataSeries = []
123
+
124
+ export const DEFAULT_DATA_GRID: DataGrid = []
125
+
126
+ export const DEFAULT_DATA_MULTI_GRID: DataMultiGrid = []
127
+
128
+ export const DEFAULT_DATA_MULTI_VALUE: DataMultiValue = []
129
+
130
+ export const DEFAULT_DATA_TREE: DataTree = []
131
+
132
+ export const DEFAULTL_DATA_RELATIONA: DataRelationship = {
133
+ nodes: [],
134
+ edges: []
135
+ }
136
+
137
+ // -- Data Formatter --
138
+
139
+ export const DEFAULT_DATA_FORMATTER_VALUE_AXIS: DataFormatterValueAxis = {
140
+ position: 'left',
141
+ scaleDomain: ['auto', 'auto'],
142
+ scaleRange: [0, 0.9],
143
+ label: '',
144
+ }
145
+
146
+ export const DEFAULT_DATA_FORMATTER_GROUP_AXIS: DataFormatterGroupAxis = {
147
+ position: 'bottom',
148
+ scaleDomain: [0, 'max'],
149
+ scalePadding: 0.5,
150
+ label: ''
151
+ }
152
+
153
+ export const DEFAULT_DATA_FORMATTER_X_Y_AXIS: DataFormatterXYAxis = {
154
+ scaleDomain: ['auto', 'auto'],
155
+ scaleRange: [0, 0.9],
156
+ label: '',
157
+ valueIndex: 0
158
+ }
159
+
160
+ export const DEFAULT_DATA_FORMATTER_CONTAINER: DataFormatterContainer = {
161
+ columnAmount: 1,
162
+ rowAmount: 1,
163
+ columnGap: 'auto',
164
+ rowGap: 'auto'
165
+ }
166
+
167
+ export const DEFAULT_DATA_FORMATTER_SERIES: DataFormatterSeries = {
168
+ type: 'series',
169
+ visibleFilter: (datum, context) => true,
170
+ sort: null,
171
+ seriesLabels: [],
172
+ container: {
173
+ ...DEFAULT_DATA_FORMATTER_CONTAINER
174
+ },
175
+ separateSeries: false,
176
+ separateLabel: false,
177
+ sumSeries: false
178
+ // mapSeries: (datum, rowIndex, columnIndex, { data, dataFormatter }) => {
179
+ // const seriesIndex = rowIndex >= dataFormatter.seriesLabels.length
180
+ // ? rowIndex % dataFormatter.seriesLabels.length // 如果index大於所設定的seriesLabels的數量則從頭回來算
181
+ // : rowIndex
182
+ // return dataFormatter.seriesLabels[seriesIndex]
183
+ // },
184
+ // colorsPredicate: (datum, rowIndex, columnIndex, { chartParams }) => {
185
+ // return rowIndex < chartParams.colors[chartParams.colorScheme].series.length
186
+ // ? chartParams.colors[chartParams.colorScheme].series[rowIndex]
187
+ // : chartParams.colors[chartParams.colorScheme].series[
188
+ // rowIndex % chartParams.colors[chartParams.colorScheme].series.length
189
+ // ]
190
+ // },
191
+ }
192
+ DEFAULT_DATA_FORMATTER_SERIES.visibleFilter.toString = () => `(datum, context) => true`
193
+
194
+ export const DEFAULT_DATA_FORMATTER_GRID_GRID: DataFormatterGridGrid = {
195
+ seriesDirection: 'row',
196
+ rowLabels: [],
197
+ columnLabels: [],
198
+ valueAxis: { ...DEFAULT_DATA_FORMATTER_VALUE_AXIS },
199
+ groupAxis: { ...DEFAULT_DATA_FORMATTER_GROUP_AXIS, },
200
+ separateSeries: false,
201
+ // slotIndex: 0,
202
+ // seriesSlotIndexes: null
203
+ }
204
+
205
+ export const DEFAULT_DATA_FORMATTER_GRID: DataFormatterGrid = {
206
+ type: 'grid',
207
+ visibleFilter: (datum, context) => true,
208
+ // grid: {
209
+ ...DEFAULT_DATA_FORMATTER_GRID_GRID,
210
+ // },
211
+ container: {
212
+ ...DEFAULT_DATA_FORMATTER_CONTAINER
213
+ }
214
+ }
215
+ DEFAULT_DATA_FORMATTER_GRID.visibleFilter.toString = () => `(datum, context) => true`
216
+
217
+ // export const DATA_FORMATTER_MULTI_GRID_MULTI_GRID_DEFAULT: DataFormatterMultiGridMultiGrid = {
218
+ // ...DEFAULT_DATA_FORMATTER_GRID,
219
+ // slotIndex: 0,
220
+ // seriesSlotIndexes: null
221
+ // }
222
+
223
+ export const DEFAULT_DATA_FORMATTER_MULTI_GRID_GRID: DataFormatterMultiGridGrid = {
224
+ ...DEFAULT_DATA_FORMATTER_GRID_GRID
225
+ }
226
+
227
+ export const DEFAULT_DATA_FORMATTER_MULTI_GRID: DataFormatterMultiGrid = {
228
+ type: 'multiGrid',
229
+ visibleFilter: (datum, context) => true,
230
+ gridList: [
231
+ {
232
+ ...DEFAULT_DATA_FORMATTER_MULTI_GRID_GRID
233
+ },
234
+ ],
235
+ separateGrid: false,
236
+ container: {
237
+ ...DEFAULT_DATA_FORMATTER_CONTAINER
238
+ }
239
+ }
240
+ DEFAULT_DATA_FORMATTER_MULTI_GRID.visibleFilter.toString = () => `(datum, context) => true`
241
+
242
+ export const DEFAULT_DATA_FORMATTER_MULTI_VALUE: DataFormatterMultiValue = {
243
+ type: 'multiValue',
244
+ visibleFilter: (datum, context) => true,
245
+ categoryLabels: [],
246
+ valueLabels: [],
247
+ xAxis: {
248
+ ...DEFAULT_DATA_FORMATTER_X_Y_AXIS,
249
+ valueIndex: 0
250
+ },
251
+ yAxis: {
252
+ ...DEFAULT_DATA_FORMATTER_X_Y_AXIS,
253
+ valueIndex: 1
254
+ },
255
+ container: {
256
+ ...DEFAULT_DATA_FORMATTER_CONTAINER
257
+ },
258
+ separateCategory: false
259
+ }
260
+ DEFAULT_DATA_FORMATTER_MULTI_VALUE.visibleFilter.toString = () => `(datum, context) => true`
261
+
262
+ export const DEFAULT_DATA_FORMATTER_TREE: DataFormatterTree = {
263
+ type: 'tree',
264
+ visibleFilter: (datum, context) => true,
265
+ // labelFormat: (datum: any) => (datum && datum.label) ?? '',
266
+ categoryLabels: []
267
+ }
268
+ DEFAULT_DATA_FORMATTER_TREE.visibleFilter.toString = () => `(datum, context) => true`
269
+
270
+ export const DEFAULT_DATA_FORMATTER_RELATIONSHIP: DataFormatterRelationship = {
271
+ type: 'relationship',
272
+ visibleFilter: (datum, context) => true,
273
+ categoryLabels: []
274
+ // node: {
275
+ // // labelFormat: (node: any) => (node && node.label) ?? '',
276
+ // descriptionFormat: (node: any) => (node && node.label) ?? ''
277
+ // },
278
+ // edge: {
279
+ // // labelFormat: (edge: any) => (edge && edge.label) ?? '',
280
+ // descriptionFormat: (edge: any) => (edge && edge.label) ?? ''
281
+ // },
282
+ }
283
+ DEFAULT_DATA_FORMATTER_RELATIONSHIP.visibleFilter.toString = () => `(datum, context) => true`
284
+
@@ -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')
@@ -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')