1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173
| <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <script src="/static/js/echarts.js"></script> <script> window.onload=function (){ var chartObj=echarts.init(document.getElementById("main")) var chartObj2=echarts.init(document.getElementById("main2")) var chartObj3=echarts.init(document.getElementById("main3")) var chartObj4=echarts.init(document.getElementById("main4")) var chartObj5=echarts.init(document.getElementById("main5")) var option={ title:{ text:"折线图展示" }, legend:{}, tooltip:{ trigger:"item", formatted:"{a}<br>{b}{c}:{d}" }, xAxis:{ data:[{% for i in names%}"{{i.name}}",{% endfor%}] }, yAxis:{ type:"value" }, series:[{ type:"line", smooth:true, name:"值", data:[{% for i in names%}"{{i.value}}",{% endfor%}], itemStyle:{ normal:{ areaStyle:{} } } }] }; var option2={ title:{ text:"柱状图展示" }, legend:{}, tooltip:{ trigger:"item", formatted:"{a}<br>{b}{c}:{d}" }, xAxis:{ data:[{% for i in names%}"{{i.name}}",{% endfor%}] }, yAxis:{ type:"value" }, series:[{ type:"bar", name:"值", data:[{% for i in names%}"{{i.value}}",{% endfor%}], itemStyle:{ normal:{ areaStyle:{} } } }] }; var option3={ title:{ text:"饼图展示", left:"center" }, tooltip:{ trigger:"item" }, legend:{ orient:"vertical", left:"left" }, series:[{ name:"日期", type:"pie", radius:"50%", data:[{% for i in names%}{value:{{i.value}},name:"{{i.name}}"},{%endfor%}], emphasis:{ itemStyle:{ shadowBlur:10, shadowOffsetX:0, shadowColor:"rgba(0,0,0,0.5)" } } }] }; var option4={ title:{ text:"南丁格尔玫瑰图", left:"center" }, tooltip:{ trigger:"item" }, legend:{ orient:"vertical", left:"left" }, series:[{ name:"日期", type:"pie", radius:"50%", data:[{% for i in names%}{value:{{i.value}},name:"{{i.name}}"},{%endfor%}], roseType:"radius", emphasis:{ itemStyle:{ shadowBlur:10, shadowOffsetX:0, shadowColor:"rgba(0,0,0,0.5)" } } }] }; var option5 = { title:{ text:"散点图" }, tooltip:{ trigger:"item" }, xAxis: {}, yAxis: {}, series: [{ symbolSize: 20, data: [ [10.0, 8.04], [8.07, 6.95], [13.0, 7.58], [9.05, 8.81], [11.0, 8.33], [14.0, 7.66], [13.4, 6.81], [10.0, 6.33], [14.0, 8.96], [12.5, 6.82], [9.15, 7.20], [11.5, 7.20], [3.03, 4.23], [12.2, 7.83], [2.02, 4.47], [1.05, 3.33], [4.05, 4.96], [6.03, 7.24], [12.0, 6.26], [12.0, 8.84], [7.08, 5.82], [5.02, 5.68] ], type: 'scatter' }] }; chartObj.setOption(option) chartObj2.setOption(option2) chartObj3.setOption(option3) chartObj4.setOption(option4) chartObj5.setOption(option5) } </script> </head> <body> <div id="main" style="width:600px;height:600px"></div> <div id="main2" style="width:600px;height:600px"></div> <div id="main3" style="width:600px;height:600px"></div> <div id="main4" style="width:600px;height:600px"></div> <div id="main5" style="width:600px;height:600px"></div> </body> </html>
|