@orbcharts/presets-basic 3.0.0-alpha.2 → 3.0.0-alpha.3
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +200 -200
- package/dist/orbcharts-presets-basic.es.js +196 -119
- package/dist/orbcharts-presets-basic.umd.js +1 -1
- package/dist/src/chartParamsFiles/CP_BOTTOM_AND_LEFT_PADDING.d.ts +3 -0
- package/dist/src/chartParamsFiles/CP_BOTTOM_AND_LEFT_PADDING_WITH_SERIES_HIGHLIGHT.d.ts +3 -0
- package/dist/src/chartParamsFiles/CP_BOTTOM_LONG_PADDING_WITH_SERIES_HIGHLIGHT.d.ts +3 -0
- package/dist/src/chartParamsFiles/CP_BOTTOM_PADDING_WITH_SERIES_HIGHLIGHT.d.ts +3 -0
- package/dist/src/chartParamsFiles/CP_TOP_AND_NO_BOTTOM_PADDING.d.ts +3 -0
- package/dist/src/chartParamsFiles/index.d.ts +5 -0
- package/dist/src/index.d.ts +3 -0
- package/package.json +43 -43
- package/src/chartParamsFiles/CP_BOTTOM_AND_LEFT_PADDING.ts +14 -0
- package/src/chartParamsFiles/CP_BOTTOM_AND_LEFT_PADDING_WITH_SERIES_HIGHLIGHT.ts +15 -0
- package/src/chartParamsFiles/CP_BOTTOM_LONG_PADDING.ts +13 -13
- package/src/chartParamsFiles/CP_BOTTOM_LONG_PADDING_WITH_SERIES_HIGHLIGHT.ts +15 -0
- package/src/chartParamsFiles/CP_BOTTOM_PADDING.ts +13 -13
- package/src/chartParamsFiles/CP_BOTTOM_PADDING_WITH_GROUP_HIGHLIGHT.ts +14 -14
- package/src/chartParamsFiles/CP_BOTTOM_PADDING_WITH_SERIES_HIGHLIGHT.ts +15 -0
- package/src/chartParamsFiles/CP_LEFT_PADDING.ts +13 -13
- package/src/chartParamsFiles/CP_RIGHT_PADDING.ts +13 -13
- package/src/chartParamsFiles/CP_TOP_AND_NO_BOTTOM_PADDING.ts +14 -0
- package/src/chartParamsFiles/index.ts +9 -4
- package/src/createPreset.ts +87 -87
- package/src/gridDataFormatterFiles/DF_BOTTOM_VALUE_AXIS.ts +15 -15
- package/src/gridPluginParamsFiles/Bars/PP_BARS_ROUND.ts +14 -14
- package/src/gridPluginParamsFiles/Bars/PP_BARS_THIN.ts +14 -14
- package/src/gridPluginParamsFiles/Bars/index.ts +1 -1
- package/src/gridPluginParamsFiles/Dots/PP_DOTS_ONLY_SHOW_HIGHLIGHTED.ts +12 -14
- package/src/gridPluginParamsFiles/Dots/PP_DOTS_SOLID.ts +14 -14
- package/src/gridPluginParamsFiles/Dots/index.ts +1 -1
- package/src/gridPluginParamsFiles/GridLegend/PP_GRID_LEGEND_BOTTOM.ts +13 -13
- package/src/gridPluginParamsFiles/GridLegend/PP_GRID_LEGEND_BOTTOM_WITH_LINE_LIST.ts +14 -14
- package/src/gridPluginParamsFiles/GridLegend/index.ts +1 -1
- package/src/gridPluginParamsFiles/GroupAxis/PP_GROUP_AXIS_ROTATE_LABEL.ts +11 -11
- package/src/gridPluginParamsFiles/Lines/PP_LINES_CURVE.ts +12 -12
- package/src/gridPluginParamsFiles/index.ts +5 -5
- package/src/index.ts +124 -114
- package/src/seriesPluginParamsFiles/Bubbles/PP_BUBBLES_SCALING_BY_RADIUS.ts +11 -11
- package/src/seriesPluginParamsFiles/Pie/PP_PIE_DONUT.ts +12 -12
- package/src/seriesPluginParamsFiles/Pie/PP_PIE_HALF_DONUT.ts +14 -14
- package/src/seriesPluginParamsFiles/Pie/index.ts +1 -1
- package/src/seriesPluginParamsFiles/PieLabels/PP_PIE_LABELS_HALF_ANGLE.ts +13 -13
- package/src/seriesPluginParamsFiles/PieLabels/PP_PIE_LABELS_INNER.ts +13 -13
- package/src/seriesPluginParamsFiles/PieLabels/index.ts +1 -1
- package/src/seriesPluginParamsFiles/SeriesLegend/PP_SERIES_LEGEND_ROUND.ts +11 -11
- package/src/seriesPluginParamsFiles/index.ts +3 -3
- package/src/types.ts +58 -58
- package/tsconfig.json +13 -13
- package/vite.config.js +44 -44
package/package.json
CHANGED
@@ -1,43 +1,43 @@
|
|
1
|
-
{
|
2
|
-
"name": "@orbcharts/presets-basic",
|
3
|
-
"version": "3.0.0-alpha.
|
4
|
-
"description": "presets for OrbCharts",
|
5
|
-
"author": "Blue Planet Inc.",
|
6
|
-
"license": "Apache-2.0",
|
7
|
-
"keywords": [
|
8
|
-
"d3",
|
9
|
-
"rxjs",
|
10
|
-
"svg",
|
11
|
-
"visualization",
|
12
|
-
"infographic",
|
13
|
-
"graph",
|
14
|
-
"chart"
|
15
|
-
],
|
16
|
-
"private": false,
|
17
|
-
"publishConfig": {
|
18
|
-
"access": "public",
|
19
|
-
"registry": "https://registry.npmjs.org/"
|
20
|
-
},
|
21
|
-
"files": [
|
22
|
-
"*"
|
23
|
-
],
|
24
|
-
"module": "./dist/orbcharts-presets-basic.es.js",
|
25
|
-
"types": "./dist/src/index.d.ts",
|
26
|
-
"scripts": {
|
27
|
-
"test": "echo \"Error: no test specified\" && exit 1",
|
28
|
-
"build": "vite build --mode release"
|
29
|
-
},
|
30
|
-
"devDependencies": {
|
31
|
-
"@types/d3": "^7.4.0",
|
32
|
-
"ts-loader": "^9.4.2",
|
33
|
-
"typescript": "^5.0.4",
|
34
|
-
"vite": "^5.3.5",
|
35
|
-
"vite-plugin-dts": "^3.7.3"
|
36
|
-
},
|
37
|
-
"dependencies": {
|
38
|
-
"@orbcharts/core": "^3.0.0-alpha.26",
|
39
|
-
"@orbcharts/plugins-basic": "^3.0.0-alpha.30",
|
40
|
-
"d3": "^7.8.5",
|
41
|
-
"rxjs": "^7.8.1"
|
42
|
-
}
|
43
|
-
}
|
1
|
+
{
|
2
|
+
"name": "@orbcharts/presets-basic",
|
3
|
+
"version": "3.0.0-alpha.3",
|
4
|
+
"description": "presets for OrbCharts",
|
5
|
+
"author": "Blue Planet Inc.",
|
6
|
+
"license": "Apache-2.0",
|
7
|
+
"keywords": [
|
8
|
+
"d3",
|
9
|
+
"rxjs",
|
10
|
+
"svg",
|
11
|
+
"visualization",
|
12
|
+
"infographic",
|
13
|
+
"graph",
|
14
|
+
"chart"
|
15
|
+
],
|
16
|
+
"private": false,
|
17
|
+
"publishConfig": {
|
18
|
+
"access": "public",
|
19
|
+
"registry": "https://registry.npmjs.org/"
|
20
|
+
},
|
21
|
+
"files": [
|
22
|
+
"*"
|
23
|
+
],
|
24
|
+
"module": "./dist/orbcharts-presets-basic.es.js",
|
25
|
+
"types": "./dist/src/index.d.ts",
|
26
|
+
"scripts": {
|
27
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
28
|
+
"build": "vite build --mode release"
|
29
|
+
},
|
30
|
+
"devDependencies": {
|
31
|
+
"@types/d3": "^7.4.0",
|
32
|
+
"ts-loader": "^9.4.2",
|
33
|
+
"typescript": "^5.0.4",
|
34
|
+
"vite": "^5.3.5",
|
35
|
+
"vite-plugin-dts": "^3.7.3"
|
36
|
+
},
|
37
|
+
"dependencies": {
|
38
|
+
"@orbcharts/core": "^3.0.0-alpha.26",
|
39
|
+
"@orbcharts/plugins-basic": "^3.0.0-alpha.30",
|
40
|
+
"d3": "^7.8.5",
|
41
|
+
"rxjs": "^7.8.1"
|
42
|
+
}
|
43
|
+
}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import type { ChartParamsFile } from '../types'
|
2
|
+
|
3
|
+
export const CP_BOTTOM_AND_LEFT_PADDING: ChartParamsFile = {
|
4
|
+
id: 'CP_BOTTOM_AND_LEFT_PADDING',
|
5
|
+
description: '間距下面及左邊留空',
|
6
|
+
data: {
|
7
|
+
padding: {
|
8
|
+
top: 60,
|
9
|
+
right: 60,
|
10
|
+
bottom: 120,
|
11
|
+
left: 120
|
12
|
+
},
|
13
|
+
}
|
14
|
+
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import type { ChartParamsFile } from '../types'
|
2
|
+
|
3
|
+
export const CP_BOTTOM_AND_LEFT_PADDING_WITH_SERIES_HIGHLIGHT: ChartParamsFile = {
|
4
|
+
id: 'CP_BOTTOM_AND_LEFT_PADDING_WITH_SERIES_HIGHLIGHT',
|
5
|
+
description: '間距下面及左邊留空',
|
6
|
+
data: {
|
7
|
+
padding: {
|
8
|
+
top: 60,
|
9
|
+
right: 60,
|
10
|
+
bottom: 120,
|
11
|
+
left: 120
|
12
|
+
},
|
13
|
+
highlightTarget: 'series'
|
14
|
+
}
|
15
|
+
}
|
@@ -1,14 +1,14 @@
|
|
1
|
-
import type { ChartParamsFile } from '../types'
|
2
|
-
|
3
|
-
export const CP_BOTTOM_LONG_PADDING: ChartParamsFile = {
|
4
|
-
id: 'CP_BOTTOM_LONG_PADDING',
|
5
|
-
description: '間距下面加長留空',
|
6
|
-
data: {
|
7
|
-
padding: {
|
8
|
-
top: 60,
|
9
|
-
right: 60,
|
10
|
-
bottom:
|
11
|
-
left: 60
|
12
|
-
},
|
13
|
-
}
|
1
|
+
import type { ChartParamsFile } from '../types'
|
2
|
+
|
3
|
+
export const CP_BOTTOM_LONG_PADDING: ChartParamsFile = {
|
4
|
+
id: 'CP_BOTTOM_LONG_PADDING',
|
5
|
+
description: '間距下面加長留空',
|
6
|
+
data: {
|
7
|
+
padding: {
|
8
|
+
top: 60,
|
9
|
+
right: 60,
|
10
|
+
bottom: 140,
|
11
|
+
left: 60
|
12
|
+
},
|
13
|
+
}
|
14
14
|
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import type { ChartParamsFile } from '../types'
|
2
|
+
|
3
|
+
export const CP_BOTTOM_LONG_PADDING_WITH_SERIES_HIGHLIGHT: ChartParamsFile = {
|
4
|
+
id: 'CP_BOTTOM_LONG_PADDING_WITH_SERIES_HIGHLIGHT',
|
5
|
+
description: '間距下面加長留空及highlight系列',
|
6
|
+
data: {
|
7
|
+
padding: {
|
8
|
+
top: 60,
|
9
|
+
right: 60,
|
10
|
+
bottom: 140,
|
11
|
+
left: 60
|
12
|
+
},
|
13
|
+
highlightTarget: 'series'
|
14
|
+
}
|
15
|
+
}
|
@@ -1,14 +1,14 @@
|
|
1
|
-
import type { ChartParamsFile } from '../types'
|
2
|
-
|
3
|
-
export const CP_BOTTOM_PADDING: ChartParamsFile = {
|
4
|
-
id: 'CP_BOTTOM_PADDING',
|
5
|
-
description: '間距下面留空',
|
6
|
-
data: {
|
7
|
-
padding: {
|
8
|
-
top: 60,
|
9
|
-
right: 60,
|
10
|
-
bottom: 120,
|
11
|
-
left: 60
|
12
|
-
},
|
13
|
-
}
|
1
|
+
import type { ChartParamsFile } from '../types'
|
2
|
+
|
3
|
+
export const CP_BOTTOM_PADDING: ChartParamsFile = {
|
4
|
+
id: 'CP_BOTTOM_PADDING',
|
5
|
+
description: '間距下面留空',
|
6
|
+
data: {
|
7
|
+
padding: {
|
8
|
+
top: 60,
|
9
|
+
right: 60,
|
10
|
+
bottom: 120,
|
11
|
+
left: 60
|
12
|
+
},
|
13
|
+
}
|
14
14
|
}
|
@@ -1,15 +1,15 @@
|
|
1
|
-
import type { ChartParamsFile } from '../types'
|
2
|
-
|
3
|
-
export const CP_BOTTOM_PADDING_WITH_GROUP_HIGHLIGHT: ChartParamsFile = {
|
4
|
-
id: 'CP_BOTTOM_PADDING_WITH_GROUP_HIGHLIGHT',
|
5
|
-
description: '間距下面留空及highlight群組',
|
6
|
-
data: {
|
7
|
-
padding: {
|
8
|
-
top: 60,
|
9
|
-
right: 60,
|
10
|
-
bottom: 120,
|
11
|
-
left: 60
|
12
|
-
},
|
13
|
-
highlightTarget: 'group'
|
14
|
-
}
|
1
|
+
import type { ChartParamsFile } from '../types'
|
2
|
+
|
3
|
+
export const CP_BOTTOM_PADDING_WITH_GROUP_HIGHLIGHT: ChartParamsFile = {
|
4
|
+
id: 'CP_BOTTOM_PADDING_WITH_GROUP_HIGHLIGHT',
|
5
|
+
description: '間距下面留空及highlight群組',
|
6
|
+
data: {
|
7
|
+
padding: {
|
8
|
+
top: 60,
|
9
|
+
right: 60,
|
10
|
+
bottom: 120,
|
11
|
+
left: 60
|
12
|
+
},
|
13
|
+
highlightTarget: 'group'
|
14
|
+
}
|
15
15
|
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import type { ChartParamsFile } from '../types'
|
2
|
+
|
3
|
+
export const CP_BOTTOM_PADDING_WITH_SERIES_HIGHLIGHT: ChartParamsFile = {
|
4
|
+
id: 'CP_BOTTOM_PADDING_WITH_GROUP_HIGHLIGHT',
|
5
|
+
description: '間距下面留空及highlight系列',
|
6
|
+
data: {
|
7
|
+
padding: {
|
8
|
+
top: 60,
|
9
|
+
right: 60,
|
10
|
+
bottom: 120,
|
11
|
+
left: 60
|
12
|
+
},
|
13
|
+
highlightTarget: 'series'
|
14
|
+
}
|
15
|
+
}
|
@@ -1,14 +1,14 @@
|
|
1
|
-
import type { ChartParamsFile } from '../types'
|
2
|
-
|
3
|
-
export const CP_LEFT_PADDING: ChartParamsFile = {
|
4
|
-
id: 'CP_LEFT_PADDING',
|
5
|
-
description: '間距右邊留空',
|
6
|
-
data: {
|
7
|
-
padding: {
|
8
|
-
top: 60,
|
9
|
-
right: 60,
|
10
|
-
bottom: 60,
|
11
|
-
left:
|
12
|
-
},
|
13
|
-
}
|
1
|
+
import type { ChartParamsFile } from '../types'
|
2
|
+
|
3
|
+
export const CP_LEFT_PADDING: ChartParamsFile = {
|
4
|
+
id: 'CP_LEFT_PADDING',
|
5
|
+
description: '間距右邊留空',
|
6
|
+
data: {
|
7
|
+
padding: {
|
8
|
+
top: 60,
|
9
|
+
right: 60,
|
10
|
+
bottom: 60,
|
11
|
+
left: 120
|
12
|
+
},
|
13
|
+
}
|
14
14
|
}
|
@@ -1,14 +1,14 @@
|
|
1
|
-
import type { ChartParamsFile } from '../types'
|
2
|
-
|
3
|
-
export const CP_RIGHT_PADDING: ChartParamsFile = {
|
4
|
-
id: 'CP_RIGHT_PADDING',
|
5
|
-
description: '間距右邊留空',
|
6
|
-
data: {
|
7
|
-
padding: {
|
8
|
-
top: 60,
|
9
|
-
right:
|
10
|
-
bottom: 60,
|
11
|
-
left: 60
|
12
|
-
},
|
13
|
-
}
|
1
|
+
import type { ChartParamsFile } from '../types'
|
2
|
+
|
3
|
+
export const CP_RIGHT_PADDING: ChartParamsFile = {
|
4
|
+
id: 'CP_RIGHT_PADDING',
|
5
|
+
description: '間距右邊留空',
|
6
|
+
data: {
|
7
|
+
padding: {
|
8
|
+
top: 60,
|
9
|
+
right: 120,
|
10
|
+
bottom: 60,
|
11
|
+
left: 60
|
12
|
+
},
|
13
|
+
}
|
14
14
|
}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import type { ChartParamsFile } from '../types'
|
2
|
+
|
3
|
+
export const CP_TOP_AND_NO_BOTTOM_PADDING: ChartParamsFile = {
|
4
|
+
id: 'CP_TOP_AND_NO_BOTTOM_PADDING',
|
5
|
+
description: '間距上面留空下面不留空',
|
6
|
+
data: {
|
7
|
+
padding: {
|
8
|
+
top: 140,
|
9
|
+
right: 120,
|
10
|
+
bottom: 0,
|
11
|
+
left: 60
|
12
|
+
},
|
13
|
+
}
|
14
|
+
}
|
@@ -1,5 +1,10 @@
|
|
1
|
-
export {
|
2
|
-
export {
|
3
|
-
export {
|
4
|
-
export {
|
1
|
+
export { CP_BOTTOM_AND_LEFT_PADDING_WITH_SERIES_HIGHLIGHT } from './CP_BOTTOM_AND_LEFT_PADDING_WITH_SERIES_HIGHLIGHT'
|
2
|
+
export { CP_BOTTOM_AND_LEFT_PADDING } from './CP_BOTTOM_AND_LEFT_PADDING'
|
3
|
+
export { CP_BOTTOM_LONG_PADDING } from './CP_BOTTOM_LONG_PADDING'
|
4
|
+
export { CP_BOTTOM_LONG_PADDING_WITH_SERIES_HIGHLIGHT } from './CP_BOTTOM_LONG_PADDING_WITH_SERIES_HIGHLIGHT'
|
5
|
+
export { CP_BOTTOM_PADDING_WITH_GROUP_HIGHLIGHT } from './CP_BOTTOM_PADDING_WITH_GROUP_HIGHLIGHT'
|
6
|
+
export { CP_BOTTOM_PADDING_WITH_SERIES_HIGHLIGHT } from './CP_BOTTOM_PADDING_WITH_SERIES_HIGHLIGHT'
|
7
|
+
export { CP_BOTTOM_PADDING } from './CP_BOTTOM_PADDING'
|
8
|
+
export { CP_LEFT_PADDING } from './CP_LEFT_PADDING'
|
9
|
+
export { CP_TOP_AND_NO_BOTTOM_PADDING } from './CP_TOP_AND_NO_BOTTOM_PADDING'
|
5
10
|
export { CP_RIGHT_PADDING } from './CP_RIGHT_PADDING'
|
package/src/createPreset.ts
CHANGED
@@ -1,88 +1,88 @@
|
|
1
|
-
import type { PresetPartial, ChartType, ChartParamsPartial, DataFormatterPartialTypeMap } from '@orbcharts/core'
|
2
|
-
import type { ChartParamsFile, DataFormatterFile, PluginParamsFile, PresetFile } from './types'
|
3
|
-
import * as chartParamsFiles from './chartParamsFiles'
|
4
|
-
import * as seriesDataFormatterFiles from './seriesDataFormatterFiles'
|
5
|
-
import * as seriesPluginParamsFiles from './seriesPluginParamsFiles'
|
6
|
-
import * as gridDataFormatterFiles from './gridDataFormatterFiles'
|
7
|
-
import * as gridPluginParamsFiles from './gridPluginParamsFiles'
|
8
|
-
import * as multiGridDataFormatterFiles from './multiGridDataFormatterFiles'
|
9
|
-
import * as multiGridPluginParamsFiles from './multiGridPluginParamsFiles'
|
10
|
-
import * as multiValueDataFormatterFiles from './multiValueDataFormatterFiles'
|
11
|
-
import * as multiValuePluginParamsFiles from './multiValuePluginParamsFiles'
|
12
|
-
import * as relationshipDataFormatterFiles from './relationshipDataFormatterFiles'
|
13
|
-
import * as relationshipPluginParamsFiles from './relationshipPluginParamsFiles'
|
14
|
-
import * as treeDataFormatterFiles from './treeDataFormatterFiles'
|
15
|
-
import * as treePluginParamsFiles from './treePluginParamsFiles'
|
16
|
-
|
17
|
-
const dataFormatterFilesTypeMap = {
|
18
|
-
series: seriesDataFormatterFiles,
|
19
|
-
grid: gridDataFormatterFiles,
|
20
|
-
multiGrid: multiGridDataFormatterFiles,
|
21
|
-
multiValue: multiValueDataFormatterFiles,
|
22
|
-
relationship: relationshipDataFormatterFiles,
|
23
|
-
tree: treeDataFormatterFiles
|
24
|
-
}
|
25
|
-
|
26
|
-
const pluginParamsFilesTypeMap = {
|
27
|
-
series: seriesPluginParamsFiles,
|
28
|
-
grid: gridPluginParamsFiles,
|
29
|
-
multiGrid: multiGridPluginParamsFiles,
|
30
|
-
multiValue: multiValuePluginParamsFiles,
|
31
|
-
relationship: relationshipPluginParamsFiles,
|
32
|
-
tree: treePluginParamsFiles
|
33
|
-
}
|
34
|
-
|
35
|
-
const createBasePreset = <T extends ChartType>(chartType: T, presetFile: PresetFile<T>): PresetPartial<T> => {
|
36
|
-
const chartParams: ChartParamsPartial | undefined = presetFile.chartParamsId
|
37
|
-
? chartParamsFiles[presetFile.chartParamsId].data
|
38
|
-
: undefined
|
39
|
-
// @ts-ignore
|
40
|
-
const dataFormatter: DataFormatterPartialTypeMap<T> | undefined = dataFormatterFilesTypeMap[chartType][presetFile.dataFormatterId]
|
41
|
-
// @ts-ignore
|
42
|
-
? dataFormatterFilesTypeMap[chartType][presetFile.dataFormatterId].data
|
43
|
-
: undefined
|
44
|
-
|
45
|
-
const allPluginParams: {[key: string]: any} | undefined = presetFile.allPluginParamsIds
|
46
|
-
? presetFile.allPluginParamsIds
|
47
|
-
.reduce((prev, current) => {
|
48
|
-
// @ts-ignore
|
49
|
-
if (pluginParamsFilesTypeMap[chartType][current]) {
|
50
|
-
// @ts-ignore
|
51
|
-
const pluginName = pluginParamsFilesTypeMap[chartType][current].pluginName
|
52
|
-
// @ts-ignore
|
53
|
-
prev[pluginName] = pluginParamsFilesTypeMap[chartType][current].data
|
54
|
-
}
|
55
|
-
return prev
|
56
|
-
}, {})
|
57
|
-
: undefined
|
58
|
-
|
59
|
-
return {
|
60
|
-
chartParams,
|
61
|
-
dataFormatter,
|
62
|
-
allPluginParams
|
63
|
-
}
|
64
|
-
}
|
65
|
-
|
66
|
-
export const createSeriesPreset = (presetFile: PresetFile<'series'>): PresetPartial<'series'> => {
|
67
|
-
return createBasePreset('series', presetFile)
|
68
|
-
}
|
69
|
-
|
70
|
-
export const createGridPreset = (presetFile: PresetFile<'grid'>): PresetPartial<'grid'> => {
|
71
|
-
return createBasePreset('grid', presetFile)
|
72
|
-
}
|
73
|
-
|
74
|
-
export const createMultiGridPreset = (presetFile: PresetFile<'multiGrid'>): PresetPartial<'multiGrid'> => {
|
75
|
-
return createBasePreset('multiGrid', presetFile)
|
76
|
-
}
|
77
|
-
|
78
|
-
export const createMultiValuePreset = (presetFile: PresetFile<'multiValue'>): PresetPartial<'multiValue'> => {
|
79
|
-
return createBasePreset('multiValue', presetFile)
|
80
|
-
}
|
81
|
-
|
82
|
-
export const createRelationshipPreset = (presetFile: PresetFile<'relationship'>): PresetPartial<'relationship'> => {
|
83
|
-
return createBasePreset('relationship', presetFile)
|
84
|
-
}
|
85
|
-
|
86
|
-
export const createTreePreset = (presetFile: PresetFile<'tree'>): PresetPartial<'tree'> => {
|
87
|
-
return createBasePreset('tree', presetFile)
|
1
|
+
import type { PresetPartial, ChartType, ChartParamsPartial, DataFormatterPartialTypeMap } from '@orbcharts/core'
|
2
|
+
import type { ChartParamsFile, DataFormatterFile, PluginParamsFile, PresetFile } from './types'
|
3
|
+
import * as chartParamsFiles from './chartParamsFiles'
|
4
|
+
import * as seriesDataFormatterFiles from './seriesDataFormatterFiles'
|
5
|
+
import * as seriesPluginParamsFiles from './seriesPluginParamsFiles'
|
6
|
+
import * as gridDataFormatterFiles from './gridDataFormatterFiles'
|
7
|
+
import * as gridPluginParamsFiles from './gridPluginParamsFiles'
|
8
|
+
import * as multiGridDataFormatterFiles from './multiGridDataFormatterFiles'
|
9
|
+
import * as multiGridPluginParamsFiles from './multiGridPluginParamsFiles'
|
10
|
+
import * as multiValueDataFormatterFiles from './multiValueDataFormatterFiles'
|
11
|
+
import * as multiValuePluginParamsFiles from './multiValuePluginParamsFiles'
|
12
|
+
import * as relationshipDataFormatterFiles from './relationshipDataFormatterFiles'
|
13
|
+
import * as relationshipPluginParamsFiles from './relationshipPluginParamsFiles'
|
14
|
+
import * as treeDataFormatterFiles from './treeDataFormatterFiles'
|
15
|
+
import * as treePluginParamsFiles from './treePluginParamsFiles'
|
16
|
+
|
17
|
+
const dataFormatterFilesTypeMap = {
|
18
|
+
series: seriesDataFormatterFiles,
|
19
|
+
grid: gridDataFormatterFiles,
|
20
|
+
multiGrid: multiGridDataFormatterFiles,
|
21
|
+
multiValue: multiValueDataFormatterFiles,
|
22
|
+
relationship: relationshipDataFormatterFiles,
|
23
|
+
tree: treeDataFormatterFiles
|
24
|
+
}
|
25
|
+
|
26
|
+
const pluginParamsFilesTypeMap = {
|
27
|
+
series: seriesPluginParamsFiles,
|
28
|
+
grid: gridPluginParamsFiles,
|
29
|
+
multiGrid: multiGridPluginParamsFiles,
|
30
|
+
multiValue: multiValuePluginParamsFiles,
|
31
|
+
relationship: relationshipPluginParamsFiles,
|
32
|
+
tree: treePluginParamsFiles
|
33
|
+
}
|
34
|
+
|
35
|
+
const createBasePreset = <T extends ChartType>(chartType: T, presetFile: PresetFile<T>): PresetPartial<T> => {
|
36
|
+
const chartParams: ChartParamsPartial | undefined = presetFile.chartParamsId
|
37
|
+
? chartParamsFiles[presetFile.chartParamsId].data
|
38
|
+
: undefined
|
39
|
+
// @ts-ignore
|
40
|
+
const dataFormatter: DataFormatterPartialTypeMap<T> | undefined = dataFormatterFilesTypeMap[chartType][presetFile.dataFormatterId]
|
41
|
+
// @ts-ignore
|
42
|
+
? dataFormatterFilesTypeMap[chartType][presetFile.dataFormatterId].data
|
43
|
+
: undefined
|
44
|
+
|
45
|
+
const allPluginParams: {[key: string]: any} | undefined = presetFile.allPluginParamsIds
|
46
|
+
? presetFile.allPluginParamsIds
|
47
|
+
.reduce((prev, current) => {
|
48
|
+
// @ts-ignore
|
49
|
+
if (pluginParamsFilesTypeMap[chartType][current]) {
|
50
|
+
// @ts-ignore
|
51
|
+
const pluginName = pluginParamsFilesTypeMap[chartType][current].pluginName
|
52
|
+
// @ts-ignore
|
53
|
+
prev[pluginName] = pluginParamsFilesTypeMap[chartType][current].data
|
54
|
+
}
|
55
|
+
return prev
|
56
|
+
}, {})
|
57
|
+
: undefined
|
58
|
+
|
59
|
+
return {
|
60
|
+
chartParams,
|
61
|
+
dataFormatter,
|
62
|
+
allPluginParams
|
63
|
+
}
|
64
|
+
}
|
65
|
+
|
66
|
+
export const createSeriesPreset = (presetFile: PresetFile<'series'>): PresetPartial<'series'> => {
|
67
|
+
return createBasePreset('series', presetFile)
|
68
|
+
}
|
69
|
+
|
70
|
+
export const createGridPreset = (presetFile: PresetFile<'grid'>): PresetPartial<'grid'> => {
|
71
|
+
return createBasePreset('grid', presetFile)
|
72
|
+
}
|
73
|
+
|
74
|
+
export const createMultiGridPreset = (presetFile: PresetFile<'multiGrid'>): PresetPartial<'multiGrid'> => {
|
75
|
+
return createBasePreset('multiGrid', presetFile)
|
76
|
+
}
|
77
|
+
|
78
|
+
export const createMultiValuePreset = (presetFile: PresetFile<'multiValue'>): PresetPartial<'multiValue'> => {
|
79
|
+
return createBasePreset('multiValue', presetFile)
|
80
|
+
}
|
81
|
+
|
82
|
+
export const createRelationshipPreset = (presetFile: PresetFile<'relationship'>): PresetPartial<'relationship'> => {
|
83
|
+
return createBasePreset('relationship', presetFile)
|
84
|
+
}
|
85
|
+
|
86
|
+
export const createTreePreset = (presetFile: PresetFile<'tree'>): PresetPartial<'tree'> => {
|
87
|
+
return createBasePreset('tree', presetFile)
|
88
88
|
}
|
@@ -1,16 +1,16 @@
|
|
1
|
-
import type { DataFormatterFile } from '../types'
|
2
|
-
import type { BarsParams } from '@orbcharts/plugins-basic'
|
3
|
-
|
4
|
-
export const DF_BOTTOM_VALUE_AXIS: DataFormatterFile<'grid'> = {
|
5
|
-
id: 'DF_BOTTOM_VALUE_AXIS',
|
6
|
-
chartType: 'grid',
|
7
|
-
description: '底部橫向資料圖軸',
|
8
|
-
data: {
|
9
|
-
valueAxis: {
|
10
|
-
position: 'bottom'
|
11
|
-
},
|
12
|
-
groupAxis: {
|
13
|
-
position: 'left'
|
14
|
-
},
|
15
|
-
}
|
1
|
+
import type { DataFormatterFile } from '../types'
|
2
|
+
import type { BarsParams } from '@orbcharts/plugins-basic'
|
3
|
+
|
4
|
+
export const DF_BOTTOM_VALUE_AXIS: DataFormatterFile<'grid'> = {
|
5
|
+
id: 'DF_BOTTOM_VALUE_AXIS',
|
6
|
+
chartType: 'grid',
|
7
|
+
description: '底部橫向資料圖軸',
|
8
|
+
data: {
|
9
|
+
valueAxis: {
|
10
|
+
position: 'bottom'
|
11
|
+
},
|
12
|
+
groupAxis: {
|
13
|
+
position: 'left'
|
14
|
+
},
|
15
|
+
}
|
16
16
|
}
|
@@ -1,15 +1,15 @@
|
|
1
|
-
import type { PluginParamsFile } from '../../types'
|
2
|
-
import type { BarsParams } from '@orbcharts/plugins-basic'
|
3
|
-
|
4
|
-
export const PP_BARS_ROUND: PluginParamsFile<BarsParams> = {
|
5
|
-
id: 'PP_BARS_ROUND',
|
6
|
-
chartType: 'grid',
|
7
|
-
pluginName: 'Bars',
|
8
|
-
description: '圓角長條圖',
|
9
|
-
data: {
|
10
|
-
barWidth: 0,
|
11
|
-
barPadding: 1,
|
12
|
-
barGroupPadding: 10,
|
13
|
-
barRadius: true,
|
14
|
-
}
|
1
|
+
import type { PluginParamsFile } from '../../types'
|
2
|
+
import type { BarsParams } from '@orbcharts/plugins-basic'
|
3
|
+
|
4
|
+
export const PP_BARS_ROUND: PluginParamsFile<BarsParams> = {
|
5
|
+
id: 'PP_BARS_ROUND',
|
6
|
+
chartType: 'grid',
|
7
|
+
pluginName: 'Bars',
|
8
|
+
description: '圓角長條圖',
|
9
|
+
data: {
|
10
|
+
barWidth: 0,
|
11
|
+
barPadding: 1,
|
12
|
+
barGroupPadding: 10,
|
13
|
+
barRadius: true,
|
14
|
+
}
|
15
15
|
}
|
@@ -1,14 +1,14 @@
|
|
1
|
-
import type { PluginParamsFile } from '../../types'
|
2
|
-
import type { BarsParams } from '@orbcharts/plugins-basic'
|
3
|
-
|
4
|
-
export const PP_BARS_THIN: PluginParamsFile<BarsParams> = {
|
5
|
-
id: 'PP_BARS_THIN',
|
6
|
-
chartType: 'grid',
|
7
|
-
pluginName: 'Bars',
|
8
|
-
description: '圓角長條圖',
|
9
|
-
data: {
|
10
|
-
barWidth: 20,
|
11
|
-
barPadding: 1,
|
12
|
-
barGroupPadding: 10
|
13
|
-
}
|
14
|
-
}
|
1
|
+
import type { PluginParamsFile } from '../../types'
|
2
|
+
import type { BarsParams } from '@orbcharts/plugins-basic'
|
3
|
+
|
4
|
+
export const PP_BARS_THIN: PluginParamsFile<BarsParams> = {
|
5
|
+
id: 'PP_BARS_THIN',
|
6
|
+
chartType: 'grid',
|
7
|
+
pluginName: 'Bars',
|
8
|
+
description: '圓角長條圖',
|
9
|
+
data: {
|
10
|
+
barWidth: 20,
|
11
|
+
barPadding: 1,
|
12
|
+
barGroupPadding: 10
|
13
|
+
}
|
14
|
+
}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
export { PP_BARS_ROUND } from './PP_BARS_ROUND'
|
1
|
+
export { PP_BARS_ROUND } from './PP_BARS_ROUND'
|
2
2
|
export { PP_BARS_THIN } from './PP_BARS_THIN'
|
@@ -1,14 +1,12 @@
|
|
1
|
-
import type { PluginParamsFile } from '../../types'
|
2
|
-
import type { DotsParams } from '@orbcharts/plugins-basic'
|
3
|
-
|
4
|
-
export const PP_DOTS_ONLY_SHOW_HIGHLIGHTED: PluginParamsFile<DotsParams> = {
|
5
|
-
id: 'PP_DOTS_ONLY_SHOW_HIGHLIGHTED',
|
6
|
-
chartType: 'grid',
|
7
|
-
pluginName: 'Dots',
|
8
|
-
description: '顯示highlight圓點',
|
9
|
-
data: {
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
}
|
14
|
-
}
|
1
|
+
import type { PluginParamsFile } from '../../types'
|
2
|
+
import type { DotsParams } from '@orbcharts/plugins-basic'
|
3
|
+
|
4
|
+
export const PP_DOTS_ONLY_SHOW_HIGHLIGHTED: PluginParamsFile<DotsParams> = {
|
5
|
+
id: 'PP_DOTS_ONLY_SHOW_HIGHLIGHTED',
|
6
|
+
chartType: 'grid',
|
7
|
+
pluginName: 'Dots',
|
8
|
+
description: '顯示highlight圓點',
|
9
|
+
data: {
|
10
|
+
onlyShowHighlighted: false
|
11
|
+
}
|
12
|
+
}
|