天猫实时数据直播
2025-04-17|11:33|发布在分类 / 引流推广| 阅读:0
2025-04-17|11:33|发布在分类 / 引流推广| 阅读:0
// 初始化图表var chart = echarts.init(document.getElementById(chart));// 选项var option = {title: {text: 天猫实时数据直播},tooltip: {trigger: axis},legend: {data: [成交额, 客单价, 下单人数]},grid: {left: 3%,right: 4%,bottom: 3%,containLabel: true},toolbox: {feature: {saveAsImage: {}}},xAxis: {type: category,boundaryGap: false,data: [00:00, 01:00, 02:00, 03:00, 04:00, 05:00, 06:00, 07:00, 08:00, 09:00, 10:00, 11:00, 12:00, 13:00, 14:00, 15:00, 16:00, 17:00, 18:00, 19:00, 20:00, 21:00, 22:00, 23:00]},yAxis: {type: value},series: [{name: 成交额,type: line,stack: Total,data: [120, 132, 101, 134, 90, 230, 210, 182, 191, 234, 290, 330, 310, 314, 210, 182, 191, 234, 290, 330, 310, 314, 210, 120]},{name: 客单价,type: line,stack: Total,data: [20, 12, 21, 14, 19, 23, 21, 18, 19, 23, 29, 33, 31, 31, 21, 18, 19, 23, 29, 33, 31, 31, 21, 20]},{name: 下单人数,type: line,stack: Total,data: [10, 11, 9, 12, 8, 15, 14, 12, 13, 15, 19, 21, 20, 20, 15, 12, 13, 15, 19, 21, 20, 20, 15, 10]}]};// 设置图表选项chart.setOption(option);// 模拟实时数据setInterval(function () {var now = new Date();var hour = now.getHours();var minute = now.getMinutes();var second = now.getSeconds();// 生成新的数据var newData = [Math.round(Math.random() 1000),Math.round(Math.random() 100),Math.round(Math.random() 100)];// 添加新数据chart.addData([[0, newData[0]],[1, newData[1]],[2, newData[2]]]);// 移除旧数据if (second % 10 === 0) {chart.shiftData(1);}}, 1000);
这个问题还有疑问的话,可以加幕.思.城火星老师免费咨询,微.信号是为: msc496。
推荐阅读:
更多资讯请关注幕 思 城。

微信扫码回复「666」
别默默看了 登录\ 注册 一起参与讨论!