dev
liuyongli 3 years ago
commit b00d9bf7a1

@ -64,27 +64,6 @@ Component({
sEndTime:sEndTime sEndTime:sEndTime
} }
app.globalData.request(obj).then(res=>{ app.globalData.request(obj).then(res=>{
// const dt=[]
// const time=[]
// const lValue=[]
// const lName=[]
// res.forEach(e=>{
// // dt.push(e)
// time.push(e.Time)
// e.Data.forEach(ee=>{
// let l={
// ts:e.Time,
// value:ee.value,
// key:ee.key
// }
// lValue.push(l)
// time.push(
// lName.push(ee.value,ee.key)
// )
// })
// })
let arr = [] let arr = []
let bar = [[],[],[],[],[],[],[]] let bar = [[],[],[],[],[],[],[]]
res.forEach(ele => { res.forEach(ele => {
@ -96,8 +75,8 @@ Component({
this.setData({ this.setData({
dataOption:brokenLine(dName,bar,dColor,arr), dataOption:brokenLine(dName,bar,dColor,arr),
}) })
})
})
}, },
// 入库数据量 // 入库数据量

@ -1,26 +1,9 @@
const app = getApp(); const app = getApp();
import sHistogram from "../../option/sColumnarOption" import sHistogram from "../../option/sColumnarOption"
// const dx=['长安','大众','丰田','吉利','哈佛'] const color2=['#FF4852','#FF6E25','#FFBF00','#20CC62','#00D6D6','#00AAFF','#7257FF','#7257FF']
const dx = []
const ds=[]
// [1400, 2400, 1000, 2800, 1000, 400, 1200],
// [100, 2000, 1500, 1800, 1490, 900, 310],
// [1400, 200, 150, 1340, 1600, 1900, 1310],
// [6545, 3456, 1500, 4500, 1700, 1900, 3100],
// [3123, 2313, 313, 4355, 1490, 2900, 2310],
// [1400, 5434, 1544, 533, 1454, 1900, 3310],
// [1400, 5434, 1544, 533, 1454, 1900, 3310],]
// const data=['微博','其他','短视频','微信','APP','论坛','新闻']
const data = []
const color2=['#FF4852','#FF6E25','#FFBF00','#20CC62','#00D6D6','#00AAFF','#7257FF']
Component({ Component({
data: { data: {
showChart: true, showChart: true,
brandOption:sHistogram(dx,ds,data,color2),
modelOption: sHistogram(dx,ds,data,color2)
}, },
onShow() { onShow() {
this.getTabBar().init(); this.getTabBar().init();
@ -28,44 +11,71 @@ Component({
}, },
lifetimes: { lifetimes: {
attached() { attached() {
app.globalData.request({action: 'getHomeBrandSourceType0528', sType: 'Home', sTimeType: 34, sQueryType: 2}).then(res => { let sTimeType = wx.getStorageSync("sTimeType") || 34;
let sStartTime = wx.getStorageSync("sStartTime") || '';
let sEndTime = wx.getStorageSync("sEndTime") || '';
this.getData(sTimeType, sStartTime, sEndTime);
},
},
methods: {
changeTime(e){
let sTimeType = e.detail.sTimeType;
let sStartTime = e.detail.sStartTime;
let sEndTime = e.detail.sEndTime;
this.getData(sTimeType, sStartTime, sEndTime);
},
getData(sTimeType, sStartTime, sEndTime){
wx.showToast({
title: '加载中',
icon: 'loading',
duration: 300000
})
app.globalData.request({action: 'getHomeBrandSourceType0528', sType: 'Home', sTimeType: sTimeType, sStartTime: sStartTime,sEndTime: sEndTime,sQueryType: 1}).then(res => {
const arr = [] const arr = []
const arr1=[] const arr1=[[],[],[],[],[],[],[],[]]
const arr2=[] const arr2=[]
const arr3=[]
const arr4=[]
res.forEach(ele => { res.forEach(ele => {
// let ol = {
// dx:ele.key
// }
arr.push(ele.key) arr.push(ele.key)
ele.value.forEach(val =>{ ele.value.forEach(e=>{
arr1.push(val.value) arr2.push(e.key)
arr2.push(val.key) })
for(let i=0;i<ele.value.length;i++){
arr1[i].push(ele.value[i].value)
}
}) })
// arr.push(ol) this.setData({
brandOption:sHistogram(arr,arr1,arr2,color2),
}) })
// for (let index = 0; index < 7; index++) { })
// arr3.push(arr2[index]) app.globalData.request({action: 'getHomeBrandSourceType0528', sType: 'Home', sTimeType: sTimeType, sStartTime: sStartTime,sEndTime: sEndTime, sQueryType: 2}).then(res => {
// } const arr = []
for (let index = 0; index < 7; index++) { const arr1=[[],[],[],[],[],[],[],[]]
arr3.push(arr2[index]) const arr2=[]
res.forEach(ele => {
arr.push(ele.key)
ele.value.forEach(e=>{
arr2.push(e.key)
})
for(let i=0;i<ele.value.length;i++){
arr1[i].push(ele.value[i].value)
} }
})
this.setData({ this.setData({
brandOption:sHistogram(arr,arr1,arr3,color2), modelOption:sHistogram(arr,arr1,arr2,color2),
}) })
console.log('111',arr) setTimeout(() =>{
console.log('111',arr1) wx.hideToast();
console.log('111',arr3) },500)
}) })
}, },
},
methods: {
priceSel(e){ priceSel(e){
this.setData({ this.setData({
intervalSel: e.currentTarget.dataset.index intervalSel: e.currentTarget.dataset.index
}) })
}, },
} }
}) })

@ -1,6 +1,6 @@
<view> <view>
<!-- 时间组件 --> <!-- 时间组件 -->
<time-component></time-component> <time-component bindchange="changeTime"></time-component>
<view class="brand"> <view class="brand">
<view class="text">品牌传播声量</view> <view class="text">品牌传播声量</view>
<view class="brand_tu"> <view class="brand_tu">

@ -14,7 +14,7 @@ export default function histogram(dx=[],ds=[],color1='',direction=true) {
show: false, show: false,
start: 50, start: 50,
end: 10, end: 10,
handleSize: 5 handleSize: 10
}], }],
// legend: { // legend: {
// x:'15', // x:'15',

@ -28,6 +28,13 @@ export default function sHistogram(dx=[],ds=[],data=[],color2=[]) {
top: 40, top: 40,
containLabel: true containLabel: true
}, },
dataZoom: [{ //添加X轴滚动条
type: 'inside',
show: false,
start: 50,
end: 10,
handleSize: 5
}],
yAxis: [ yAxis: [
{ {
type: 'value', type: 'value',
@ -40,7 +47,7 @@ export default function sHistogram(dx=[],ds=[],data=[],color2=[]) {
axisLabel: { axisLabel: {
color: '#999999',//y轴文本颜色 color: '#999999',//y轴文本颜色
textStyle: { textStyle: {
fontSize : 9 fontSize : 8
} }
}, },
splitLine: { //分割线 splitLine: { //分割线

Loading…
Cancel
Save