注意事项"/>
React 之使用echar注意事项
最好是放在.then里面,不然数据不会响应式
http({url:"physical/allSchedule",}).then(res=>{if(res.code === 200){// 调用store里面的和登录相关的toLogin函数console.log('查询所有体检病人数据',res.data);// setData(newData)let newWeek=formatWeek(new Date())console.log('newWeek',newWeek);res.data.filter((item,index)=>{let newDate=oDate(item.sDate).split(' ')[0]// console.log('newDate',newDate);for(let i=0;i<newWeek.length;i++){let weekDay=newWeek[i].split(' ')[0]let str=weekDay.split('/')[0]+'-'+weekDay.split('/')[1]+'-'+weekDay.split('/')[2]// console.log(weekDay);// console.log(str);if(newDate==str){// console.log('jin');myData[i]+=1}}})console.log('myData',myData);let orderNum = echarts.init(document.getElementById("orderNum"));// echarts仅有一个方法init,执行init时传入一个具备大小orderNum.setOption({title: {text: '近日挂号预约情况',},grid: {left: '4%',bottom: '2%',top:'24%',containLabel: true},xAxis: [{name:'日期',type: 'category',data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],axisTick: {alignWithLabel: true},nameGap:'10'}],yAxis: [{name:'预约人次',type: 'value',nameGap:'25'}],series: [{name: 'Direct',type: 'bar',barWidth: '20%',data: myData,itemStyle: {barBorderRadius: [6, 6, 0, 0],color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [{ offset: 0, color: '#FDFEFF' },{ offset: 0.5, color: '#85B7FC' },{ offset: 1, color: '#0772FF' }])},}]})}})
更多推荐
React 之使用echar注意事项
发布评论