使用EVAL处理jqchart jquery 折线图返回数据无效的解(2)

<head> <!--[if IE]> <mce:script src="https://www.jb51.net/excanvas-compressed.js" mce_src="https://www.jb51.net/excanvas-compressed.js" type="text/javascript" ></mce:script> <![endif]--> <mce:script src="https://jsgt.org/lib/jquery/plugin/jqchart/sample/v003/lib/jquery-1.2.3.min.js" mce_src="https://jsgt.org/lib/jquery/plugin/jqchart/sample/v003/lib/jquery-1.2.3.min.js" type="text/javascript"></mce:script> <mce:script src="https://www.jb51.net/jquery.jqchart.js" mce_src="https://www.jb51.net/jquery.jqchart.js" type="text/javascript" charset="utf-8"></mce:script> </head><body> <canvas></canvas> <mce:script type="text/javascript"><!-- $(function(){ $.ajax({ url: "chartdata.html", type: "GET", success: function(cdata){ showDDChart(cdata); } }); function showDDChart(cdata){ var dd_chart = eval(cdata)[0]; var chartSetting={ config : { title : "", titleLeft: 70, labelX :dd_chart.labelX, //labelX :["外观设计","便携性","易用性","电池待机","摄像功能","变焦"], scaleY : {min: 0,max:10,gap:2}, width: 300+25, height: 125+50, paddingL : 10, paddingT : 10 }, //data: [[5,3,1,8,4,9]] data :dd_chart.data }; $('#canvasMyID').jQchart(chartSetting); } }); // --></mce:script> </body> </html>

OK,大功告成! 完整示例我会放到我的资源里。

好久都没有用jquery ajax了,拼json数据都有些生疏了。还是喜欢开发这种有逻辑性的工作....

您可能感兴趣的文章:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wgzdwz.html