123456789101112131415 |
- {% macro get_chart(data,chart_id,table_height,table_width) %}
- <div id="chart_zone_{{chart_id}}" style="overflow: auto;height: {{table_height}};width:{{table_width}};float: left;">
- </div>
- <script type="text/javascript">
- // 基于准备好的dom,初始化echarts实例
- var _chart_{{chart_id}} = echarts.init(document.getElementById('chart_zone_{{chart_id}}'));
- var data_chart_{{chart_id}} = {{data|safe}};
- if(data_chart_{{chart_id}}){
- var data_chart_{{chart_id}} = (new Function("return " + data_chart_{{chart_id}}))();
- // 使用刚指定的配置项和数据显示图表。
- _chart_{{chart_id}}.setOption(data_chart_{{chart_id}});
- }
- </script>
- {% endmacro %}
|