From 610916b0e897c4953310bac7c0a9a37c7379ffc0 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 25 五月 2021 16:29:13 +0800 Subject: [PATCH] 2021-05-25 --- src/tabviews/custom/components/chart/antv-dashboard/index.scss | 1 src/tabviews/custom/components/chart/antv-scatter/index.jsx | 11 ++- src/tabviews/custom/components/chart/antv-bar-line/index.jsx | 22 ++++--- src/tabviews/custom/components/chart/antv-dashboard/index.jsx | 12 +++- src/tabviews/custom/components/chart/antv-scatter/index.scss | 3 src/menu/components/group/groupcomponents/index.scss | 5 - src/menu/components/chart/antv-scatter/index.scss | 4 src/tabviews/custom/components/chart/antv-bar-line/index.scss | 3 src/menu/components/chart/antv-pie/index.scss | 1 src/tabviews/custom/components/chart/antv-pie/index.jsx | 11 ++- src/tabviews/custom/components/chart/antv-pie/index.scss | 1 src/menu/components/chart/antv-pie/index.jsx | 18 ++--- src/menu/components/chart/antv-bar/index.scss | 4 src/menu/components/chart/antv-bar/index.jsx | 29 ++++----- src/menu/components/chart/antv-scatter/index.jsx | 18 ++--- src/menu/components/tabs/tabcomponents/index.scss | 5 - src/menu/components/chart/antv-dashboard/index.jsx | 18 ++--- src/menu/components/chart/antv-dashboard/index.scss | 2 18 files changed, 86 insertions(+), 82 deletions(-) diff --git a/src/menu/components/chart/antv-bar/index.jsx b/src/menu/components/chart/antv-bar/index.jsx index 02fd71b..63f0182 100644 --- a/src/menu/components/chart/antv-bar/index.jsx +++ b/src/menu/components/chart/antv-bar/index.jsx @@ -152,7 +152,8 @@ _element.innerHTML = '' } - setTimeout(this.viewrender, 100) + this.$timer && clearTimeout(this.$timer) + this.$timer = setTimeout(this.viewrender, 100) } } @@ -195,7 +196,7 @@ */ linerender = () => { const { card } = this.state - let plot = {...card.plot, height: card.plot.height - 80} // 鍘婚櫎title鎵�鍗犵┖闂� + let plot = {...card.plot, height: card.plot.height - 70} // 鍘婚櫎title鎵�鍗犵┖闂� let color = plot.color || 'rgba(0, 0, 0, 0.65)' let X_axis = plot.Xaxis || 'x' let Y_axis = plot.Yaxis || ['y'] @@ -249,7 +250,7 @@ } chart.scale('value', { nice: true, - range: [0, 0.93] + range: [0, 0.9] }) if (!plot.legend || plot.legend === 'hidden') { @@ -351,7 +352,7 @@ */ customrender = (data) => { let card = fromJS(this.state.card).toJS() - let plot = {...card.plot, height: card.plot.height - 80} // 鍘婚櫎title鎵�鍗犵┖闂� + let plot = {...card.plot, height: card.plot.height - 70} // 鍘婚櫎title鎵�鍗犵┖闂� let color = plot.color || 'rgba(0, 0, 0, 0.65)' let fields = [] let legends = [] @@ -476,7 +477,7 @@ chart.scale(item.name, { nice: true, - range: [0, 0.93] + range: [0, 0.9] }) if (item.chartType === 'bar') { @@ -563,7 +564,7 @@ */ barrender = () => { const { card } = this.state - let plot = {...card.plot, height: card.plot.height - 80} + let plot = {...card.plot, height: card.plot.height - 70} let color = plot.color || 'rgba(0, 0, 0, 0.65)' let X_axis = plot.Xaxis || 'x' let Y_axis = plot.Yaxis || ['y'] @@ -603,7 +604,7 @@ autoFit: true, height: plot.height || 400 }) - + chart.data(dv.rows) // chart.axis(X_axis, { label: { style: { fill: color } }, tickLine: {style: { stroke: color }}, line: { style: { stroke: color } } }) @@ -613,7 +614,7 @@ chart.scale('value', { nice: true, - range: [0, 0.93] + range: [0, 0.9] }) if (!plot.legend || plot.legend === 'hidden') { @@ -768,13 +769,15 @@ updateComponent = (component) => { const card = fromJS(this.state.card).toJS() - let refresh = false if (!is(fromJS(component.plot), fromJS(card.plot)) || !is(fromJS(component.style), fromJS(card.style))) { let _element = document.getElementById(card.uuid + 'canvas') if (_element) { _element.innerHTML = '' } - refresh = true + this.$timer && clearTimeout(this.$timer) + this.$timer = setTimeout(() => { + this.viewrender() + }, 150) } component.width = component.plot.width @@ -782,12 +785,6 @@ this.setState({ card: component - }, () => { - if (refresh) { - setTimeout(() => { - this.viewrender() - }, 100) - } }) this.props.updateConfig(component) } diff --git a/src/menu/components/chart/antv-bar/index.scss b/src/menu/components/chart/antv-bar/index.scss index 9754b3c..bc94603 100644 --- a/src/menu/components/chart/antv-bar/index.scss +++ b/src/menu/components/chart/antv-bar/index.scss @@ -8,9 +8,9 @@ .canvas { margin: 0px; - // padding: 20px 15px 15px; - padding: 15px; + padding: 15px 10px 10px; letter-spacing: 0px; + min-height: calc(100% - 45px); } .chart-header { diff --git a/src/menu/components/chart/antv-dashboard/index.jsx b/src/menu/components/chart/antv-dashboard/index.jsx index 1e395b6..fea3e2c 100644 --- a/src/menu/components/chart/antv-dashboard/index.jsx +++ b/src/menu/components/chart/antv-dashboard/index.jsx @@ -162,7 +162,8 @@ _element.innerHTML = '' } - setTimeout(this.dashboardrender, 100) + this.$timer && clearTimeout(this.$timer) + this.$timer = setTimeout(this.dashboardrender, 100) } } @@ -183,7 +184,7 @@ const chart = new Chart({ container: card.uuid + 'dashboard', autoFit: true, - height: plot.height ? (plot.height - 80) : 320, + height: plot.height ? (plot.height - 75) : 325, padding: [0, 0, 0, 0], }) chart.data(data); @@ -315,13 +316,16 @@ updateComponent = (component) => { const card = fromJS(this.state.card).toJS() - let refresh = false + if (!is(fromJS(component.plot), fromJS(card.plot)) || !is(fromJS(component.style), fromJS(card.style))) { let _element = document.getElementById(card.uuid + 'dashboard') if (_element) { _element.innerHTML = '' } - refresh = true + this.$timer && clearTimeout(this.$timer) + this.$timer = setTimeout(() => { + this.dashboardrender() + }, 150) } component.width = component.plot.width @@ -329,12 +333,6 @@ this.setState({ card: component - }, () => { - if (refresh) { - setTimeout(() => { - this.dashboardrender() - }, 100) - } }) this.props.updateConfig(component) } diff --git a/src/menu/components/chart/antv-dashboard/index.scss b/src/menu/components/chart/antv-dashboard/index.scss index 0efe48d..d4bdc91 100644 --- a/src/menu/components/chart/antv-dashboard/index.scss +++ b/src/menu/components/chart/antv-dashboard/index.scss @@ -8,7 +8,9 @@ .canvas { margin: 0px; + padding: 15px; letter-spacing: 0px; + min-height: calc(100% - 45px); } >.anticon-tool { diff --git a/src/menu/components/chart/antv-pie/index.jsx b/src/menu/components/chart/antv-pie/index.jsx index cbc63d6..ebd9179 100644 --- a/src/menu/components/chart/antv-pie/index.jsx +++ b/src/menu/components/chart/antv-pie/index.jsx @@ -138,7 +138,8 @@ _element.innerHTML = '' } - setTimeout(this.pierender, 100) + this.$timer && clearTimeout(this.$timer) + this.$timer = setTimeout(this.pierender, 100) } } @@ -184,7 +185,7 @@ const chart = new Chart({ container: card.uuid + 'canvas', autoFit: true, - height: card.plot.height ? (card.plot.height - 80) : 320 + height: card.plot.height ? (card.plot.height - 75) : 325 }) if (plot.shape !== 'nightingale' && plot.show !== 'value') { @@ -353,13 +354,16 @@ updateComponent = (component) => { const card = fromJS(this.state.card).toJS() - let refresh = false + if (!is(fromJS(component.plot), fromJS(card.plot)) || !is(fromJS(component.style), fromJS(card.style))) { let _element = document.getElementById(card.uuid + 'canvas') if (_element) { _element.innerHTML = '' } - refresh = true + this.$timer && clearTimeout(this.$timer) + this.$timer = setTimeout(() => { + this.pierender() + }, 150) } component.width = component.plot.width @@ -367,12 +371,6 @@ this.setState({ card: component - }, () => { - if (refresh) { - setTimeout(() => { - this.pierender() - }, 100) - } }) this.props.updateConfig(component) } diff --git a/src/menu/components/chart/antv-pie/index.scss b/src/menu/components/chart/antv-pie/index.scss index 560f140..042b9b8 100644 --- a/src/menu/components/chart/antv-pie/index.scss +++ b/src/menu/components/chart/antv-pie/index.scss @@ -10,6 +10,7 @@ margin: 0px; padding: 15px; letter-spacing: 0px; + min-height: calc(100% - 45px); } >.anticon-tool { diff --git a/src/menu/components/chart/antv-scatter/index.jsx b/src/menu/components/chart/antv-scatter/index.jsx index 64e859d..e948102 100644 --- a/src/menu/components/chart/antv-scatter/index.jsx +++ b/src/menu/components/chart/antv-scatter/index.jsx @@ -139,7 +139,8 @@ _element.innerHTML = '' } - setTimeout(this.ponitrender, 100) + this.$timer && clearTimeout(this.$timer) + this.$timer = setTimeout(this.ponitrender, 100) } } @@ -188,7 +189,7 @@ const chart = new Chart({ container: card.uuid + 'canvas', autoFit: true, - height: plot.height - 80 + height: plot.height - 70 }) chart.data(data); @@ -233,13 +234,16 @@ updateComponent = (component) => { const card = fromJS(this.state.card).toJS() - let refresh = false + if (!is(fromJS(component.plot), fromJS(card.plot)) || !is(fromJS(component.style), fromJS(card.style))) { let _element = document.getElementById(card.uuid + 'canvas') if (_element) { _element.innerHTML = '' } - refresh = true + this.$timer && clearTimeout(this.$timer) + this.$timer = setTimeout(() => { + this.ponitrender() + }, 150) } component.width = component.plot.width @@ -247,12 +251,6 @@ this.setState({ card: component - }, () => { - if (refresh) { - setTimeout(() => { - this.ponitrender() - }, 100) - } }) this.props.updateConfig(component) } diff --git a/src/menu/components/chart/antv-scatter/index.scss b/src/menu/components/chart/antv-scatter/index.scss index 9754b3c..bc94603 100644 --- a/src/menu/components/chart/antv-scatter/index.scss +++ b/src/menu/components/chart/antv-scatter/index.scss @@ -8,9 +8,9 @@ .canvas { margin: 0px; - // padding: 20px 15px 15px; - padding: 15px; + padding: 15px 10px 10px; letter-spacing: 0px; + min-height: calc(100% - 45px); } .chart-header { diff --git a/src/menu/components/group/groupcomponents/index.scss b/src/menu/components/group/groupcomponents/index.scss index ad63183..b739fe0 100644 --- a/src/menu/components/group/groupcomponents/index.scss +++ b/src/menu/components/group/groupcomponents/index.scss @@ -1,9 +1,6 @@ .group-shell-inner { - margin: -8px; + margin: 0px; - >.ant-col { - padding: 8px; - } .anticon { cursor: unset; } diff --git a/src/menu/components/tabs/tabcomponents/index.scss b/src/menu/components/tabs/tabcomponents/index.scss index b65895c..f21f784 100644 --- a/src/menu/components/tabs/tabcomponents/index.scss +++ b/src/menu/components/tabs/tabcomponents/index.scss @@ -1,9 +1,6 @@ .tab-shell-inner { - margin: -8px; + margin: 0px; - >.ant-col { - padding: 8px; - } .anticon { cursor: unset; } diff --git a/src/tabviews/custom/components/chart/antv-bar-line/index.jsx b/src/tabviews/custom/components/chart/antv-bar-line/index.jsx index faacd7a..7ac9593 100644 --- a/src/tabviews/custom/components/chart/antv-bar-line/index.jsx +++ b/src/tabviews/custom/components/chart/antv-bar-line/index.jsx @@ -95,13 +95,14 @@ }) } + let height = config.plot.height || 400 if (config.plot.title || config.search.length > 0) { - _config.plot.height = _config.plot.height - 80 + _config.plot.height = height - 70 } else { - _config.plot.height = _config.plot.height - 30 + _config.plot.height = height - 25 } - _config.style.height = config.plot.height || 400 + _config.style.height = height let transfield = {} _config.columns.forEach(col => { @@ -763,7 +764,7 @@ const chart = new Chart({ container: this.state.chartId, autoFit: true, - height: plot.height || 400 + height: plot.height }) chart.data(_data) @@ -905,7 +906,7 @@ const chart = new Chart({ container: this.state.chartId, autoFit: true, - height: plot.height || 400 + height: plot.height }) let _data = dv.rows @@ -1110,7 +1111,7 @@ const chart = new Chart({ container: this.state.chartId, autoFit: true, - height: plot.height || 400 + height: plot.height }) // dodge is not support linear attribute, please use category attribute! 鏃堕棿鏍煎紡 @@ -1129,7 +1130,7 @@ chart.scale(_valfield, { nice: true, - range: [0, 0.93] + range: [0, 0.9] }) // 鍧愭爣杞存牸寮忓寲 @@ -1164,8 +1165,10 @@ }) } + let offset = {offsetY: 5} if (plot.transpose === 'true') { chart.coordinate().transpose() + offset = {offsetY: 0, offsetX: -10} } if (plot.coordinate === 'polar') { @@ -1215,7 +1218,8 @@ content: value, style: { fill: plot.color - } + }, + ...offset } }) } @@ -1369,7 +1373,7 @@ } })} </div> - <div className={'canvas' + (empty ? ' empty' : '')} id={this.state.chartId}></div> + <div className={'canvas' + (empty ? ' empty' : '')} style={{height: config.plot.height + 25}} id={this.state.chartId}></div> </div> {empty ? <Empty description={false}/> : null} </div> diff --git a/src/tabviews/custom/components/chart/antv-bar-line/index.scss b/src/tabviews/custom/components/chart/antv-bar-line/index.scss index b912f22..a3afbfc 100644 --- a/src/tabviews/custom/components/chart/antv-bar-line/index.scss +++ b/src/tabviews/custom/components/chart/antv-bar-line/index.scss @@ -9,6 +9,7 @@ .canvas-wrap { margin: 0 0px; position: relative; + min-height: calc(100% - 45px); .chart-action { position: absolute; top: 0px; @@ -22,7 +23,7 @@ .canvas { margin: 0; - padding: 20px 15px 15px; + padding: 15px 10px 10px; letter-spacing: 0px; } .canvas.empty { diff --git a/src/tabviews/custom/components/chart/antv-dashboard/index.jsx b/src/tabviews/custom/components/chart/antv-dashboard/index.jsx index f0751ee..e702da2 100644 --- a/src/tabviews/custom/components/chart/antv-dashboard/index.jsx +++ b/src/tabviews/custom/components/chart/antv-dashboard/index.jsx @@ -86,7 +86,13 @@ _sync = false } - _config.style.height = config.plot.height || 400 + let height = config.plot.height || 400 + if (config.plot.title) { + _config.plot.height = height - 75 + } else { + _config.plot.height = height - 30 + } + _config.style.height = height this.setState({ config: _config, @@ -311,7 +317,7 @@ const chart = new Chart({ container: chartId, autoFit: true, - height: plot.height ? (plot.height - 80) : 320, + height: plot.height, padding: [0, 0, 0, 0], }) chart.data([_data]); @@ -457,7 +463,7 @@ } <NormalHeader config={config} /> <div className="canvas-wrap"> - <div className={'canvas' + (empty ? ' empty' : '')} id={this.state.chartId}></div> + <div className={'canvas' + (empty ? ' empty' : '')} style={{height: config.plot.height + 30}} id={this.state.chartId}></div> </div> </div> ) diff --git a/src/tabviews/custom/components/chart/antv-dashboard/index.scss b/src/tabviews/custom/components/chart/antv-dashboard/index.scss index f90d8c7..c619cd6 100644 --- a/src/tabviews/custom/components/chart/antv-dashboard/index.scss +++ b/src/tabviews/custom/components/chart/antv-dashboard/index.scss @@ -9,6 +9,7 @@ .canvas-wrap { margin: 0 0px; position: relative; + min-height: calc(100% - 45px); .chart-action { position: absolute; top: 2px; diff --git a/src/tabviews/custom/components/chart/antv-pie/index.jsx b/src/tabviews/custom/components/chart/antv-pie/index.jsx index 19ea6bb..c398a77 100644 --- a/src/tabviews/custom/components/chart/antv-pie/index.jsx +++ b/src/tabviews/custom/components/chart/antv-pie/index.jsx @@ -55,13 +55,14 @@ _sync = false } + let height = config.plot.height || 400 if (config.plot.title || config.search.length > 0) { - _config.plot.height = _config.plot.height - 80 + _config.plot.height = height - 75 } else { - _config.plot.height = _config.plot.height - 30 + _config.plot.height = height - 30 } - _config.style.height = config.plot.height || 400 + _config.style.height = height this.setState({ config: _config, @@ -387,7 +388,7 @@ const chart = new Chart({ container: chartId, autoFit: true, - height: plot.height || 400 + height: plot.height }) if (plot.shape !== 'nightingale' && plot.show !== 'value') { @@ -642,7 +643,7 @@ } <NormalHeader config={config} BID={BID} menuType={this.props.menuType} refresh={this.refreshSearch} /> <div className="canvas-wrap"> - <div className={'canvas' + (empty ? ' empty' : '')} id={this.state.chartId}></div> + <div className={'canvas' + (empty ? ' empty' : '')} style={{height: config.plot.height + 30}} id={this.state.chartId}></div> </div> {empty ? <Empty description={false}/> : null} </div> diff --git a/src/tabviews/custom/components/chart/antv-pie/index.scss b/src/tabviews/custom/components/chart/antv-pie/index.scss index 3839a61..e7c1be6 100644 --- a/src/tabviews/custom/components/chart/antv-pie/index.scss +++ b/src/tabviews/custom/components/chart/antv-pie/index.scss @@ -9,6 +9,7 @@ .canvas-wrap { margin: 0 0px; position: relative; + min-height: calc(100% - 45px); .chart-action { position: absolute; top: 2px; diff --git a/src/tabviews/custom/components/chart/antv-scatter/index.jsx b/src/tabviews/custom/components/chart/antv-scatter/index.jsx index 5989af5..0e2135d 100644 --- a/src/tabviews/custom/components/chart/antv-scatter/index.jsx +++ b/src/tabviews/custom/components/chart/antv-scatter/index.jsx @@ -52,13 +52,14 @@ _sync = false } + let height = config.plot.height || 400 if (config.plot.title || config.search.length > 0) { - _config.plot.height = _config.plot.height - 80 + _config.plot.height = height - 70 } else { - _config.plot.height = _config.plot.height - 30 + _config.plot.height = height - 25 } - _config.style.height = config.plot.height + _config.style.height = height this.setState({ config: _config, @@ -324,7 +325,7 @@ } /** - * @description 鎶樼嚎鍥炬覆鏌� + * @description 鏁g偣鍥炬覆鏌� */ scatterrender = () => { const { plot, data, chartId } = this.state @@ -416,7 +417,7 @@ } })} </div> - <div className={'canvas' + (empty ? ' empty' : '')} id={this.state.chartId}></div> + <div className={'canvas' + (empty ? ' empty' : '')} style={{height: config.plot.height + 25}} id={this.state.chartId}></div> </div> {empty ? <Empty description={false}/> : null} </div> diff --git a/src/tabviews/custom/components/chart/antv-scatter/index.scss b/src/tabviews/custom/components/chart/antv-scatter/index.scss index c8f3c8c..25ffcaa 100644 --- a/src/tabviews/custom/components/chart/antv-scatter/index.scss +++ b/src/tabviews/custom/components/chart/antv-scatter/index.scss @@ -9,6 +9,7 @@ .canvas-wrap { margin: 0 0px; position: relative; + min-height: calc(100% - 45px); .chart-action { position: absolute; top: 0px; @@ -22,7 +23,7 @@ .canvas { margin: 0; - padding: 20px 15px 15px; + padding: 15px 10px 10px; letter-spacing: 0px; } .canvas.empty { -- Gitblit v1.8.0