@publishfx/publish-chart 2.1.25 → 2.1.26
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/components/g2/base/G2BarChart.js +0 -1
- package/dist/components/g2/base/G2CombineChart.js +0 -1
- package/dist/components/g2/base/G2LineChart.js +0 -1
- package/dist/components/g2/base/g2combine.js +2 -2
- package/dist/core/ChartConfig.d.ts +16 -10
- package/dist/core/ChartConfig.js +67 -66
- package/package.json +1 -1
|
@@ -5,7 +5,7 @@ const Y_AXIS_FIELD = 'groupValue';
|
|
|
5
5
|
const BAR_Y_FIELD = 'barValue';
|
|
6
6
|
const LINE_Y_FIELD = 'lineValue';
|
|
7
7
|
function renderG2CombineChart(container, options) {
|
|
8
|
-
const { data, nodeData, x, z: _z, maxLeft, maxRight, themeColors, indicatorMap: _indicatorMap, formatAxis, formatLineAxis, isDataTag = true, isCombineDataTag = true,
|
|
8
|
+
const { data, nodeData, x, z: _z, maxLeft, maxRight, themeColors, indicatorMap: _indicatorMap, formatAxis, formatLineAxis, isDataTag = true, isCombineDataTag = true, isCompare = false, formatLabel, highlightDate = [], isHighlight = true, isClickable = false, indicators = [], tooltipRender, auxiliaryLineData = [], onNodeListChange, lineColors, onChartRender, isGroup, legendItems = [], indicatorId } = options;
|
|
9
9
|
const chart = createChart({
|
|
10
10
|
container,
|
|
11
11
|
autoFit: true
|
|
@@ -17,7 +17,7 @@ function renderG2CombineChart(container, options) {
|
|
|
17
17
|
animate: null
|
|
18
18
|
});
|
|
19
19
|
const view = getMainView(chart);
|
|
20
|
-
view.attr('marginLeft', 0).attr('marginRight', 30).attr('marginTop',
|
|
20
|
+
view.attr('marginLeft', 0).attr('marginRight', 30).attr('marginTop', 16).attr('marginBottom', 0).animate(false);
|
|
21
21
|
view.data(data);
|
|
22
22
|
const xValueCount = new Set(data.map((d)=>d[x])).size;
|
|
23
23
|
applyAxisX(view, {
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
export declare const nodeMap: Map<number, {
|
|
2
|
+
des: string;
|
|
3
|
+
color: string;
|
|
4
|
+
bgc: string;
|
|
5
|
+
}>;
|
|
6
|
+
export declare const nodeTextMap: Map<string, {
|
|
7
|
+
type: number;
|
|
8
|
+
color: string;
|
|
9
|
+
bgc: string;
|
|
10
|
+
}>;
|
|
1
11
|
/**
|
|
2
12
|
* 图表配置接口
|
|
3
13
|
*/
|
|
@@ -23,6 +33,12 @@ export interface ChartConfig {
|
|
|
23
33
|
barPaddingRight?: number;
|
|
24
34
|
horBarPaddingRight?: number;
|
|
25
35
|
};
|
|
36
|
+
/** 节点映射表 */
|
|
37
|
+
nodeMap?: Map<number, {
|
|
38
|
+
des: string;
|
|
39
|
+
color: string;
|
|
40
|
+
bgc: string;
|
|
41
|
+
}>;
|
|
26
42
|
}
|
|
27
43
|
/**
|
|
28
44
|
* 默认图表配置
|
|
@@ -36,13 +52,3 @@ export declare const getThemeColors: () => string[];
|
|
|
36
52
|
* 合并配置
|
|
37
53
|
*/
|
|
38
54
|
export declare const mergeChartConfig: (defaultConfig: ChartConfig, userConfig: Partial<ChartConfig>) => ChartConfig;
|
|
39
|
-
export declare const nodeMap: Map<number, {
|
|
40
|
-
des: string;
|
|
41
|
-
color: string;
|
|
42
|
-
bgc: string;
|
|
43
|
-
}>;
|
|
44
|
-
export declare const nodeTextMap: Map<string, {
|
|
45
|
-
type: number;
|
|
46
|
-
color: string;
|
|
47
|
-
bgc: string;
|
|
48
|
-
}>;
|
package/dist/core/ChartConfig.js
CHANGED
|
@@ -1,70 +1,4 @@
|
|
|
1
1
|
import { getTheme } from "bizcharts";
|
|
2
|
-
const defaultChartConfig = {
|
|
3
|
-
baseChartConfig: {
|
|
4
|
-
appendPadding: [
|
|
5
|
-
20,
|
|
6
|
-
0,
|
|
7
|
-
10,
|
|
8
|
-
0
|
|
9
|
-
],
|
|
10
|
-
padding: 'auto',
|
|
11
|
-
autoFit: true,
|
|
12
|
-
limitInPlot: false,
|
|
13
|
-
forceUpdate: false,
|
|
14
|
-
animate: {
|
|
15
|
-
leave: false
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
theme: {
|
|
19
|
-
colors: [
|
|
20
|
-
'#5B8FF9',
|
|
21
|
-
'#5AD8A6',
|
|
22
|
-
'#5D7092',
|
|
23
|
-
'#F6BD16',
|
|
24
|
-
'#6F5EF9',
|
|
25
|
-
'#6DC8EC',
|
|
26
|
-
'#945FB9',
|
|
27
|
-
'#FF9845',
|
|
28
|
-
'#1E9493',
|
|
29
|
-
'#FF99C3',
|
|
30
|
-
'#8CD85A',
|
|
31
|
-
'#FE765E',
|
|
32
|
-
'#67A1FF',
|
|
33
|
-
'#D85ACB',
|
|
34
|
-
'#F95B8F'
|
|
35
|
-
],
|
|
36
|
-
combineColors: [
|
|
37
|
-
'#FF8C00',
|
|
38
|
-
'#FFD700'
|
|
39
|
-
]
|
|
40
|
-
},
|
|
41
|
-
layout: {
|
|
42
|
-
barPaddingRight: 10,
|
|
43
|
-
horBarPaddingRight: 50
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
const getThemeColors = ()=>{
|
|
47
|
-
try {
|
|
48
|
-
const theme = getTheme();
|
|
49
|
-
return theme.colors10 || defaultChartConfig.theme.colors;
|
|
50
|
-
} catch {
|
|
51
|
-
return defaultChartConfig.theme.colors;
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
const mergeChartConfig = (defaultConfig, userConfig)=>({
|
|
55
|
-
baseChartConfig: {
|
|
56
|
-
...defaultConfig.baseChartConfig,
|
|
57
|
-
...userConfig.baseChartConfig
|
|
58
|
-
},
|
|
59
|
-
theme: {
|
|
60
|
-
...defaultConfig.theme,
|
|
61
|
-
...userConfig.theme
|
|
62
|
-
},
|
|
63
|
-
layout: {
|
|
64
|
-
...defaultConfig.layout,
|
|
65
|
-
...userConfig.layout
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
2
|
const nodeMap = new Map([
|
|
69
3
|
[
|
|
70
4
|
1,
|
|
@@ -149,4 +83,71 @@ const nodeTextMap = new Map([
|
|
|
149
83
|
}
|
|
150
84
|
]
|
|
151
85
|
]);
|
|
86
|
+
const defaultChartConfig = {
|
|
87
|
+
baseChartConfig: {
|
|
88
|
+
appendPadding: [
|
|
89
|
+
20,
|
|
90
|
+
0,
|
|
91
|
+
10,
|
|
92
|
+
0
|
|
93
|
+
],
|
|
94
|
+
padding: 'auto',
|
|
95
|
+
autoFit: true,
|
|
96
|
+
limitInPlot: false,
|
|
97
|
+
forceUpdate: false,
|
|
98
|
+
animate: {
|
|
99
|
+
leave: false
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
theme: {
|
|
103
|
+
colors: [
|
|
104
|
+
'#5B8FF9',
|
|
105
|
+
'#5AD8A6',
|
|
106
|
+
'#5D7092',
|
|
107
|
+
'#F6BD16',
|
|
108
|
+
'#6F5EF9',
|
|
109
|
+
'#6DC8EC',
|
|
110
|
+
'#945FB9',
|
|
111
|
+
'#FF9845',
|
|
112
|
+
'#1E9493',
|
|
113
|
+
'#FF99C3',
|
|
114
|
+
'#8CD85A',
|
|
115
|
+
'#FE765E',
|
|
116
|
+
'#67A1FF',
|
|
117
|
+
'#D85ACB',
|
|
118
|
+
'#F95B8F'
|
|
119
|
+
],
|
|
120
|
+
combineColors: [
|
|
121
|
+
'#FF8C00',
|
|
122
|
+
'#FFD700'
|
|
123
|
+
]
|
|
124
|
+
},
|
|
125
|
+
layout: {
|
|
126
|
+
barPaddingRight: 10,
|
|
127
|
+
horBarPaddingRight: 50
|
|
128
|
+
},
|
|
129
|
+
nodeMap
|
|
130
|
+
};
|
|
131
|
+
const getThemeColors = ()=>{
|
|
132
|
+
try {
|
|
133
|
+
const theme = getTheme();
|
|
134
|
+
return theme.colors10 || defaultChartConfig.theme.colors;
|
|
135
|
+
} catch {
|
|
136
|
+
return defaultChartConfig.theme.colors;
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
const mergeChartConfig = (defaultConfig, userConfig)=>({
|
|
140
|
+
baseChartConfig: {
|
|
141
|
+
...defaultConfig.baseChartConfig,
|
|
142
|
+
...userConfig.baseChartConfig
|
|
143
|
+
},
|
|
144
|
+
theme: {
|
|
145
|
+
...defaultConfig.theme,
|
|
146
|
+
...userConfig.theme
|
|
147
|
+
},
|
|
148
|
+
layout: {
|
|
149
|
+
...defaultConfig.layout,
|
|
150
|
+
...userConfig.layout
|
|
151
|
+
}
|
|
152
|
+
});
|
|
152
153
|
export { defaultChartConfig, getThemeColors, mergeChartConfig, nodeMap, nodeTextMap };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@publishfx/publish-chart",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.26",
|
|
4
4
|
"description": "A React chart component library for the Publish platform, including BarChart, LineChart, BarLineChart and other visualization components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|