123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198 |
- <!DOCTYPE HTML>
- <html>
- <head>
- <meta charset="utf-8">
- <meta name="renderer" content="webkit|ie-comp|ie-stand">
- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
- <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
- <meta http-equiv="Cache-Control" content="no-siteapp" />
- <!--[if lt IE 9]>
- <script type="text/javascript" src="${ctx}/assets/lib/html5.js"></script>
- <script type="text/javascript" src="${ctx}/assets/lib/respond.min.js"></script>
- <script type="text/javascript" src="${ctx}/assets/lib/PIE_IE678.js"></script>
- <![endif]-->
- <link rel="stylesheet" type="text/css" href="${ctx}/assets/static/h-ui/css/H-ui.min.css" />
- <link rel="stylesheet" type="text/css" href="${ctx}/assets/static/h-ui.admin/css/H-ui.admin.css" />
- <link rel="stylesheet" type="text/css" href="${ctx}/assets/lib/Hui-iconfont/1.0.7/iconfont.css" />
- <link rel="stylesheet" type="text/css" href="${ctx}/assets/lib/icheck/icheck.css" />
- <link rel="stylesheet" type="text/css" href="${ctx}/assets/static/h-ui.admin/skin/default/skin.css" id="skin" />
- <link rel="stylesheet" type="text/css" href="${ctx}/assets/static/h-ui.admin/css/style.css" />
- <script type="text/ecmascript" src="${ctx}/assets/lib/jquery/1.9.1/jquery.js"></script>
- <script type="text/javascript" src="${ctx}/assets/static/h-ui/js/H-ui.js"></script>
- <script type="text/javascript" src="${ctx}/assets/lib/layer/3.0.3/layer.js"></script>
- <link type="text/css" href="${ctx}/assets/lib/codemirror/lib/codemirror.css" rel="stylesheet" />
- <script type="text/javascript" src="${ctx}/assets/lib/codemirror/lib/codemirror.js"></script>
- <script src="${ctx}/assets/lib/codemirror/mode/xml/xml.js"></script>
- <link rel="stylesheet" type="text/css" href="${ctx}/assets/lib/webuploader/0.1.5/webuploader.css">
- <script type="text/javascript" src="${ctx}/assets/lib/webuploader/0.1.5/webuploader.js"></script>
- <link rel="stylesheet" type="text/css" media="screen" href="${ctx}/assets/lib/jqueryui/jquery-ui.css" />
- <link rel="stylesheet" type="text/css" media="screen" href="${ctx}/assets/lib/jqgrid/css/ui.jqgrid.css" />
- <script type="text/ecmascript" src="${ctx}/assets/lib/jqueryui/jquery-ui.js"></script>
- <script type="text/ecmascript" src="${ctx}/assets/lib/jqgrid/js/i18n/grid.locale-cn.js"></script>
- <script type="text/ecmascript" src="${ctx}/assets/lib/jqgrid/js/jquery.jqGrid.min.js"></script>
- <script type="text/ecmascript" src="${ctx}/assets/lib/echarts/3.2.3/echarts.min.js"></script>
- <script type="text/javascript" src="${ctx}/assets/js/base.js"></script>
- <!--[if IE 6]>
- <script type="text/javascript" src="${ctx}/assets/lib/DD_belatedPNG_0.0.8a-min.js" ></script>
- <script>DD_belatedPNG.fix('*');</script>
- <![endif]-->
- <title>我的桌面</title>
- </head>
- <body>
-
- </body>
- </html>
- <script type="text/javascript">
- var title='${title}';
- var num='${num}';
- var question='${question}';
- var json = JsonSort(question,'obj');//排序
- var name1="条数 ";
- /***添加标题 (调查问卷名称)
- **/
- var divs = "<div style=' font-size:64px;' align='center'>"+title+"</div>";//定义DIV的样式
- $("body").append(divs);//需要添加在哪个位置
- //var json=eval(jsondata);
- var obj = JSON.parse(question);
- // 基于准备好的dom,初始化echarts实例
- for(var i=0;i<num;i++){
-
- var type=obj[i].type;
- var title1=obj[i].title;
- var leg= title1.length;
-
-
- var data= new Array(leg);//['巴西','印尼'];
- var dataval= new Array(leg);
- var strdataval="[";
- for(var j=0; j<leg;j++){
- data[j]=title1[j].name;
- dataval[j]=title1[j].value;
- if(type=="填空"||type=="问答"){
- data[j]=title1[j].name+"("+title1[j].type+")";
- /* if(title1[j].obj=j){
- data[j]=title1[j].type;
- }
-
- strdataval=strdataval+"{name:'"+title1[j].name+"',type: 'bar',stack: '总量',label: {normal: {show: true,position: 'insideRight'}},data: [320, 302]}'"
-
- // strdataval= [{name: '填空',type: 'bar',stack: '总量',label: {normal: {show: true,position: 'insideRight'}},data: [2, 4]},{ name: '上班',type: 'bar',stack: '总量',label: { normal: {show: true,position: 'insideRight' }},data: [0,1]}];
- */
-
- }
-
- }
-
- //if(type=="单选"||type=="多选"){
- // var div = "<div style=' font-size:32px;margin:30px 0 -30px 60px' >"+obj[i].name+" </div>";//定义DIV的样式
- //$("body").append(div);//需要添加在哪个位置
-
-
- var div = "<div id='main"+i+"' style=' width:80% ;height:80% ;min-width:400px;min-height:300px;margin:0 0 0 30px' > </div>";//定义DIV的样式
- $("body").append(div);//需要添加在哪个位置
- $("body").append("<br>");//需要添加在哪个位置
- $("body").append("<br>");//需要添加在哪个位置
- $("body").append("<br>");//需要添加在哪个位置
- var myChart = echarts.init(document.getElementById('main'+i));
-
-
- // 指定图表的配置项和数据
- var option = {
- title: {
- text: obj[i].name,
- },
- barMaxWidth:30,//最大宽度
- itemStyle: {
- normal: {
- color: function(params) {
- //首先定义一个数组
- var colorList = [
- '#C33531','#EFE42A','#64BD3D','#EE9201','#29AAE3',
- '#B74AE5','#0AAF9F','#E89589'
- ];
- return colorList[params.dataIndex]
- },
- //以下为是否显示
- label: {
- show: false
- }
- }
- } ,//颜色
- tooltip: {
- trigger: 'axis',
- axisPointer: {
- type: 'shadow'
- }
- }, toolbox: {
- show : true,
- feature : {
- mark : {show: true},
- dataView : {show: true, readOnly: false},
-
- restore : {show: true},
- saveAsImage : {show: true}
- }
- },
- grid: {
- left: '3%',
- right: '4%',
- bottom: '3%',
- containLabel: true
- },
- xAxis: {
- type: 'value',
- boundaryGap: [0, 0.01]
- },
- yAxis: {
- type: 'category',
- data: data
- },
- series: [
- {
- name: name1,
- type: 'bar',
- data: dataval
- }
-
- ]
- };
- // 使用刚指定的配置项和数据显示图表。
- myChart.setOption(option);
-
-
-
- }
- /*
- @function JsonSort 对json排序
- @param json 用来排序的json
- @param key 排序的键值
- */
- function JsonSort(json,key){
- //console.log(json);
- for(var j=1,jl=json.length;j < jl;j++){
- var temp = json[j],
- val = temp[key],
- i = j-1;
- while(i >=0 && json[i][key]>val){
- json[i+1] = json[i];
- i = i-1;
- }
- json[i+1] = temp;
-
- }
- //console.log(json);
- return json;
- }
-
-
-
- </script>
|