dev
liuyongli 3 years ago
parent b6c2538b24
commit b5f669d21b

@ -9,6 +9,11 @@ Component({
lifetimes: { lifetimes: {
attached() { attached() {
wx.showToast({
title: '加载中',
icon: 'loading',
duration: 300000
})
app.globalData.request({action: 'getEventsListH', sType: 'Home', sTimeType: 3}).then(res => { app.globalData.request({action: 'getEventsListH', sType: 'Home', sTimeType: 3}).then(res => {
const arr = [] const arr = []
res.forEach(ele => { res.forEach(ele => {
@ -24,7 +29,10 @@ Component({
}) })
this.setData({ this.setData({
questes: arr, questes: arr,
}) })
setTimeout(() =>{
wx.hideToast();
},500)
}) })
}, },
}, },

@ -47,7 +47,7 @@ Component({
arr1.push(ele.value) arr1.push(ele.value)
}) })
this.setData({ this.setData({
brandOption: histogram(arr,arr1,"#20CC62") brandOption: histogram(arr,arr1,"#0084FF")
}) })
setTimeout(() =>{ setTimeout(() =>{
wx.hideToast(); wx.hideToast();

@ -11,8 +11,8 @@ const ds=[]
// [3123, 2313, 313, 4355, 1490, 2900, 2310], // [3123, 2313, 313, 4355, 1490, 2900, 2310],
// [1400, 5434, 1544, 533, 1454, 1900, 3310], // [1400, 5434, 1544, 533, 1454, 1900, 3310],
// [1400, 5434, 1544, 533, 1454, 1900, 3310],] // [1400, 5434, 1544, 533, 1454, 1900, 3310],]
const data=['微博','其他','短视频','微信','APP','论坛','新闻'] // const data=['微博','其他','短视频','微信','APP','论坛','新闻']
// const data = [] const data = []
const color2=['#FF4852','#FF6E25','#FFBF00','#20CC62','#00D6D6','#00AAFF','#7257FF'] const color2=['#FF4852','#FF6E25','#FFBF00','#20CC62','#00D6D6','#00AAFF','#7257FF']
Component({ Component({
@ -30,23 +30,33 @@ Component({
attached() { attached() {
app.globalData.request({action: 'getHomeBrandSourceType0528', sType: 'Home', sTimeType: 34, sQueryType: 2}).then(res => { app.globalData.request({action: 'getHomeBrandSourceType0528', sType: 'Home', sTimeType: 34, sQueryType: 2}).then(res => {
const arr = [] const arr = []
const arr1=[]
const arr2=[]
const arr3=[]
const arr4=[]
res.forEach(ele => { res.forEach(ele => {
let ol = { // let ol = {
dx:ele.key // dx:ele.key
} // }
arr.push(ele.key)
ele.value.forEach(val =>{ ele.value.forEach(val =>{
let obj = { arr1.push(val.value)
ds:val.value, arr2.push(val.key)
data:val.key
}
arr.push(obj)
}) })
arr.push(ol) // arr.push(ol)
}) })
// for (let index = 0; index < 7; index++) {
// arr3.push(arr2[index])
// }
for (let index = 0; index < 7; index++) {
arr3.push(arr2[index])
}
this.setData({ this.setData({
brandOption: arr, brandOption:sHistogram(arr,arr1,arr3,color2),
}) })
console.log('111',arr) console.log('111',arr)
console.log('111',arr1)
console.log('111',arr3)
}) })
}, },
}, },

@ -47,7 +47,7 @@ export default function histogram(dx=[],ds=[],color1='',direction=true) {
axisLabel: { axisLabel: {
color: '#999999',//x轴文本颜色 color: '#999999',//x轴文本颜色
textStyle: { textStyle: {
fontSize : 9 fontSize : 8
} }
} }
@ -64,15 +64,15 @@ export default function histogram(dx=[],ds=[],color1='',direction=true) {
axisLabel: { axisLabel: {
color: '#999999',//y轴文本颜色 color: '#999999',//y轴文本颜色
textStyle: { textStyle: {
fontSize : 9 fontSize : 8
} },
}, },
splitLine: { //分割线 splitLine: { //分割线
// lineStyle:{ // lineStyle:{
// // color:"#2d3436" // // color:"#2d3436"
// } // }
show: true, show: true,
lineStyle: { lineStyle: {
type: 'dashed', type: 'dashed',
color: '#E8E8E8', color: '#E8E8E8',
} }
@ -92,7 +92,13 @@ export default function histogram(dx=[],ds=[],color1='',direction=true) {
color: '#999999',//y轴文本颜色 color: '#999999',//y轴文本颜色
textStyle: { textStyle: {
fontSize : 9 fontSize : 9
} },
formatter:(value) => {
if(value >= 10000){
value = (value / 10000) + '万';
}
return value;
}
}, },
splitLine: { //分割线 splitLine: { //分割线
// lineStyle:{ // lineStyle:{
@ -127,10 +133,11 @@ export default function histogram(dx=[],ds=[],color1='',direction=true) {
series:{ series:{
type: 'bar', type: 'bar',
data: ds, data: ds,
barWidth : 24,
stack:"Search Engine", stack:"Search Engine",
emphasis: {//折线图的高亮状态。 emphasis: {//折线图的高亮状态。
focus: "series",//聚焦当前高亮的数据所在的系列的所有图形。 focus: "series",//聚焦当前高亮的数据所在的系列的所有图形。
}, },
itemStyle: { itemStyle: {
normal:{ normal:{
color: color1, color: color1,

@ -83,7 +83,7 @@ export default function sHistogram(dx=[],ds=[],data=[],color2=[]) {
function columar(data=[],ds=[],color2=[]){ function columar(data=[],ds=[],color2=[]){
// MS判断多条数据还是单条数据 true为单条false为多条 // MS判断多条数据还是单条数据 true为单条false为多条
let list=[] let list=[]
for (let i = 0; i < color2.length; i++) { for (let i = 0; i < data.length; i++) {
// MS? // MS?
// list.push({ // list.push({
// type: 'bar', // type: 'bar',
@ -102,7 +102,7 @@ function columar(data=[],ds=[],color2=[]){
// } // }
// }) : // }) :
list.push({ list.push({
name: data[i].name, name: data[i],
type: 'bar', type: 'bar',
barWidth : 24, barWidth : 24,
data: ds[i], data: ds[i],

Loading…
Cancel
Save