From f830c733cbc071f023c9a9a4e1571b7c81d672bf Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 12 十一月 2020 11:47:33 +0800 Subject: [PATCH] 2020-11-12 --- src/tabviews/zshare/chartcomponent/index.jsx | 42 ++++++++++++------------------------------ 1 files changed, 12 insertions(+), 30 deletions(-) diff --git a/src/tabviews/zshare/chartcomponent/index.jsx b/src/tabviews/zshare/chartcomponent/index.jsx index 4edb9b1..65a9f92 100644 --- a/src/tabviews/zshare/chartcomponent/index.jsx +++ b/src/tabviews/zshare/chartcomponent/index.jsx @@ -233,22 +233,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}) return _data } @@ -871,6 +855,7 @@ let _chart = chart .interval() .position(`${plot.Xaxis}*${_valfield}`) + .size(30) .color(_typefield) .adjust([ { @@ -893,6 +878,7 @@ let _chart = chart .interval() .position(`${plot.Xaxis}*${_valfield}`) + .size(30) .color(_typefield) .adjust('stack') .shape(plot.shape || 'rect') @@ -995,8 +981,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) { @@ -1006,20 +994,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() -- Gitblit v1.8.0