// 学生多元智能家长评估表(MISP) (function () { 'use strict' // 获取url var js = 'misp' var $script = $('script[src*="/lb/chart/' + js + '.js"]').last() var src = $script.attr('src') // 获取参数 var w = src.match(/[?&]w=([^&]+)/) var h = src.match(/[?&]h=([^&]+)/) var v = src.match(/[?&]v=([^&]+)/) // 处理参数 if (w === null || w.length < 1) { w = '100%' } else { w = w[1] + 'px' } if (h === null || h.length < 1) { h = 400 } else { h = h[1] } if (v === null || v.length < 1) { v = '' } else { v = v[1] } // 创建容器 var rnd = Math.random().toString().substring(2, 8) var div = '
' $script.after(div).remove() // 处理得分 var json = v.replace(/\|/g, ',').split(',') // 配置 var option = { grid: { left: 'left', containLabel: true, right: 15, bottom: 0 }, title: { text: '学生多元智能家长评估表(MISP)' }, tooltip: { trigger: 'axis', axisPointer: { type: 'shadow' } }, toolbox: { feature: { dataView: {}, magicType: { type: ['line'] }, restore: {}, saveAsImage: {} } }, xAxis: { axisLabel: { interval: 0 }, data: ['语言智能', '数学智能', '视觉—空间智能', '身体—运动智能', '音乐智能', '人际关系智能', '内省智能', '自然观察智能'] }, yAxis: { max: 10, splitNumber: 10 }, series: { name: '得分', type: 'bar', smooth: false, label: { show: true, position: 'top' }, markPoint: { data: [{ name: '最大值', type: 'max' }] }, markLine: { silent: true, data: [ { yAxis: 3, lineStyle: { color: '#b6a2de', opacity: 0.5 } }, { yAxis: 8, lineStyle: { color: '#b6a2de', opacity: 0.5 } } ] }, data: json } } // 绘制图表 $.ajax('/Scripts/echarts/theme/macarons.js', { dataType: 'script', cache: true, complete: function () { // console.log(JSON.stringify(option,null,2)); $('#chart-' + rnd).data({ option: option, theme: 'macarons' }) echarts.init(document.getElementById('chart-' + rnd), 'macarons').setOption(option) } }) })()