@orbcharts/plugins-basic 3.0.0-alpha.54 → 3.0.0-alpha.56
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/dist/orbcharts-plugins-basic.es.js +3257 -3186
- package/dist/orbcharts-plugins-basic.umd.js +61 -8
- package/package.json +2 -2
- package/src/grid/defaults.ts +2 -0
- package/src/multiGrid/defaults.ts +1 -0
- package/src/multiGrid/plugins/OverlappingValueAxes.ts +6 -5
- package/src/multiGrid/plugins/OverlappingValueStackAxes.ts +6 -5
- package/src/noneData/defaults.ts +39 -0
- package/src/series/defaults.ts +18 -0
- package/src/tree/defaults.ts +1 -0
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@orbcharts/plugins-basic",
|
3
|
-
"version": "3.0.0-alpha.
|
3
|
+
"version": "3.0.0-alpha.56",
|
4
4
|
"description": "plugins for OrbCharts",
|
5
5
|
"author": "Blue Planet Inc.",
|
6
6
|
"license": "Apache-2.0",
|
@@ -35,7 +35,7 @@
|
|
35
35
|
"vite-plugin-dts": "^3.7.3"
|
36
36
|
},
|
37
37
|
"dependencies": {
|
38
|
-
"@orbcharts/core": "^3.0.0-alpha.
|
38
|
+
"@orbcharts/core": "^3.0.0-alpha.52",
|
39
39
|
"d3": "^7.8.5",
|
40
40
|
"rxjs": "^7.8.1"
|
41
41
|
}
|
package/src/grid/defaults.ts
CHANGED
@@ -41,6 +41,7 @@ export const DEFAULT_GROUP_AREA_PARAMS: GroupAuxParams = {
|
|
41
41
|
labelTextFormat: text => text,
|
42
42
|
labelPadding: 24,
|
43
43
|
}
|
44
|
+
DEFAULT_GROUP_AREA_PARAMS.labelTextFormat.toString = () => `text => text`
|
44
45
|
|
45
46
|
export const DEFAULT_BARS_PARAMS: BarsParams = {
|
46
47
|
// barType: 'rect',
|
@@ -83,6 +84,7 @@ export const DEFAULT_GROUP_AXIS_PARAMS: GroupAxisParams = {
|
|
83
84
|
tickTextRotate: 0,
|
84
85
|
tickTextColorType: 'primary',
|
85
86
|
}
|
87
|
+
DEFAULT_GROUP_AXIS_PARAMS.tickFormat.toString = () => `text => text`
|
86
88
|
|
87
89
|
export const DEFAULT_VALUE_AXIS_PARAMS: ValueAxisParams = {
|
88
90
|
// labelAnchor: 'end',
|
@@ -50,6 +50,7 @@ export const DEFAULT_MULTI_GROUP_AXIS_PARAMS: MultiGroupAxisParams = {
|
|
50
50
|
tickTextColorType: 'primary',
|
51
51
|
gridIndexes: [0]
|
52
52
|
}
|
53
|
+
DEFAULT_MULTI_GROUP_AXIS_PARAMS.tickFormat.toString = () => `text => text`
|
53
54
|
|
54
55
|
export const DEFAULT_MULTI_VALUE_AXIS_PARAMS: MultiValueAxisParams = {
|
55
56
|
// labelAnchor: 'end',
|
@@ -50,15 +50,16 @@ export const OverlappingValueAxes = defineMultiGridPlugin(pluginName, DEFAULT_OV
|
|
50
50
|
if (!data.fullDataFormatter.gridList[data.secondGridIndex]) {
|
51
51
|
data.fullDataFormatter.gridList[data.secondGridIndex] = Object.assign({}, data.fullDataFormatter.gridList[data.firstGridIndex])
|
52
52
|
}
|
53
|
+
const position = data.fullDataFormatter.gridList[data.firstGridIndex].valueAxis.position
|
53
54
|
// 反轉第二個valueAxis的位置
|
54
|
-
let reversePosition =
|
55
|
-
if (
|
55
|
+
let reversePosition = position
|
56
|
+
if (position === 'left') {
|
56
57
|
reversePosition = 'right'
|
57
|
-
} else if (
|
58
|
+
} else if (position === 'bottom') {
|
58
59
|
reversePosition = 'top'
|
59
|
-
} else if (
|
60
|
+
} else if (position === 'top') {
|
60
61
|
reversePosition = 'bottom'
|
61
|
-
} else if (
|
62
|
+
} else if (position === 'right') {
|
62
63
|
reversePosition = 'left'
|
63
64
|
}
|
64
65
|
return <DataFormatterGrid>{
|
@@ -51,15 +51,16 @@ export const OverlappingValueStackAxes = defineMultiGridPlugin(pluginName, DEFAU
|
|
51
51
|
if (!data.fullDataFormatter.gridList[data.secondGridIndex]) {
|
52
52
|
data.fullDataFormatter.gridList[data.secondGridIndex] = Object.assign({}, data.fullDataFormatter.gridList[data.firstGridIndex])
|
53
53
|
}
|
54
|
+
const position = data.fullDataFormatter.gridList[data.firstGridIndex].valueAxis.position
|
54
55
|
// 反轉第二個valueAxis的位置
|
55
|
-
let reversePosition =
|
56
|
-
if (
|
56
|
+
let reversePosition = position
|
57
|
+
if (position === 'left') {
|
57
58
|
reversePosition = 'right'
|
58
|
-
} else if (
|
59
|
+
} else if (position === 'bottom') {
|
59
60
|
reversePosition = 'top'
|
60
|
-
} else if (
|
61
|
+
} else if (position === 'top') {
|
61
62
|
reversePosition = 'bottom'
|
62
|
-
} else if (
|
63
|
+
} else if (position === 'right') {
|
63
64
|
reversePosition = 'left'
|
64
65
|
}
|
65
66
|
return <DataFormatterGrid>{
|
package/src/noneData/defaults.ts
CHANGED
@@ -62,3 +62,42 @@ export const TOOLTIP_PARAMS: TooltipParams = {
|
|
62
62
|
},
|
63
63
|
svgRenderFn: null
|
64
64
|
}
|
65
|
+
TOOLTIP_PARAMS.textRenderFn.toString = () => `(eventData) => {
|
66
|
+
if (eventData.highlightTarget === 'datum' && eventData.datum) {
|
67
|
+
return [\`\${eventData.datum.label}: \${eventData.datum.value}\`]
|
68
|
+
} else if (eventData.highlightTarget === 'series') {
|
69
|
+
const label = (eventData as EventBaseSeriesValue<any, any>).seriesLabel
|
70
|
+
const valueArr = (eventData as EventBaseSeriesValue<any, any>).series
|
71
|
+
.filter(d => d.visible == true)
|
72
|
+
.map(d => {
|
73
|
+
return d.value
|
74
|
+
})
|
75
|
+
const value = valueArr.length > 5
|
76
|
+
? valueArr.slice(0, 5).join(',') + '...'
|
77
|
+
: valueArr.join(',')
|
78
|
+
return [label, value]
|
79
|
+
} else if (eventData.highlightTarget === 'group') {
|
80
|
+
const label = (eventData as EventBaseGridValue<any, any>).groupLabel
|
81
|
+
const valueArr = (eventData as EventBaseGridValue<any, any>).series
|
82
|
+
.filter(d => d.visible == true)
|
83
|
+
.map(d => {
|
84
|
+
return d.value
|
85
|
+
})
|
86
|
+
const value = valueArr.length > 5
|
87
|
+
? valueArr.slice(0, 5).join(',') + '...'
|
88
|
+
: valueArr.join(',')
|
89
|
+
return [label, value]
|
90
|
+
} else if (eventData.highlightTarget === 'category') {
|
91
|
+
const label = (eventData as EventBaseCategoryValue<any, any>).categoryLabel
|
92
|
+
const valueArr = (eventData as EventBaseCategoryValue<any, any>).category
|
93
|
+
.filter(d => d.visible == true)
|
94
|
+
.map(d => {
|
95
|
+
return d.value
|
96
|
+
})
|
97
|
+
const value = valueArr.length > 5
|
98
|
+
? valueArr.slice(0, 5).join(',') + '...'
|
99
|
+
: valueArr.join(',')
|
100
|
+
return [label, value]
|
101
|
+
}
|
102
|
+
return []
|
103
|
+
}`
|
package/src/series/defaults.ts
CHANGED
@@ -79,6 +79,22 @@ export const DEFAULT_PIE_EVENT_TEXTS_PARAMS: PieEventTextsParams = {
|
|
79
79
|
}
|
80
80
|
]
|
81
81
|
}
|
82
|
+
DEFAULT_PIE_EVENT_TEXTS_PARAMS.eventFn.toString = () => `(eventData: EventSeries, eventName: EventName, t: number) => {
|
83
|
+
if (eventName === 'mouseover' || eventName === 'mousemove') {
|
84
|
+
return [String(eventData.datum!.value)]
|
85
|
+
}
|
86
|
+
return [
|
87
|
+
String(
|
88
|
+
Math.round(
|
89
|
+
eventData.data.reduce((acc, seriesData) => {
|
90
|
+
return acc + seriesData.reduce((_acc, data) => {
|
91
|
+
return _acc + (data.value ?? 0)
|
92
|
+
}, 0)
|
93
|
+
}, 0) * t
|
94
|
+
)
|
95
|
+
)
|
96
|
+
]
|
97
|
+
}`
|
82
98
|
|
83
99
|
export const DEFAULT_PIE_LABELS_PARAMS: PieLabelsParams = {
|
84
100
|
// solidColor: undefined,
|
@@ -94,6 +110,7 @@ export const DEFAULT_PIE_LABELS_PARAMS: PieLabelsParams = {
|
|
94
110
|
labelColorType: 'primary',
|
95
111
|
labelFn: d => String(d.label),
|
96
112
|
}
|
113
|
+
DEFAULT_PIE_LABELS_PARAMS.labelFn.toString = () => `d => String(d.label)`
|
97
114
|
|
98
115
|
export const DEFAULT_ROSE_PARAMS: RoseParams = {
|
99
116
|
outerRadius: 0.95,
|
@@ -109,6 +126,7 @@ export const DEFAULT_ROSE_LABELS_PARAMS: RoseLabelsParams = {
|
|
109
126
|
labelColorType: 'primary',
|
110
127
|
arcScaleType: 'area'
|
111
128
|
}
|
129
|
+
DEFAULT_ROSE_LABELS_PARAMS.labelFn.toString = () => `d => String(d.label)`
|
112
130
|
|
113
131
|
export const DEFAULT_SERIES_LEGEND_PARAMS: SeriesLegendParams = {
|
114
132
|
position: 'right',
|
package/src/tree/defaults.ts
CHANGED
@@ -7,6 +7,7 @@ export const DEFAULT_TREE_MAP_PARAMS: TreeMapParams = {
|
|
7
7
|
squarifyRatio: 1.618034, // 黃金比例
|
8
8
|
sort: (a, b) => b.value - a.value
|
9
9
|
}
|
10
|
+
DEFAULT_TREE_MAP_PARAMS.sort.toString = () => `(a, b) => b.value - a.value`
|
10
11
|
|
11
12
|
export const DEFAULT_TREE_LEGEND_PARAMS: TreeLegendParams = {
|
12
13
|
position: 'right',
|