React 之使用echar注意事项

编程入门 行业动态 更新时间:2024-10-26 07:36:48

React 之使用echar<a href=https://www.elefans.com/category/jswz/34/1768820.html style=注意事项"/>

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注意事项

本文发布于:2023-06-12 23:59:07,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/670270.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:注意事项   React   echar

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!