From a13b2a8d6e84662275ea913850e01be9b2ff31e5 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 13 八月 2021 00:24:31 +0800
Subject: [PATCH] 2021-08-13

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

diff --git a/src/menu/components/chart/antv-bar/index.jsx b/src/menu/components/chart/antv-bar/index.jsx
index 2da2eaf..6930709 100644
--- a/src/menu/components/chart/antv-bar/index.jsx
+++ b/src/menu/components/chart/antv-bar/index.jsx
@@ -198,14 +198,10 @@
    */
   linerender = () => {
     const { card } = this.state
-    let plot = {...card.plot} // 鍘婚櫎title鎵�鍗犵┖闂�
+    const 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)
 
@@ -239,7 +235,7 @@
       const chart = new Chart({
         container: card.uuid + 'canvas',
         autoFit: true,
-        height: plot.height || 400
+        height: this.wrap.offsetHeight - 25
       })
   
       chart.data(dv.rows)
@@ -423,16 +419,12 @@
    */
   customrender = (data) => {
     let card = fromJS(this.state.card).toJS()
-    let plot = {...card.plot} // 鍘婚櫎title鎵�鍗犵┖闂�
+    let plot = card.plot
     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) {
@@ -568,7 +560,7 @@
     const chart = new Chart({
       container: card.uuid + 'canvas',
       autoFit: true,
-      height: plot.height || 400,
+      height: this.wrap.offsetHeight - 25,
     })
 
     // chart.axis(plot.Xaxis, { label: { style: { fill: color } }, tickLine: {style: { stroke: color }}, line: { style: { stroke: color } } })
@@ -920,14 +912,10 @@
    */
   barrender = () => {
     const { card } = this.state
-    let plot = {...card.plot}
+    const 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)
     
@@ -962,7 +950,7 @@
       const chart = new Chart({
         container: card.uuid + 'canvas',
         autoFit: true,
-        height: plot.height || 400
+        height: this.wrap.offsetHeight - 25
       })
 
       chart.data(dv.rows)
@@ -1362,7 +1350,7 @@
           <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>
+        <div className="canvas" id={card.uuid + 'canvas'} ref={ref => this.wrap = ref}></div>
         {appType !== 'mob' ? <ActionComponent
           type="chart"
           config={card}

--
Gitblit v1.8.0