@zgfe/business-lib 1.0.0-beta.1 → 1.0.0-beta.2

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 (90) hide show
  1. package/es/analysisLayout/demo/index.js +1 -1
  2. package/es/analysisLayout/index.js +1 -4
  3. package/es/analysisLayout/index.less +2 -1
  4. package/es/assets/iconfont/iconfont.css +123 -0
  5. package/es/assets/iconfont/iconfont.js +46 -0
  6. package/es/assets/iconfont/iconfont.json +198 -0
  7. package/es/assets/iconfont/iconfont.ttf +0 -0
  8. package/es/assets/iconfont/iconfont.woff +0 -0
  9. package/es/assets/iconfont/iconfont.woff2 +0 -0
  10. package/es/attributeSelector/demo/multi.js +1 -1
  11. package/es/attributeSelector/demo/multiForm.js +1 -1
  12. package/es/attributeSelector/demo/single.js +1 -1
  13. package/es/attributeSelector/demo/singleForm.js +1 -1
  14. package/es/attributeSelector/group.js +1 -1
  15. package/es/attributeSelector/index.js +2 -1
  16. package/es/attributeSelector/index.less +2 -2
  17. package/es/chart/chartConfig.d.ts +20 -5
  18. package/es/chart/chartConfig.js +169 -117
  19. package/es/chart/demo/bar.js +8 -12
  20. package/es/chart/demo/data/data.d.ts +8 -0
  21. package/es/chart/demo/data/data.js +28 -0
  22. package/es/chart/demo/index.js +6 -5
  23. package/es/chart/demo/pie.js +5 -22
  24. package/es/chart/index.d.ts +28 -12
  25. package/es/chart/index.js +94 -17
  26. package/es/chart/util/format.d.ts +4 -0
  27. package/es/chart/util/format.js +61 -0
  28. package/es/commonStyle/icon.less +32 -5
  29. package/es/commonStyle/index.less +3 -171
  30. package/es/commonStyle/select.less +3 -12
  31. package/es/commonStyle/theme.less +80 -39
  32. package/es/commonStyle/variable.less +5 -2
  33. package/es/components/iconFont.d.ts +5 -0
  34. package/es/components/iconFont.js +30 -0
  35. package/es/datePicker/demo/form.js +1 -1
  36. package/es/datePicker/demo/index.js +1 -1
  37. package/es/datePicker/index.js +8 -15
  38. package/es/datePicker/index.less +4 -28
  39. package/es/dialog/components/list.js +1 -1
  40. package/es/dialog/components/selectToInput.js +12 -1
  41. package/es/dialog/components/style/list.less +1 -1
  42. package/es/dialog/components/style/tab.less +2 -2
  43. package/es/dialog/components/tab.js +1 -1
  44. package/es/dialog/demo/index.js +1 -1
  45. package/es/dialog/demo/index2.js +20 -2
  46. package/es/dialog/demo/index3.js +1 -1
  47. package/es/dialog/style/index.less +7 -1
  48. package/es/eventSelector/demo/form.js +1 -1
  49. package/es/eventSelector/demo/index.js +1 -1
  50. package/es/eventSelector/demo/nodata.js +1 -1
  51. package/es/eventSelector/index.d.ts +1 -1
  52. package/es/eventSelector/index.js +3 -13
  53. package/es/eventSelector/{cascade.less → index.less} +2 -1
  54. package/es/globalAttributes/demo/index.js +1 -1
  55. package/es/globalAttributes/index.js +2 -1
  56. package/es/index.d.ts +1 -1
  57. package/es/index.js +1 -4
  58. package/es/multipleSelector/demo/index.js +1 -1
  59. package/es/multipleSelector/index.js +2 -8
  60. package/es/multipleSelector/index.less +23 -25
  61. package/es/select/demo/index.js +32 -4
  62. package/es/select/index.d.ts +2 -1
  63. package/es/select/index.js +30 -8
  64. package/es/select/index.less +1 -0
  65. package/es/table/demo/index.js +1 -1
  66. package/es/table/demo/index2.js +1 -1
  67. package/es/table/index.js +1 -1
  68. package/es/table/index.less +78 -41
  69. package/es/targetConditionGroup/components/conditionItem.js +3 -3
  70. package/es/targetConditionGroup/components/style/group.less +1 -1
  71. package/es/targetConditionGroup/components/style/index.less +1 -1
  72. package/es/targetConditionGroup/demo/form.js +1 -1
  73. package/es/targetConditionGroup/demo/index.js +1 -1
  74. package/es/targetConditionGroup/index.js +2 -1
  75. package/es/targetConditionGroup/index.less +1 -2
  76. package/es/targetSelector/components/BizCascadeBox.d.ts +1 -1
  77. package/es/targetSelector/components/BizCascadeBox.js +1 -1
  78. package/es/targetSelector/demo/form.js +1 -1
  79. package/es/targetSelector/demo/index.js +1 -1
  80. package/es/targetSelector/demo/nodata.js +1 -1
  81. package/es/targetSelector/index.js +1 -2
  82. package/es/targetSelector/index.less +1 -26
  83. package/es/userGroup/demo/cluster.js +1 -1
  84. package/es/userGroup/demo/index.js +1 -1
  85. package/es/userGroup/index.js +1 -2
  86. package/es/userGroup/index.less +1 -1
  87. package/es/userGroup/userCluster.js +2 -1
  88. package/package.json +1 -1
  89. package/es/chart/demo/data.d.ts +0 -11
  90. package/es/chart/demo/data.js +0 -37
@@ -1,11 +1,23 @@
1
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
2
+
3
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
+
5
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
6
+
7
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
8
+
9
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
10
+
11
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
12
+
1
13
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
2
14
 
3
15
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
16
 
5
17
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
18
 
7
- import util from '../utils/util';
8
19
  import { chartColors } from './color';
20
+ import { tooltipFormatterDefault, xAxisFormatterDefault, yAxisFormatterDefault } from './util/format';
9
21
  import './index.less';
10
22
  export var baseConfig = {
11
23
  color: chartColors,
@@ -18,9 +30,7 @@ export var baseConfig = {
18
30
  };
19
31
  export var seriesConfig = {
20
32
  symbol: 'circle',
21
- // symbolSize: 6,
22
- type: 'line' // emphasis: {},
23
-
33
+ symbolSize: 5
24
34
  };
25
35
  export var legendConfig = {
26
36
  type: 'scroll',
@@ -62,27 +72,10 @@ export var xAxisConfig = {
62
72
  nameTextStyle: {
63
73
  lineHeight: 30
64
74
  },
65
- boundaryGap: false,
75
+ // boundaryGap: false,
66
76
  axisLabel: {
67
77
  formatter: function formatter(value) {
68
- if (/^\d{4}-\d{2}-\d{2}$/.test(value)) {
69
- // 处理日期
70
- return value.replace(/\d{4}-/, '');
71
- } else if (/^\d{4}-\d{2}-\d{2}\|\d{4}-\d{2}-\d{2}$/.test(value)) {
72
- // 周、月日期
73
- var dates = value.match(/\d{4}-\d{2}-\d{2}/g);
74
- return dates ? dates[0].replace(/\d{4}-/, '') + '~' + dates[1].replace(/\d{4}-/, '') : value;
75
- } else {
76
- value = util.strMiddleSplit(value);
77
-
78
- if (/:/.test(value)) {
79
- return value.replace(/\d{4}-\d{2}-\d{2}\s/, '');
80
- } else if (/,/.test(value)) {
81
- return value.replace(/,/g, '-');
82
- } else {
83
- return value;
84
- }
85
- }
78
+ return value;
86
79
  }
87
80
  }
88
81
  };
@@ -95,11 +88,7 @@ export var yAxisConfig = {
95
88
  },
96
89
  axisLabel: {
97
90
  formatter: function formatter(value) {
98
- if (parseFloat(String(value)) >= 1000) {
99
- return util.toThousands(parseFloat((value / 1000).toFixed(1))) + 'k';
100
- } else {
101
- return String(value);
102
- }
91
+ return String(value);
103
92
  }
104
93
  }
105
94
  };
@@ -118,34 +107,6 @@ export var tooltipConfig = {
118
107
  shadowStyle: {
119
108
  color: '#f6f6f6'
120
109
  }
121
- },
122
- formatter: function formatter(echartParams) {
123
- var xDate = echartParams[0].name;
124
- var xLabel = xDate;
125
-
126
- if (/^\d{4}-\d{2}-\d{2}$/.test(xLabel)) {
127
- // 处理日期
128
- xLabel = xLabel.replace(/\d{4}-/, '');
129
- }
130
-
131
- var htmlArray = [];
132
-
133
- if (echartParams.length > 1) {
134
- htmlArray.push("<span class=\"biz-chart-tooltip-title\">".concat(xLabel, "</span>"));
135
- }
136
-
137
- echartParams.forEach(function (item) {
138
- var lineLabel = item.value;
139
-
140
- if (item.seriesName.indexOf('CTR') > -1) {
141
- lineLabel += '%';
142
- } else {
143
- lineLabel = util.toThousands(lineLabel);
144
- }
145
-
146
- htmlArray.push("<div class=\"biz-chart-tooltip-item\"><span class=\"biz-chart-tooltip-content\">".concat(item.marker).concat(echartParams.length > 1 ? item.seriesName : item.name, ":</span> <span class=\"biz-chart-tooltip-value\">").concat(lineLabel, "</span></div>"));
147
- });
148
- return htmlArray.join('');
149
110
  }
150
111
  };
151
112
  /**
@@ -154,6 +115,15 @@ export var tooltipConfig = {
154
115
  * @param seriesData 系列数据 [{name:'系列名称',data:[数据]}]
155
116
  * @param chartType 图表类型
156
117
  * @param seriesType 系列类型(单选列柱图是单个颜色还是一个柱一个颜色)
118
+ * @param legendPosition 图例位置
119
+ * @param legendOrient 图例方向
120
+ * @param unit y轴单位
121
+ * @param tooltipFormatter tooltip 自定义显示
122
+ * @param xAxisFormatter x轴 自定义显示
123
+ * @param yAxisFormatter y轴 自定义显示
124
+ * @param reverseXAxis 柱图单系列
125
+ * @param seriesName 系列名称
126
+ *
157
127
  */
158
128
 
159
129
  export var getChartOption = function getChartOption(chartType, xData) {
@@ -161,96 +131,178 @@ export var getChartOption = function getChartOption(chartType, xData) {
161
131
  var sameColor = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
162
132
  var legendPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'top';
163
133
  var legendOrient = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 'horizontal';
134
+ var unit = arguments.length > 6 ? arguments[6] : undefined;
135
+ var tooltipFormatter = arguments.length > 7 ? arguments[7] : undefined;
136
+ var xAxisFormatter = arguments.length > 8 ? arguments[8] : undefined;
137
+ var yAxisFormatter = arguments.length > 9 ? arguments[9] : undefined;
138
+ var reverseXAxis = arguments.length > 10 ? arguments[10] : undefined;
139
+ var seriesName = arguments.length > 11 ? arguments[11] : undefined;
164
140
 
165
141
  var xAxis = JSON.parse(JSON.stringify(xAxisConfig)),
166
- yAxis = _objectSpread({}, yAxisConfig),
167
142
  tooltip = JSON.parse(JSON.stringify(tooltipConfig)),
143
+ yAxis = _objectSpread({}, yAxisConfig),
168
144
  legend = _objectSpread({}, legendConfig),
169
145
  grid = _objectSpread({}, gridConfig),
170
- base = _objectSpread({}, baseConfig);
146
+ seriesItem = _objectSpread({}, seriesConfig); // x轴配置
171
147
 
172
- legend.top = legendPosition;
173
- legend.orient = legendOrient;
174
148
 
175
- if (legendOrient === 'vertical') {
176
- legend.left = 'left';
177
- legend.height = 'auto';
178
- legend.width = 50;
179
- grid.left = 80;
149
+ if (xData) {
150
+ xAxis.data = xData;
151
+ }
152
+
153
+ xAxis.boundaryGap = chartType === 'bar';
154
+ xAxis.axisLabel = xAxis.axisLabel || {
155
+ rotate: 0
156
+ };
157
+ xAxis.axisLabel.rotate = chartType === 'bar' ? 45 : 0;
158
+
159
+ if (xAxisFormatter) {
160
+ xAxis.axisLabel.formatter = xAxisFormatter;
161
+ } else {
162
+ xAxis.axisLabel.formatter = xAxisFormatterDefault;
163
+ } //Y轴配置
164
+
165
+
166
+ yAxis.axisLabel = yAxis.axisLabel || {};
167
+
168
+ if (yAxisFormatter) {
169
+ yAxis.axisLabel.formatter = yAxisFormatter;
170
+ } else {
171
+ yAxis.axisLabel.formatter = yAxisFormatterDefault;
180
172
  }
181
173
 
182
- if (chartType === 'line' || chartType === 'bar') {
183
- // x轴配置
184
- if (xData) {
185
- xAxis.data = xData;
174
+ if (unit) {
175
+ yAxis.name = unit;
176
+ } // series配置
177
+
178
+
179
+ var itemStyle = {
180
+ color: sameColor ? 'auto' : function (param) {
181
+ return chartColors[param.dataIndex % 20];
186
182
  }
183
+ };
184
+ var series = [];
187
185
 
188
- xAxis.axisLabel = xAxis.axisLabel || {
189
- rotate: 0
190
- };
191
- xAxis.axisLabel.rotate = chartType === 'bar' ? 45 : 0; // series配置
186
+ if (chartType === 'bar') {
187
+ seriesItem.barMaxWidth = 40;
188
+ }
192
189
 
193
- var itemStyle = {
194
- color: sameColor ? 'auto' : function (param) {
195
- return chartColors[param.dataIndex % 20];
190
+ if (!reverseXAxis) {
191
+ series = seriesData.map(function (item) {
192
+ var data = _objectSpread({}, item);
193
+
194
+ if (item.names) {
195
+ data = {
196
+ name: item.names.join('-'),
197
+ data: item.values
198
+ };
196
199
  }
197
- }; // if(chartType==='line'){
198
- // seriesConfig.symbol = './style/circle.svg'
199
- // seriesConfig.symbolSize = 10
200
- // }
201
200
 
202
- var series = seriesData.map(function (item) {
203
- return _objectSpread(_objectSpread(_objectSpread({}, item), seriesConfig), {}, {
201
+ return _objectSpread(_objectSpread(_objectSpread({}, data), seriesItem), {}, {
204
202
  itemStyle: itemStyle,
205
203
  type: chartType
206
204
  });
207
205
  });
208
- console.log(tooltip.axisPointer); // tooltip config
206
+ } else {
207
+ series = [_objectSpread(_objectSpread({
208
+ name: seriesName || '',
209
+ data: _toConsumableArray(seriesData)
210
+ }, seriesItem), {}, {
211
+ itemStyle: itemStyle,
212
+ type: chartType
213
+ })];
214
+ } // tooltip config
215
+
216
+
217
+ tooltip.axisPointer = tooltip.axisPointer || {};
218
+ tooltip.axisPointer.type = chartType === 'bar' ? 'shadow' : 'line';
219
+
220
+ if (tooltipFormatter) {
221
+ tooltip.formatter = tooltipFormatter;
222
+ } else {
223
+ tooltip.formatter = tooltipFormatterDefault;
224
+ } // grid config
209
225
 
210
- tooltip.axisPointer = tooltip.axisPointer || {};
211
- tooltip.axisPointer.type = chartType === 'bar' ? 'shadow' : 'line';
212
- console.log(tooltip.axisPointer.type); // grid config
213
226
 
214
- if (legendPosition === 'top') {
215
- grid.top = seriesData.length > 1 ? 45 : 10;
216
- } else if (legendPosition === 'bottom') {
217
- grid.bottom = seriesData.length > 1 ? 45 : 0;
227
+ if (legendPosition === 'top') {
228
+ grid.top = series.length > 1 || reverseXAxis && seriesName ? 45 : 10;
229
+ } else if (legendPosition === 'bottom') {
230
+ grid.bottom = series.length > 1 ? 45 : 0;
231
+ } // 图例配置
232
+
233
+
234
+ legend.top = legendPosition;
235
+ legend.orient = legendOrient;
236
+
237
+ if (legendOrient === 'vertical') {
238
+ legend.left = 'left';
239
+ legend.height = 'auto';
240
+ legend.width = 50;
241
+ grid.left = 80;
242
+ }
243
+
244
+ return _objectSpread(_objectSpread({}, baseConfig), {}, {
245
+ legend: legend,
246
+ xAxis: xAxis,
247
+ yAxis: yAxis,
248
+ tooltip: tooltip,
249
+ grid: grid,
250
+ series: series
251
+ });
252
+ };
253
+ /**
254
+ * 饼图配置
255
+ * @param seriesData 数据 [{name:'',value:''}]
256
+ * @param legendPosition 图例位置
257
+ * @param legendOrient 图例方向
258
+ * @param tooltipFormatter tooltip 自定义显示
259
+ * @returns
260
+ */
261
+
262
+ export var getPieConfig = function getPieConfig() {
263
+ var seriesData = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
264
+ var legendPosition = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
265
+ var legendOrient = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'horizontal';
266
+ var tooltipFormatter = arguments.length > 3 ? arguments[3] : undefined;
267
+ var series = [{
268
+ type: 'pie',
269
+ data: seriesData,
270
+ label: {
271
+ show: false
218
272
  }
273
+ }];
219
274
 
220
- return _objectSpread(_objectSpread({}, baseConfig), {}, {
221
- legend: legend,
222
- xAxis: xAxis,
223
- yAxis: yAxis,
224
- tooltip: tooltip,
225
- grid: grid,
226
- series: series
227
- });
228
- } else if (chartType === 'pie') {
229
- var _series = seriesData.map(function (item) {
230
- return _objectSpread(_objectSpread(_objectSpread({}, item), seriesConfig), {}, {
231
- type: chartType,
232
- label: {
233
- show: false
234
- }
235
- });
236
- });
275
+ var tooltip = JSON.parse(JSON.stringify(tooltipConfig)),
276
+ legend = _objectSpread({}, legendConfig),
277
+ grid = _objectSpread({}, gridConfig);
278
+
279
+ legend.top = legendPosition;
280
+ legend.orient = legendOrient;
281
+
282
+ if (legendOrient === 'vertical') {
283
+ legend.left = 'left';
284
+ legend.height = 'auto';
285
+ legend.width = 50;
286
+ grid.left = 80;
287
+ }
237
288
 
238
- tooltip.trigger = 'item';
289
+ tooltip.trigger = 'item';
239
290
 
291
+ if (tooltipFormatter) {
292
+ tooltip.formatter = tooltipFormatter;
293
+ } else {
240
294
  tooltip.formatter = function (params) {
241
295
  var name = params.name,
242
296
  value = params.value,
243
297
  marker = params.marker;
244
298
  return "<div class=\"biz-chart-tooltip-item\"><span class=\"biz-chart-tooltip-content\">".concat(marker).concat(name, ":</span> <span class=\"biz-chart-tooltip-value\">").concat(value, "</span></div>");
245
299
  };
246
-
247
- return _objectSpread(_objectSpread({}, baseConfig), {}, {
248
- legend: legend,
249
- tooltip: tooltip,
250
- grid: grid,
251
- series: _series
252
- });
253
- } else {
254
- return {};
255
300
  }
301
+
302
+ return _objectSpread(_objectSpread({}, baseConfig), {}, {
303
+ legend: legend,
304
+ tooltip: tooltip,
305
+ grid: grid,
306
+ series: series
307
+ });
256
308
  };
@@ -1,19 +1,15 @@
1
1
  import React from 'react';
2
- import { BizChart } from 'business-lib';
3
- import chartData from './data';
4
- var barData = {
5
- xData: ['付款成功', '注册', '搜索商品', '查看商品详情', '申请退货'],
6
- seriesData: [{
7
- data: [157, 161, 1441, 1414, 710]
8
- }]
9
- };
2
+ import { BizChart } from '@zgfe/business-lib';
3
+ import chartData from './data/data';
10
4
  export default (function () {
11
5
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(BizChart, {
12
6
  data: chartData,
13
- type: "bar"
14
- }), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement(BizChart, {
15
- data: barData,
16
7
  type: "bar",
17
- sameColor: false
8
+ reverseXAxis: true,
9
+ seriesName: "fff",
10
+ showList: ['付款成功', '搜索商品', '查看商品详情']
11
+ }), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement(BizChart, {
12
+ data: chartData,
13
+ type: "bar"
18
14
  }));
19
15
  });
@@ -0,0 +1,8 @@
1
+ declare const _default: {
2
+ x_axis: string[];
3
+ series: {
4
+ names: string[];
5
+ values: number[];
6
+ }[];
7
+ };
8
+ export default _default;
@@ -0,0 +1,28 @@
1
+ export default {
2
+ x_axis: ['2022-03-31', '2022-04-01', '2022-04-02', '2022-04-03', '2022-04-04', '2022-04-05', '2022-04-06', '2022-04-07', '2022-04-08', '2022-04-09', '2022-04-10', '2022-04-11', '2022-04-12', '2022-04-13'],
3
+ series: [{
4
+ names: ['付款成功'],
5
+ values: [26, 27, 43, 44, 40, 34, 33, 33, 34, 24, 30, 31, 31, 38]
6
+ }, {
7
+ names: ['注册-发送手机验证码'],
8
+ values: [11, 10, 7, 5, 13, 18, 14, 17, 11, 6, 10, 12, 15, 10]
9
+ }, {
10
+ names: ['搜索商品'],
11
+ values: [75, 68, 86, 80, 87, 71, 72, 81, 77, 74, 78, 76, 76, 79]
12
+ }, {
13
+ names: ['pv'],
14
+ values: [104, 89, 109, 103, 112, 93, 87, 101, 101, 97, 102, 110, 106, 98]
15
+ }, {
16
+ names: ['查看商品详情'],
17
+ values: [122, 107, 132, 113, 133, 115, 106, 127, 132, 117, 119, 123, 119, 117]
18
+ }, {
19
+ names: ['scroll'],
20
+ values: [98, 96, 106, 109, 113, 105, 91, 111, 99, 99, 104, 108, 116, 92]
21
+ }, {
22
+ names: ['click'],
23
+ values: [108, 102, 111, 90, 111, 105, 91, 129, 117, 101, 109, 109, 105, 96]
24
+ }, {
25
+ names: ['申请退货'],
26
+ values: [5, 11, 14, 9, 8, 14, 9, 10, 12, 12, 14, 16, 12, 10]
27
+ }]
28
+ };
@@ -1,9 +1,10 @@
1
1
  import React from 'react';
2
- import { BizChart } from 'business-lib';
3
- import chartData from './data';
2
+ import { BizChart } from '@zgfe/business-lib';
3
+ import chartData from './data/data';
4
4
  export default (function () {
5
- return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(BizChart, {
5
+ return /*#__PURE__*/React.createElement(BizChart, {
6
6
  data: chartData,
7
- type: "line"
8
- }));
7
+ type: "line",
8
+ legendPosition: "bottom"
9
+ });
9
10
  });
@@ -1,30 +1,13 @@
1
1
  import React from 'react';
2
- import { BizChart } from 'business-lib';
3
- var pieData = {
4
- seriesData: [{
5
- data: [{
6
- name: '付款成功',
7
- value: 222
8
- }, {
9
- name: '注册',
10
- value: 161
11
- }, {
12
- name: '搜索商品',
13
- value: 1441
14
- }, {
15
- name: '查看商品详情',
16
- value: 1414
17
- }, {
18
- name: '付款成申请退货功',
19
- value: 710
20
- }]
21
- }]
22
- };
2
+ import { BizChart } from '@zgfe/business-lib';
3
+ import pieData from './data/data';
23
4
  export default (function () {
24
5
  return /*#__PURE__*/React.createElement(BizChart, {
25
6
  data: pieData,
26
7
  type: "pie",
8
+ showAll: false,
27
9
  legendPosition: "bottom",
28
- legendOrient: "vertical"
10
+ legendOrient: "vertical",
11
+ showList: ['付款成功', '搜索商品', '查看商品详情', 'click']
29
12
  });
30
13
  });
@@ -1,18 +1,13 @@
1
1
  import React from 'react';
2
2
  interface ChartItmProps {
3
- name?: string;
4
- data?: Array<string | number | object>;
3
+ names: Array<string>;
4
+ values: Array<number>;
5
5
  }
6
6
  interface DataProps {
7
- xData?: Array<string>;
8
- seriesData: Array<ChartItmProps>;
7
+ x_axis?: Array<string>;
8
+ series: Array<ChartItmProps>;
9
9
  }
10
10
  interface BizChartProps {
11
- /**
12
- * @description 自定义图表配置
13
- * @default -
14
- */
15
- option?: any;
16
11
  /**
17
12
  * @description 图形类型
18
13
  * @default line
@@ -22,7 +17,7 @@ interface BizChartProps {
22
17
  * @description 数据(x轴和series数据)
23
18
  * @default -
24
19
  */
25
- data?: DataProps;
20
+ data: DataProps;
26
21
  /**
27
22
  * @description 柱图是同色还是一柱一色(仅对柱图单一系列作用)
28
23
  * @default true
@@ -52,12 +47,33 @@ interface BizChartProps {
52
47
  * @description 图例位置
53
48
  * @default -
54
49
  */
55
- legendPosition: 'top' | 'bottom' | 'middle';
50
+ legendPosition?: 'top' | 'bottom' | 'middle';
56
51
  /**
57
52
  * @description 图例布局朝向
58
53
  * @default -
59
54
  */
60
- legendOrient: 'horizontal' | 'vertical';
55
+ legendOrient?: 'horizontal' | 'vertical';
56
+ /**
57
+ * @description 显示数据项(从store中过滤),对应series中的names字段。如果没传的话,默认会展示前10条记录
58
+ * @abstract [['group', 'item1'], ['group', 'item2']]或['item1', 'item2']
59
+ * @default -
60
+ */
61
+ showList?: Array<any>;
62
+ /**
63
+ * @description 默认展示showList指定的条目或者前10条记录,并生成"其它"记录。showAll置为true后,将强制在饼图上展示所有记录
64
+ * @default true
65
+ */
66
+ showAll?: boolean;
67
+ /**
68
+ * @description 是否将series中每项数据的names转为新的x轴
69
+ * @tip 目前只有柱状图时有效
70
+ * @default false
71
+ */
72
+ reverseXAxis?: boolean;
73
+ /**
74
+ * @description reverseXAxis为true时,该项是图例名称
75
+ */
76
+ seriesName?: string;
61
77
  }
62
78
  declare const BizChart: React.FC<BizChartProps>;
63
79
  export default BizChart;