hfn-components 0.2.8 → 0.3.0

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.
@@ -51,6 +51,10 @@ export declare const HtChart: import("hfn-components/es/utils").SFCWithInstall<i
51
51
  readonly type: BooleanConstructor;
52
52
  readonly default: true;
53
53
  };
54
+ readonly auxiliaryData: {
55
+ readonly type: ObjectConstructor;
56
+ readonly default: null;
57
+ };
54
58
  readonly downLoadAutn: {
55
59
  readonly type: BooleanConstructor;
56
60
  readonly default: false;
@@ -74,6 +78,7 @@ export declare const HtChart: import("hfn-components/es/utils").SFCWithInstall<i
74
78
  readonly tooltipUnit: string;
75
79
  readonly watchResize: boolean;
76
80
  readonly showLegend: boolean;
81
+ readonly auxiliaryData: Record<string, any>;
77
82
  readonly downLoadAutn: boolean;
78
83
  readonly lineColor: string[];
79
84
  } & {}>;
@@ -142,6 +147,10 @@ export declare const HtChart: import("hfn-components/es/utils").SFCWithInstall<i
142
147
  readonly type: BooleanConstructor;
143
148
  readonly default: true;
144
149
  };
150
+ readonly auxiliaryData: {
151
+ readonly type: ObjectConstructor;
152
+ readonly default: null;
153
+ };
145
154
  readonly downLoadAutn: {
146
155
  readonly type: BooleanConstructor;
147
156
  readonly default: false;
@@ -164,6 +173,7 @@ export declare const HtChart: import("hfn-components/es/utils").SFCWithInstall<i
164
173
  readonly tooltipUnit: string;
165
174
  readonly watchResize: boolean;
166
175
  readonly showLegend: boolean;
176
+ readonly auxiliaryData: Record<string, any>;
167
177
  readonly downLoadAutn: boolean;
168
178
  readonly lineColor: string[];
169
179
  }, {}>> & Record<string, any>;
@@ -53,6 +53,10 @@ export declare const chartProps: {
53
53
  readonly type: BooleanConstructor;
54
54
  readonly default: true;
55
55
  };
56
+ readonly auxiliaryData: {
57
+ readonly type: ObjectConstructor;
58
+ readonly default: null;
59
+ };
56
60
  readonly downLoadAutn: {
57
61
  readonly type: BooleanConstructor;
58
62
  readonly default: false;
@@ -63,6 +63,11 @@ const chartProps = {
63
63
  type: Boolean,
64
64
  default: true
65
65
  },
66
+ //堆叠辅助数据
67
+ auxiliaryData: {
68
+ type: Object,
69
+ default: null
70
+ },
66
71
  //数据下载
67
72
  downLoadAutn: {
68
73
  type: Boolean,
@@ -58,6 +58,10 @@ declare const _default: import("vue").DefineComponent<{
58
58
  readonly type: BooleanConstructor;
59
59
  readonly default: true;
60
60
  };
61
+ readonly auxiliaryData: {
62
+ readonly type: ObjectConstructor;
63
+ readonly default: null;
64
+ };
61
65
  readonly downLoadAutn: {
62
66
  readonly type: BooleanConstructor;
63
67
  readonly default: false;
@@ -81,6 +85,7 @@ declare const _default: import("vue").DefineComponent<{
81
85
  readonly tooltipUnit: string;
82
86
  readonly watchResize: boolean;
83
87
  readonly showLegend: boolean;
88
+ readonly auxiliaryData: Record<string, any>;
84
89
  readonly downLoadAutn: boolean;
85
90
  readonly lineColor: string[];
86
91
  } & {}>;
@@ -149,6 +154,10 @@ declare const _default: import("vue").DefineComponent<{
149
154
  readonly type: BooleanConstructor;
150
155
  readonly default: true;
151
156
  };
157
+ readonly auxiliaryData: {
158
+ readonly type: ObjectConstructor;
159
+ readonly default: null;
160
+ };
152
161
  readonly downLoadAutn: {
153
162
  readonly type: BooleanConstructor;
154
163
  readonly default: false;
@@ -171,6 +180,7 @@ declare const _default: import("vue").DefineComponent<{
171
180
  readonly tooltipUnit: string;
172
181
  readonly watchResize: boolean;
173
182
  readonly showLegend: boolean;
183
+ readonly auxiliaryData: Record<string, any>;
174
184
  readonly downLoadAutn: boolean;
175
185
  readonly lineColor: string[];
176
186
  }, {}>;
@@ -17,6 +17,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
17
17
  watch(
18
18
  () => props.chartData,
19
19
  (val) => {
20
+ console.log(val);
20
21
  echartOptions.series = cloneDeep(val);
21
22
  drawGraph();
22
23
  },
@@ -35,7 +36,6 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
35
36
  (val) => {
36
37
  if (val && val.length > 0) {
37
38
  echartOptions.color = props.lineColor;
38
- console.log(props.lineColor);
39
39
  if (myChart.value) {
40
40
  echartInit();
41
41
  }
@@ -15,10 +15,6 @@ export declare const HtPieChart: import("hfn-components/es/utils").SFCWithInstal
15
15
  readonly type: StringConstructor;
16
16
  readonly default: "";
17
17
  };
18
- readonly customizePercentage: {
19
- readonly type: BooleanConstructor;
20
- readonly default: false;
21
- };
22
18
  readonly floatNumber: {
23
19
  readonly type: NumberConstructor;
24
20
  readonly default: 2;
@@ -44,7 +40,6 @@ export declare const HtPieChart: import("hfn-components/es/utils").SFCWithInstal
44
40
  readonly lineColor: string[];
45
41
  readonly legendData: Record<string, any>;
46
42
  readonly legendType: string;
47
- readonly customizePercentage: boolean;
48
43
  readonly legendFormatter: Function;
49
44
  } & {}>;
50
45
  myChart: import("vue").ShallowRef<any>;
@@ -72,10 +67,6 @@ export declare const HtPieChart: import("hfn-components/es/utils").SFCWithInstal
72
67
  readonly type: StringConstructor;
73
68
  readonly default: "";
74
69
  };
75
- readonly customizePercentage: {
76
- readonly type: BooleanConstructor;
77
- readonly default: false;
78
- };
79
70
  readonly floatNumber: {
80
71
  readonly type: NumberConstructor;
81
72
  readonly default: 2;
@@ -100,7 +91,6 @@ export declare const HtPieChart: import("hfn-components/es/utils").SFCWithInstal
100
91
  readonly lineColor: string[];
101
92
  readonly legendData: Record<string, any>;
102
93
  readonly legendType: string;
103
- readonly customizePercentage: boolean;
104
94
  readonly legendFormatter: Function;
105
95
  }, {}>> & Record<string, any>;
106
96
  export default HtPieChart;
@@ -16,10 +16,6 @@ export declare const pieProps: {
16
16
  readonly type: StringConstructor;
17
17
  readonly default: "";
18
18
  };
19
- readonly customizePercentage: {
20
- readonly type: BooleanConstructor;
21
- readonly default: false;
22
- };
23
19
  readonly floatNumber: {
24
20
  readonly type: NumberConstructor;
25
21
  readonly default: 2;
@@ -19,11 +19,6 @@ const pieProps = {
19
19
  type: String,
20
20
  default: ""
21
21
  },
22
- //是否自定义百分比
23
- customizePercentage: {
24
- type: Boolean,
25
- default: false
26
- },
27
22
  //保留几位小数
28
23
  floatNumber: {
29
24
  type: Number,
@@ -15,10 +15,6 @@ declare const _default: import("vue").DefineComponent<{
15
15
  readonly type: StringConstructor;
16
16
  readonly default: "";
17
17
  };
18
- readonly customizePercentage: {
19
- readonly type: BooleanConstructor;
20
- readonly default: false;
21
- };
22
18
  readonly floatNumber: {
23
19
  readonly type: NumberConstructor;
24
20
  readonly default: 2;
@@ -44,7 +40,6 @@ declare const _default: import("vue").DefineComponent<{
44
40
  readonly lineColor: string[];
45
41
  readonly legendData: Record<string, any>;
46
42
  readonly legendType: string;
47
- readonly customizePercentage: boolean;
48
43
  readonly legendFormatter: Function;
49
44
  } & {}>;
50
45
  myChart: import("vue").ShallowRef<any>;
@@ -72,10 +67,6 @@ declare const _default: import("vue").DefineComponent<{
72
67
  readonly type: StringConstructor;
73
68
  readonly default: "";
74
69
  };
75
- readonly customizePercentage: {
76
- readonly type: BooleanConstructor;
77
- readonly default: false;
78
- };
79
70
  readonly floatNumber: {
80
71
  readonly type: NumberConstructor;
81
72
  readonly default: 2;
@@ -100,7 +91,6 @@ declare const _default: import("vue").DefineComponent<{
100
91
  readonly lineColor: string[];
101
92
  readonly legendData: Record<string, any>;
102
93
  readonly legendType: string;
103
- readonly customizePercentage: boolean;
104
94
  readonly legendFormatter: Function;
105
95
  }, {}>;
106
96
  export default _default;
@@ -26,6 +26,18 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
26
26
  chartResize();
27
27
  }
28
28
  );
29
+ watch(
30
+ () => props.lineColor,
31
+ (val) => {
32
+ if (val && val.length > 0) {
33
+ echartOptions.color = props.lineColor;
34
+ if (myChart.value) {
35
+ echartInit();
36
+ }
37
+ }
38
+ },
39
+ { deep: true, immediate: true }
40
+ );
29
41
  const chartResize = () => {
30
42
  myChart.value.resize();
31
43
  };
@@ -60,7 +72,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
60
72
  let html;
61
73
  html = `<div>${params.seriesName}</div>`;
62
74
  html += `<span> ${params.name}:
63
- ${props.customizePercentage ? params.data.value : params.percent.toFixed(props.floatNumber)}%<span>`;
75
+ ${params.data.percent ? (params.data.percent * 100).toFixed(props.floatNumber) : params.percent.toFixed(props.floatNumber)}%<span>`;
64
76
  return html;
65
77
  }
66
78
  };
@@ -95,8 +95,7 @@ const BASIC_PIE_CONFIG = {
95
95
  label: {
96
96
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
97
97
  formatter: function(params) {
98
- console.log(params);
99
- const val = params.percent.toFixed(2);
98
+ const val = params.data.percent ? (params.data.percent * 100).toFixed(2) : params.percent.toFixed(2);
100
99
  return ` ${params.name}: ${val}%`;
101
100
  },
102
101
  fontWeight: "bolder",
@@ -66,6 +66,7 @@ const setEchartXAxis = (options, type, xAxisData) => {
66
66
  options.xAxis = {
67
67
  type,
68
68
  data: xAxis,
69
+ boundaryGap: false,
69
70
  axisTick: {
70
71
  alignWithLabel: true
71
72
  }
@@ -138,6 +139,11 @@ const setEchartTooltip = (options, props) => {
138
139
  html += `<span style='color:${params[i].color}'>
139
140
  ${params[i].seriesName}</span>\uFF1A${params[i].value[1].toFixed(2)}%
140
141
  `;
142
+ } else if (props.chartType === "category") {
143
+ console.log(props.auxiliaryData);
144
+ html += `<span style='color:${params[i].color}'>
145
+ ${params[i].seriesName}</span>\uFF1A${props.auxiliaryData[params[i].seriesName][params[0].name]}(${params[i].value || params[i].value === 0 ? Number(params[i].value).toFixed(props.floatNumber) : ""}%)
146
+ `;
141
147
  } else {
142
148
  html += `<span style='color:${params[i].color}'>${params[i].seriesName}</span>\uFF1A${params[i].value[2]?.toFixed(props.floatNumber)}\uFF08${params[i].value[1] > 0 ? "+" : ""}${params[i].value[1]}%\uFF09`;
143
149
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hfn-components",
3
- "version": "0.2.8",
3
+ "version": "0.3.0",
4
4
  "description": "",
5
5
  "main": "index.ts",
6
6
  "module": "es/index.mjs",