king
2021-05-25 610916b0e897c4953310bac7c0a9a37c7379ffc0
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)
  }