您的位置:首页 > 教育 > 锐评 > 新疆小程序开发_北京网站优化推广收集_成品网站源码1688免费推荐_软件开发app制作公司

新疆小程序开发_北京网站优化推广收集_成品网站源码1688免费推荐_软件开发app制作公司

2025/3/24 14:44:09 来源:https://blog.csdn.net/m0_49629753/article/details/146448704  浏览:    关键词:新疆小程序开发_北京网站优化推广收集_成品网站源码1688免费推荐_软件开发app制作公司
新疆小程序开发_北京网站优化推广收集_成品网站源码1688免费推荐_软件开发app制作公司
<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><title>折线图</title>
</head>
<body><div id="app" style="width:100%;height:100%;"><div id="chart-container" style="width:1000px;height:800px;"></div></div><script src="./vue.js"></script><script src="./echarts.js"></script><script src="./sales.js"></script><script>Vue.createApp({data(){return{salesData:salesData,salesCount:[]}},created(){this.salesData.forEach(data => {let item = this.salesCount.find(ele => ele.name==data.storeName)if(item){item.count++} else {this.salesCount.push({name:data.storeName,count:1})}});console.log(this.salesCount)},mounted(){var chartDom = document.getElementById("chart-container");var myChart = echarts.init(chartDom);var option = {title:{text : "门店数量",left : "center"},tooltip:{trigger:"item"},xAxis:[{type:"category",data:this.salesCount.map(data => data.name),}],yAxis:[{type:"value"}],series:[{name:"hah",type:"line",data:this.salesCount.map(data => data.count)}]};option && myChart.setOption(option)},methods:{}}).mount('#app');</script>
</body>
</html>

饼图:

<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><title>饼图</title>
</head>
<body><div id="app" style="width:100%; height:100%;"><div id="chart-container" style="width:500px; height:400px;"></div></div><script src="./vue.js"></script><script src="./echarts.js"></script><script src="./sales.js"></script><script>Vue.createApp({data() {return {salesData:salesData,salesCount: []}},created() {this.salesData.forEach(data => {if (data.productType == "家具产品") {let item = this.salesCount.find(ele => ele.name == data.storeName)if(item) {item.value++} else {this.salesCount.push({name:data.storeName,value:1});}}})console.log(this.salesCount);},mounted() {var chartDom = document.getElementById("chart-container");var myChart = echarts.init(chartDom);var option = {title:{text:"家具产品门店数",subtext:'',left:"center"},tooltip:{trigger:"item",formatter:'{a} <br/> {b}:{c}({d}%)'},legend:{orient:"vertical",right:"right",top:"middle"},series:[{name:"direct",type:"pie",data:this.salesCount,}]};option && myChart.setOption(option);},methods: {}}).mount('#app');</script></body>
</html>

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com