From 31ec63f0419895876cbaba99637a884a32d33d0d Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 01 九月 2021 10:31:45 +0800 Subject: [PATCH] 2021-09-01 --- src/tabviews/zshare/chartcomponent/index.jsx | 50 ++++++++++++++------------------------------------ 1 files changed, 14 insertions(+), 36 deletions(-) diff --git a/src/tabviews/zshare/chartcomponent/index.jsx b/src/tabviews/zshare/chartcomponent/index.jsx index 85ec585..231654d 100644 --- a/src/tabviews/zshare/chartcomponent/index.jsx +++ b/src/tabviews/zshare/chartcomponent/index.jsx @@ -22,11 +22,10 @@ data: PropTypes.array, // 鍥捐〃浼犲叆鏁版嵁 loading: PropTypes.bool, // 鏁版嵁鍔犺浇涓� config: PropTypes.object, // 椤甸潰閰嶇疆淇℃伅 - getexceloutparam: PropTypes.func // 鑾峰彇excel瀵煎嚭鍙傛暟 } state = { - dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, // 瀛楀吀 + dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, // 瀛楀吀 empty: true, // 鍥捐〃鏁版嵁涓虹┖ actions: [], // 鍥捐〃缁戝畾鐨勬寜閽粍 chartId: Utils.getuuid(), // 鍥捐〃Id @@ -79,7 +78,7 @@ percentFields.push(_column.label) } }) - } catch { + } catch (e) { console.warn('Incorrect percentage setting') } } @@ -230,22 +229,6 @@ }) _data = [..._mdata.values()] - } - - if (plot.correction && plot.chartType === 'bar' && _data.length > 0 && _data.length < plot.correction) { - if (plot.enabled !== 'true' || (plot.customs && plot.customs.filter(cell => cell.chartType !== 'bar').length === 0)) { - let _num = plot.correction - _data.length - for (let i = 0; i < _num; i++) { - let _val = Array( i + 2 ).join(' ') - let _cell = {} - _cell[plot.Xaxis] = _val - _columns.forEach(col => { - _cell[col.field] = '' - }) - - _data.push(_cell) - } - } } this.setState({empty: _data.length === 0}) @@ -870,6 +853,7 @@ let _chart = chart .interval() .position(`${plot.Xaxis}*${_valfield}`) + .size(30) .color(_typefield) .adjust([ { @@ -892,6 +876,7 @@ let _chart = chart .interval() .position(`${plot.Xaxis}*${_valfield}`) + .size(30) .color(_typefield) .adjust('stack') .shape(plot.shape || 'rect') @@ -994,8 +979,10 @@ } }) - if (plot.label === 'true') { - let setting = { + if (plot.label !== 'false') { + _chart.label('percent', { + layout: { type: 'pie-spider' }, + labelHeight: 20, content: (data) => { let val = data[plot.Xaxis] if (val) { @@ -1005,20 +992,14 @@ } } return `${val}: ${(data.percent * 100).toFixed(2)}%` + }, + labelLine: { + style: { + lineWidth: 0.5, + }, } - } - - if (plot.labelLayout === 'overlap') { - setting.type = 'pie' - setting.layout = { - type: 'overlap' - } - setting.offset = 0 - } - - _chart.label('percent', setting) + }) } - } else { let _chart = chart .interval() @@ -1110,8 +1091,6 @@ btn={item} show="icon" setting={config.setting} - getexceloutparam={this.props.getexceloutparam} - updateStatus={() => {}} /> ) } else { @@ -1123,7 +1102,6 @@ btn={item} show="icon" setting={config.setting} - updateStatus={() => {}} /> ) } -- Gitblit v1.8.0