We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js"></script> </head> <body> <div id="main" style="width: 600px;height:400px;"></div> <!-- 引入 ECharts 文件 --> <script type="text/javascript"> $.getScript("https://cdn.bootcdn.net/ajax/libs/echarts/5.0.0-alpha.2/echarts.common.min.js"); </script> <script type="text/javascript"> function EchartDraw() { // 基于准备好的dom,初始化echarts实例 var myChart = echarts.init(document.getElementById('main')); // 指定图表的配置项和数据 var option = { title: { text: 'ECharts 入门示例' }, tooltip: {}, legend: { data:['销量'] }, xAxis: { data: ["衬衫","羊毛衫","雪纺衫","裤子","高跟鞋","袜子"] }, yAxis: {}, series: [{ name: '销量', type: 'bar', data: [5, 20, 36, 10, 10, 20] }] }; // 使用刚指定的配置项和数据显示图表。 myChart.setOption(option); } // 如何每500ms判断一次? // setTimeout 似乎只能执行一次 for(var i=0;i<5;i++) { if(typeof echarts == "undefined") { setTimeout("EchartDraw()", 5000); continue; } else { EchartDraw(); break; } } </script> </body> </html>
The text was updated successfully, but these errors were encountered:
直接在 add_script 里手写 $.getScript 回调即可,不要用 add_linked_script
add_script
$.getScript
add_linked_script
Sorry, something went wrong.
No branches or pull requests
The text was updated successfully, but these errors were encountered: