🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
数据处理函数里写 最下面 路径:D:\ireport365\ireport365.war\js\enduser\designer\vs-component-echarts.js ~~~ // 自动轮播 // console.log(component.config) if(component.config.playBtn){ var timeTicket = null var luntime = 0; var num = component.config.chartConfig.series[0].data.length; timeTicket && clearInterval(timeTicket); // console.log(num) timeTicket = setInterval(function() { component.context.chart.dispatchAction({ type: 'downplay', seriesIndex: 0 }); component.context.chart.dispatchAction({ type: 'highlight', seriesIndex: 0, dataIndex: luntime % num }); component.context.chart.dispatchAction({ type: "showTip", seriesIndex: 0, dataIndex: luntime % num }) luntime++; }, component.config.playTime); }else{ clearInterval(timeTicket); } ~~~ 面板配置 ~~~ // 自动播放 chartCategory.groups.push({ title: { text: "自动播放" }, elements: [{ title: "播放开关", type: "switch", bind: "playBtn", on: vsLang.on, off: vsLang.off }, { title: "时间间隔(ms)", type: "configSlide", bind: "playTime", config: { slideEnd: 100000 } }] }); ~~~ 监听设置 ~~~ // 自动播放 scope.$watch("component.config.playBtn", function(newValue, oldValue) { if (newValue != null && (oldValue == null || oldValue !== newValue)) { var option = component.config.chartConfig; if (component.config.playBtn == null) { component.config.playBtn = false; } component.config.playBtn = newValue; scope.component.context.chart.setOption(option, true); } }); scope.$watch("component.config.playTime", function(newValue, oldValue) { if (newValue != null && (oldValue == null || oldValue !== newValue)) { var option = component.config.chartConfig; if (component.config.playTime == null) { component.config.playTime = 0; } component.config.playTime = parseInt(newValue); scope.component.context.chart.setOption(option, true); } }); // end ~~~ 4 在饼图 和 条形图 数据函数里添加 路径:D:\ireport365\ireport365.war\WEB-INF\classes\report-resource\design.js ~~~ // 自动轮播 // console.log(component.config) if(component.config.playBtn){ var timeTicket = null var luntime = 0; var num = component.config.chartConfig.series[0].data.length; timeTicket && clearInterval(timeTicket); // console.log(num) timeTicket = setInterval(function() { component.context.chart.dispatchAction({ type: 'downplay', seriesIndex: 0 }); component.context.chart.dispatchAction({ type: 'highlight', seriesIndex: 0, dataIndex: luntime % num }); component.context.chart.dispatchAction({ type: "showTip", seriesIndex: 0, dataIndex: luntime % num }) luntime++; }, component.config.playTime); }else{ clearInterval(timeTicket); } ~~~