Echarts和JSTL、EL标签的混合使用
示例代码:
<c:if test="${empty sessionScope.taData}"> <jsp:forward page="TempServlet"></jsp:forward> </c:if> <c:set var="taData" value="${sessionScope.taData}"></c:set> <script> var ctdata=new Array(); var daydata=new Array(); </script> <c:forEach var="t" items="${taData}" varStatus="status"> <script> ctdata.push("${t.ct}"); daydata.push("${t.day}") </script> </c:forEach> <div id="main" style="width: 1024px; height: 800px;"></div> <script> var myChart = echarts.init(document.getElementById('main')); option = { xAxis: { type: 'category', data: daydata }, yAxis: { type: 'value' }, series: [{ data: ctdata, type: 'line', smooth: true }] }; myChart.setOption(option); </script> <c:remove var="taData" />
本博客文章未经许可,禁止转载和商业用途!
如有疑问,请联系: 2083967667@qq.com