wylyl22 3 years ago
parent 1b3a1fed98
commit 889cd97e64

@ -27,12 +27,25 @@ Component({
}).then(res => {
let carName = []
let carValue=[]
let carName1 = []
let carValue1=[]
res.forEach(e =>{
carName.push(e.seriesname),
carValue.push(e.salescount)
})
console.log(carValue)
console.log(carName)
let a=0
for(let i=carName.length; i>0;i--){
a++
carName1.push(carName[i-1])
carValue1.push(carValue[i-1])
}
console.log(carValue1)
console.log(carName1)
console.log(a)
this.setData({
brandOption: histogram(carName,carValue,'#0084FF',false)
brandOption: histogram(carName1,carValue1,'#0084FF',false)
})
})},
priceSel(e){

@ -1,5 +1,5 @@
<view>
<view class="brand_tu">
<c-echars showChart="{{showChart}}" canvasId="chart-canvas" chartId="chartbar" chartOption="{{brandOption}}" height="100%"></c-echars>
<c-echars showChart="{{showChart}}" canvasId="chart-canvas" chartId="chartbar" chartOption="{{brandOption}}" height="100%"></c-echars>
</view>
</view>

@ -1,5 +1,4 @@
import histogram from "../../option/columnarOption"
const app = getApp()
Component({
data: {
@ -59,7 +58,7 @@ Component({
carCount.push(e.salescount)
});
this.setData({
brandOption: histogram(carName, carCount, '#0084FF'),
brandOption: histogram(carName, carCount,'#0084FF'),
})
resolve(true)
}).catch(() => {

@ -1,4 +1,5 @@
// 单柱状
import {doStr} from "./text"
export default function histogram(dx = [], ds = [], color1 = '', direction = true) {
// direction true为垂直 false为水平
return {
@ -13,9 +14,9 @@ export default function histogram(dx = [], ds = [], color1 = '', direction = tru
dataZoom: direction?[{ //添加X轴滚动条
type: 'inside',
show: false,
start: 10,
end: 40,
handleSize: 5
start: 0,
end:30 ,
handleSize: 30
}]:[{
type:"inside",
show:false,
@ -53,6 +54,10 @@ export default function histogram(dx = [], ds = [], color1 = '', direction = tru
},
axisLabel: {
color: '#999999', //x轴文本颜色
formatter:(value)=>{
let res=doStr(value,4)
return res
},
textStyle: {
fontSize: 8
}
@ -124,7 +129,11 @@ export default function histogram(dx = [], ds = [], color1 = '', direction = tru
show: false, //去除轴线
},
axisLabel: {
color: '#999999', //x轴文本颜色
color: '#999999', //y轴文本颜色
formatter:(value)=>{
let res=doStr(value,4)
return res
},
textStyle: {
fontSize: 9
}
@ -133,7 +142,7 @@ export default function histogram(dx = [], ds = [], color1 = '', direction = tru
series: {
type: 'bar',
data: ds,
barWidth: 24,
barWidth: direction?24:12,
stack: "Search Engine",
emphasis: { //折线图的高亮状态。
focus: "series", //聚焦当前高亮的数据所在的系列的所有图形。

@ -0,0 +1,19 @@
export function doStr(str, n) {
let totalCount = 0;
let txt = "";
for (var i = 0; i < str.length; i++) {
let c = str.charCodeAt(i);
if ((c >= 0x0001 && c <= 0x007e) || (0xff60 <= c && c <= 0xff9f)) {
totalCount++;
} else {
totalCount += 2;
}
if (totalCount <= n) {
txt += str[i];
} else {
txt += '...';
return txt
}
}
return txt;
}

@ -23,7 +23,7 @@ Component({
overlay: true,
showChart: true,
//图表
positiveOption:brokenLine(dName,dValue,dColor,data),
// positiveOption:brokenLine(dName,dValue,dColor,data),
imageUrl: getApp().globalData.imageUrl,
date:'2021-01',
accountIndex:0,
@ -43,9 +43,7 @@ Component({
let sStartTime = wx.getStorageSync("sStartTime") || '';
let sEndTime = wx.getStorageSync("sEndTime") || '';
this.getData(sTimeType, sStartTime, sEndTime);
this.getTrend();
}
}
},
onLoad() {
let pages = getCurrentPages();
@ -55,14 +53,14 @@ Component({
id: options.id
})
},
onShow() {
onShow() {
this.getData().then(() => {
this.getLikeData()
})
},
//页面上拉触底事件的处理函数
onReachBottom: function () {
console.log("上拉触底事件")
// console.log("上拉触底事件")
let that = this
if (!that.data.loadMore) {
that.setData({
@ -81,7 +79,7 @@ Component({
wx.showToast({
title: '加载中',
icon: 'loading',
duration: 300000
duration: 3000
})
this.getAmount(sTimeType, sStartTime, sEndTime),
this.getTrend()
@ -90,7 +88,6 @@ Component({
},500)
},
getTrend(){
let obj = {
action: 'getCheZhuCarSeriesRankingHome',
sType:'Marketing',
@ -122,8 +119,6 @@ Component({
this.setData({
ranking:arr
})
console.log('22',arr)
}).then(res =>{
if (res && res.length > 0) {
iPageIndex++;
@ -188,7 +183,7 @@ Component({
}
arr.push(obj)
})
console.log(arr)
// console.log(arr)
this.setData({
grades1:arr,
})
@ -201,8 +196,8 @@ Component({
}else{
this.data.builds = e.detail.val
}
console.log(this.data.roomLevel)
console.log(this.data.builds)
// console.log(this.data.roomLevel)
// console.log(this.data.builds)
},
bindShowMsg(e){
var id=e.currentTarget.id
@ -245,7 +240,7 @@ Component({
var name=e.currentTarget.dataset.name.name
var value=e.currentTarget.dataset.name.value
wx.setStorageSync('sSpec',value)
console.log(value)
// console.log(value)
this.setData({
grade_name1:name,
select1:false
@ -320,7 +315,7 @@ Component({
})
},
bindAccountChange(e){
console.log('切换改变的值', e.detail.value);
// console.log('切换改变的值', e.detail.value);
this.setData({
accountIndex: e.detail.value
})
@ -328,9 +323,28 @@ Component({
//弹出框
popup(e) {
let duration = this.data.duration
let models=e.currentTarget.dataset.car
app.globalData.request({
action:"getCheZhuCarSeriesListHome",
sType:"Marketing",
sSeriesName:models}).then(res => {
const dataTime=[]
const dataCar=[]
for(let i=0;i<6;i++){
// console.log((res[i].sourcetime).substring(5,7))
if((res[i].sourcetime).substring(5,6)=="0"){
console.log((res[i].sourcetime).substring((res[i].sourcetime).length-1,(res[i].sourcetime).length))
// dataTime.push()
}
dataCar.push(res[i].carseries)
}
})
this.setData({
show: true,
duration
duration,
})
},
exit() {

@ -81,7 +81,7 @@
<view class="ptitle">品牌名称</view>
<view class="xtitle2">销量</view>
</view>
<view class="ranks" wx:for="{{ranking}}" wx:key="index" data-ranking='{{item}}'>
<view class="ranks" wx:for="{{ranking}}" wx:key="index" data-ranking='{{item}}'>
<view style="display: flex;">
<view class="dis_image">
<image class="rank_num" wx:if="{{index === 0}}" src="{{imageUrl}}/img_diyi.png"></image>
@ -104,7 +104,7 @@
</view>
<view style="width: 30%;">
<view class="volume">{{item.volume}}</view>
<view class="trend" bindtap="popup" data-position="bottom">
<view class="trend" data-car="{{item.media}}" bindtap="popup" data-position="bottom">
<van-icon size="16px" name="arrow" />
<view>销量趋势</view>
</view>
@ -116,7 +116,7 @@
<view class="loading" hidden="{{!loadMore}}">正在载入更多...</view>
<view class="loading" hidden="{{!loadAll}}">已加载全部</view>
</view>
<page-container show="{{show}}" duration="{{duration}}" position="{{position}}" close-on-slide-down="{{false}}" custom-style="height:50%">
<!-- <page-container show="{{show}}" duration="{{duration}}" position="{{position}}" close-on-slide-down="{{false}}" custom-style="height:50%">
<view class="detail-page">
<view style="display: flex;">
<view class="qushi">销量趋势</view>
@ -129,4 +129,24 @@
<c-echars force-use-old-canvas="true" showChart="{{showChart}}" canvasId="tonalitybar-canvas" chartId="tonalitybar" chartOption="{{positiveOption}}" width="200rpx"height='500rpx' ></c-echars>
</view>
</view>
</page-container>
</page-container> -->
<van-popup
show="{{ show }}"
position="bottom"
custom-style="height: 50%;"
bind:close="onClose"
>
<view class="detail-page">
<view style="display: flex;">
<view class="qushi">销量趋势</view>
<view class="tubiao" bindtap="exit">
<van-icon name="cross"/>
</view>
</view>
<view class="pinlai">宏光MINIEV销量趋势</view>
<view class="brand_tu">
<c-echars flocShow="{{false}} "showChart="{{showChart}}" canvasId="tonalitybar-canvas" chartId="tonalitybar" chartOption="{{positiveOption}}" width="100%"height='100%' ></c-echars>
</view>
</view>
</van-popup>

Loading…
Cancel
Save