import histogram from "../option/columnarOption" const app = getApp() Component({ data: { showChart: true, sSpec:'', sPriceType:'', sEnergyType:'' }, // onShow() { // this.getTabBar().init(); // }, lifetimes:{ attached(){ this.getTrend() } }, methods: { getTrend(){ let sStartTime =wx.getStorageSync('newTime') || ''; let sEndTime = wx.getStorageSync('newTime') || ''; app.globalData.request({ action: 'getCheZhuCarSeriesRankingHome', sType:'Marketing', sStartTime: sStartTime, sEndTime:sEndTime, iPageIndex: "iPageIndex", iPageSize: "iPageSize", // sSpec:this.data. , sPriceType:wx.getStorageSync('sPriceType') || '', sEnergyType:wx.getStorageSync('sEnergyType') || '' }).then(res => { let carName = [] let carValue=[] let carName1 = [] let carValue1=[] res.forEach(e =>{ carName.push(e.seriesname), carValue.push(e.salescount) }) let a=0 for(let i=carName.length; i>0;i--){ a++ carName1.push(carName[i-1]) carValue1.push(carValue[i-1]) } this.setData({ brandOption: histogram(carName1,carValue1,'#0084FF',false) }) })}, priceSel(e){ this.setData({ intervalSel: e.currentTarget.dataset.index }) } } })