From 73a5124745890650d0fc91234bdbaa66d9bcbc6a Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 09 六月 2021 17:52:01 +0800
Subject: [PATCH] 2021-06-09

---
 src/menu/components/chart/antv-bar/index.jsx |   26 ++++++++++++++++++++------
 1 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/src/menu/components/chart/antv-bar/index.jsx b/src/menu/components/chart/antv-bar/index.jsx
index 87789f7..547d9f4 100644
--- a/src/menu/components/chart/antv-bar/index.jsx
+++ b/src/menu/components/chart/antv-bar/index.jsx
@@ -123,9 +123,11 @@
   }
 
   componentDidMount () {
-    this.viewrender()
     MKEmitter.addListener('submitStyle', this.getStyle)
     MKEmitter.addListener('tabsChange', this.handleTabsChange)
+    setTimeout(() => {
+      this.viewrender()
+    }, 1000)
   }
 
   shouldComponentUpdate (nextProps, nextState) {
@@ -196,10 +198,14 @@
    */
   linerender = () => {
     const { card } = this.state
-    let plot = {...card.plot, height: card.plot.height - 70} // 鍘婚櫎title鎵�鍗犵┖闂�
+    let plot = {...card.plot} // 鍘婚櫎title鎵�鍗犵┖闂�
     let color = plot.color || 'rgba(0, 0, 0, 0.65)'
     let X_axis = plot.Xaxis || 'x'
     let Y_axis = plot.Yaxis || ['y']
+
+    if (card.plot.title || card.search.length > 0) {
+      plot.height = card.plot.height - 70
+    }
 
     let data = this.getdata(X_axis, Y_axis)
 
@@ -383,12 +389,16 @@
    */
   customrender = (data) => {
     let card = fromJS(this.state.card).toJS()
-    let plot = {...card.plot, height: card.plot.height - 70} // 鍘婚櫎title鎵�鍗犵┖闂�
+    let plot = {...card.plot} // 鍘婚櫎title鎵�鍗犵┖闂�
     let color = plot.color || 'rgba(0, 0, 0, 0.65)'
     let fields = []
     let legends = []
     let transfield = {}
     let Bar_axis = []
+
+    if (card.plot.title || card.search.length > 0) {
+      plot.height = card.plot.height - 70
+    }
 
     card.columns.forEach(col => {
       if (col.field) {
@@ -792,10 +802,14 @@
    */
   barrender = () => {
     const { card } = this.state
-    let plot = {...card.plot, height: card.plot.height - 70}
+    let plot = {...card.plot}
     let color = plot.color || 'rgba(0, 0, 0, 0.65)'
     let X_axis = plot.Xaxis || 'x'
     let Y_axis = plot.Yaxis || ['y']
+
+    if (card.plot.title || card.search.length > 0) {
+      plot.height = card.plot.height - 70
+    }
 
     let data = this.getdata(X_axis, Y_axis)
     
@@ -1154,7 +1168,6 @@
 
     return (
       <div className="menu-line-chart-edit-box" style={{..._style, height: card.plot.height || 400}} onClick={this.clickComponent} id={card.uuid}>
-        <NormalHeader config={card} updateComponent={this.updateComponent}/>
         <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={
           <div className="mk-popover-control">
             {!ismob ? <Icon className="plus" title="娣诲姞鎼滅储" onClick={this.addSearch} type="plus-circle" /> : null}
@@ -1172,12 +1185,13 @@
         } trigger="hover">
           <Icon type="tool" />
         </Popover>
+        {card.plot.title || card.search.length > 0 ? <NormalHeader config={card} updateComponent={this.updateComponent}/> : null}
+        <div className="canvas" id={card.uuid + 'canvas'}></div>
         <ActionComponent
           type="chart"
           config={card}
           updateaction={this.updateComponent}
         />
-        <div className="canvas" id={card.uuid + 'canvas'}></div>
       </div>
     )
   }

--
Gitblit v1.8.0