<address id="r9vd9"><address id="r9vd9"><listing id="r9vd9"></listing></address></address>

      歡迎您光臨深圳塔燈網絡科技有限公司!
      電話圖標 余先生:13699882642

      網站百科

      為您解碼網站建設的點點滴滴

      小程序 echarts 封裝 異步請求數據 多調用

      發表日期:2019-11 文章編輯:小燈 瀏覽次數:4916

      直接上代碼
      `function setOption(paramChart, title, chartType, xdata, ydata,yscale, dataFlag) {

      let intervalVal = 0
      if (dataFlag == 'staffAct') {
          intervalVal = 'auto'
      } else {
          intervalVal = 0
      }
      const option = {
          color: ['#fff'],
          title: {
              text: '',
              x: 'left',
              y: 'top',
              padding: 5,
              textStyle: {
                  fontSize: 12,
                  color: '#fff'
              },
          },
          grid: {
              left: '3%',
              right: '5%',
              bottom: 15,
              top: 15,
              containLabel: true
          },
          xAxis: {
              type: 'category',
              data: xdata,
              axisLine: {
                  lineStyle: {
                      color: "#fff",
                  }
              },
              axisLabel: {
                  interval: intervalVal,
                  formatter: function (value) {
                      var reg = new RegExp("[\\u4E00-\\u9FFF]+", "g");
                      if (reg.test(value)){
                          return (value.length > 4 ? (value.slice(0, 4) + "...") : value)
                      }else{
                          return (value.length > 10 ? (value.slice(0, 10) + "...") : value)
                      }
                      
                  },
                  rotate: -90,
                  fontSize:8,
              }
          },
          yAxis: {
              x: 'center',
              type: 'value',
              splitLine: {
                  lineStyle: {
                      type: 'dashed'
                  }
              },
              axisLine: {
                  lineStyle: {
                      color: "#fff",
                  }
              },
              axisLabel: {
                  fontSize: '12',
                  formatter: '{value}' + yscale
              }
          },
          series: [{
              type: chartType,
              connectNulls: true, 
              // type: 'bar',
              smooth: true,
              barMaxWidth:15,
              // label: {
              //     normal: {
              //         show: true,
              //         position: 'top'
              //     }
              // },
              label: {
                  normal: {                    
                      textStyle: {
                          fontSize: 12,
                          rich: {}
                      }
                  }
              },
              data: ydata,
              
          }, ]
      };
      paramChart.setOption(option)

      }`
      data:
      `
      ecStaffAct: {

              lazyLoad: true
          },
          ecHeat: {
              lazyLoad: true
          },

      `
      調用:
      `getStaffActData() {

          let self = this
          let param = {}
         
          
          app.wxreq(app.globalData.DOMAIN_PATH + app.globalData.--, param, 'POST').then(res => {
              if (res.code == 0) {
                  let datas = []
                  let chartKey = []
                  let chartVal = []
                  datas = res.data.visitTimeList
                  if (datas && datas.length > 0) {
                      datas.forEach(item => {
                          chartKey.push(item.time.substring(item.time.length - 5))
                          chartVal.push(item.count)
                      });
                  } else {
                      chartVal.push(0)
                  }
                  self.init_ecStaffAct(chartKey, chartVal)
              }
          }).then(res => {
      
          })
      },`

      本頁內容由塔燈網絡科技有限公司通過網絡收集編輯所得,所有資料僅供用戶學習參考,本站不擁有所有權,如您認為本網頁中由涉嫌抄襲的內容,請及時與我們聯系,并提供相關證據,工作人員會在5工作日內聯系您,一經查實,本站立刻刪除侵權內容。本文鏈接:http://www.webpost.com.cn/25255.html
      相關小程序
       八年  行業經驗

      多一份參考,總有益處

      聯系深圳網站公司塔燈網絡,免費獲得網站建設方案及報價

      咨詢相關問題或預約面談,可以通過以下方式與我們聯系

      業務熱線:余經理:13699882642

      Copyright ? 2013-2018 Tadeng NetWork Technology Co., LTD. All Rights Reserved.    

      国产成人精品综合在线观看