Edit D:\xinhaisoft\crisis_new\Scripts\chart.js
/* * ECharts??? * ??????????(QQ33080907) * ????????2020.05.26 * ?????????????????????????????????? */ /* ????<head></head>????????charts.common??charts.simple??charts???????? <script src="/Scripts/jquery.min.js"></script> <script src="/Scripts/echarts/echarts.min.js"></script> <script src="/Scripts/echarts/echarts.common.min.js"></script> <script src="/Scripts/echarts/echarts.simple.min.js"></script> ??????????????????????? var echartsScript = document.createElement('script') echartsScript.src = '/scripts/chart.js?e=chart&m=1&r=45&a=1&x=' + x + '&v=' + v.join('|') document.body.appendChild(echartsScript) */ (function () { 'use strict' // ???url var $script = $('script[src*="/chart.js"]').last() var src = $script.attr('src') // ?????? var e = src.match(/[?&]e=([^&]+)/) // ??????ID??????????? var c = src.match(/[?&]c=([^&]+)/) // ??????????????????(line)??????????????(spline)??????(column)??????(bar)?????(pie)??????(funnel)????????(step)??????(rose)??rrorbar??????(radar) var s = src.match(/[?&]s=([^&]+)/) // ????????????????????????(line)??????(column)??????(bar)????????????????????1?????????0????? var t = src.match(/[?&]t=([^&]+)/) // ??? var w = src.match(/[?&]w=([^&]+)/) // ????????100% var h = src.match(/[?&]h=([^&]+)/) // ????????400px var x = src.match(/[?&]x=([^&]+)/) // ???????????????? var r = src.match(/[?&]r=([^&]+)/) // x???????????????0????????ar???????? var v = src.match(/[?&]v=([^&]+)/) // ??????????????????????????????????????????????????????????pie/funnel???????????? var p = src.match(/[?&]p=([^&]+)/) // ???????????anvas????????1???????????0????? var l = src.match(/[?&]l=([^&]+)/) // ?????????????????????????????0 var o = src.match(/[?&]o=([^&]+)/) // ?????????????????????????#???????????????? var z = src.match(/[?&]z=([^&]+)/) // ????????????macarons????????http://echarts.baidu.com/download-theme.html var m = src.match(/[?&]m=([^&]+)/) // ???????????????????1?????0??????????????????????? var a = src.match(/[?&]a=([^&]+)/) // ??????????????????1?????0??????????????????????? var y = src.match(/[?&]y=([^&]+)/) // ??????y??????????????????0 var n = src.match(/[?&]n=([^&]+)/) // y????????????????????? var b = src.match(/[?&]b=([^&]+)/) // x????????????????????????30 var d = src.match(/[?&]d=([^&]+)/) // ???????????????1 // ?????? if (e === null || e.length < 1) { e = '' } else { e = e[1] } if (c === null || c.length < 1) { c = 'line' } else { c = c[1] } if (s === null || s.length < 1) { s = false } else { s = s[1] === '1' } if (t === null || t.length < 1) { t = '' } else { t = t[1] } 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 (x === null || x.length < 1) { x = '' } else { x = x[1] } if (r === null || r.length < 1) { r = 0 } else { r = r[1] } if (v === null || v.length < 1) { v = '' } else { v = v[1] } if (p === null || p.length < 1) { p = false } else { p = p[1] === '1' } if (l === null || l.length < 1) { l = true } else { l = !(l[1] === '0') } if (o === null || o.length < 1) { o = '' } else { o = o[1] } if (z === null || z.length < 1) { z = 'macarons' } else { z = z[1] } if (m === null || m.length < 1) { m = false } else { m = m[1] === '1' } if (a === null || a.length < 1) { a = false } else { a = a[1] === '1' } if (y === null || y.length < 1) { y = true } else { y = !(y[1] === '0') } if (n === null || n.length < 1) { n = '' } else { n = n[1] } if (b === null || b.length < 1) { b = 30 } else { b = b[1] } if (d === null || d.length < 1) { d = false } else { d = d[1] === '1' } // ???????????????????????? if ('|line|spline|column|bar|pie|funnel|step|rose|errorbar|radar|'.indexOf('|' + c + '|') < 0) { return } // ????????????????????????????????????????????????????? if (x === '') { x = $script.prevAll('input.x').first().val() } if (v === '') { v = $script.prevAll('input.v').first().val() } if (typeof (x) === 'undefined' || x === '') { x = $('#x').val() } if (typeof (v) === 'undefined' || v === '') { v = $('#v').val() } // ??????x/v?????????????? if (typeof (x) === 'undefined' || x === '') { return } if (typeof (v) === 'undefined' || v === '') { return } // ?????? var option = {} var json = null var i = 0 // ???x/y????? x = x.replace(/\|/g, ',').split(',') v = v.replace(/\|/g, ',').replace(/'/g, '"') // ???dataset???????????????????? // ??????????????JSON?????????key-value???????????????[{'name':'?????','data':[10,90,60,60,60]},{'name':'?????','data':[5,95,50,30,10]}] if (v.indexOf('{"name":') > 0 && v.indexOf('"data":[') > 0) { v = v.replace(/"name":/g, '').replace(/,"data":/g, ':').replace(/}|{/g, '') v = v.substring(1, v.length - 1) // ??????????????????????????????? v = '{" ":' + JSON.stringify(x) + ',' + v + '}' v = JSON.parse(v) } // key-value????????????????????????????????????????'?????':[10,90,60,60,60],'?????':[5,95,50,30,10]} else if (v.indexOf(']}') > 0) { v = v.replace('{M:[', '{"M":[').replace(',SD:[', ',"SD":[') v = v.substring(1, v.length - 1) v = '{" ":' + JSON.stringify(x) + ',' + v + '}' v = JSON.parse(v) } // ???????????????????????x????????????????????????????????????????????????????????'delta','theta','lowAlpha','highAlpha','lowBeta','highBeta','lowGamma','middleGamma'],[60,77,43,77,78,43,77,78],[60,77,43,77,78,43,77,78],[60,77,43,77,78,43,77,78] else if (v.indexOf('],[') > 0) { v = v.replace(/,\./g, ',0.').replace(/\[\./g, '[0.') v = JSON.parse('[' + v + ']') v = v.slice(0, x.length + 1) v[0].unshift('???') for (i = 0; i < x.length; i++) { v[i + 1].unshift(x[i]) } } // ????????????????? else { v = JSON.parse('[[""],[' + v.replace(/,/g, '],[') + ']]') v = v.slice(0, x.length + 1) v[0].unshift('') for (i = 0; i < x.length; i++) { v[i + 1].unshift(x[i]) } } // ???????ption // ??? option.dataset = { source: v } // ?????? option.title = t ? { text: t } : { show: false } // ?????? if (o) { option.color = o.replace(/\|/g, ',').split(',') } // ????????????????????? if (c === 'pie' || c === 'funnel' || c === 'rose') { $.extend(true, option, { toolbox: { feature: { restore: {}, saveAsImage: {} } }, tooltip: { confine: true, formatter: '{c} ({d}%)' }, series: { type: c === 'rose' ? 'pie' : c, label: { formatter: '{c} ({d}%)', show: l }, emphasis: { itemStyle: { shadowBlur: 10, shadowColor: 'rgba(0, 0, 0, 0.5)' } } } }) // ??? if (c === 'pie') { $.extend(true, option, { legend: { orient: 'vertical', left: 'right', top: 'middle' }, series: { radius: [0, '70%'] } }) } // ????? else if (c === 'funnel') { $.extend(true, option, { legend: { left: 'center', top: 'bottom' }, series: { minSize: '1%', maxSize: '90%' } }) } // ??????????? else if (c === 'rose') { $.extend(true, option, { legend: { orient: 'vertical', left: 'right', top: 'middle' }, series: { radius: ['15%', '70%'], roseType: 'area' } }) } } // ???????????????????? // ????? else if (c === 'radar') { const radar = [] let max = 0 for (i = 1; i < v.length; i++) { const value = v[i][1] value > max && (max = value) radar.push(value) } max = max.toString() max = (Number(max.charAt(0)) + 1) * Math.pow(10, max.length - 1) delete option.dataset $.extend(true, option, { toolbox: { feature: { restore: {}, saveAsImage: {} } }, tooltip: {}, radar: { scale: true, axisLine: { show: false }, splitArea: { show: false }, axisLabel: { showMinLabel: false }, indicator: x.map((item, index) => ({ name: item, max, axisLabel: { show: index === 0 } })) }, series: { name: '???', type: 'radar', areaStyle: {}, data: [{ value: radar }] } }) } // errorbar????????v={M:[],SD:[]} else if (c === 'errorbar') { // ??????????? json = [] for (i = 0; i < x.length; i++) { json.push([i, v.SD[i], v.M[i] - v.SD[i], v.M[i] + v.SD[i]]) } $.extend(true, option, { grid: { left: 5, right: 5, containLabel: true, bottom: 0 }, tooltip: { trigger: 'axis', backgroundColor: 'rgba(255,255,255,0.7)', borderWidth: 1, borderColor: '#48b', textStyle: { color: '#000' }, axisPointer: { type: 'shadow' } }, toolbox: { feature: { saveAsImage: {} } }, xAxis: { type: 'category', axisLabel: { rotate: r }, data: x }, yAxis: { type: 'value', scale: true, show: y }, series: [ { name: '?????', type: 'bar', label: { show: l, position: 'insideBottom', formatter: function (params) { return params.value + '?' + v.SD[params.dataIndex] } }, data: v.M }, { name: '?????', type: 'custom', data: json, itemStyle: { borderWidth: 1.5 }, encode: { x: 0, y: [2, 3], tooltip: 1 }, renderItem: function (params, api) { var xValue = api.value(0) var highPoint = api.coord([xValue, api.value(2)]) var lowPoint = api.coord([xValue, api.value(3)]) var halfWidth = api.size([1, 0])[0] * 0.1 var style = api.style({ stroke: api.visual('color'), fill: null }) return { type: 'group', children: [{ type: 'line', shape: { x1: highPoint[0] - halfWidth, y1: highPoint[1], x2: highPoint[0] + halfWidth, y2: highPoint[1] }, style: style }, { type: 'line', shape: { x1: highPoint[0], y1: highPoint[1], x2: lowPoint[0], y2: lowPoint[1] }, style: style }, { type: 'line', shape: { x1: lowPoint[0] - halfWidth, y1: lowPoint[1], x2: lowPoint[0] + halfWidth, y2: lowPoint[1] }, style: style }] } } } ] }) } // ???????????????(line)?????????(spline)??????(column)??????(bar)????????(step) else { // ?????? var type = c if (c === 'column') { type = 'bar' } else if (c === 'spline' || c === 'step') { type = 'line' } $.extend(true, option, { grid: { left: 0, right: c === 'bar' ? 10 : 5, bottom: b, top: 35, containLabel: true }, tooltip: { trigger: 'axis', backgroundColor: 'rgba(255,255,255,0.7)', borderWidth: 1, borderColor: '#48b', textStyle: { color: '#000' } }, toolbox: { feature: { magicType: {}, restore: {}, saveAsImage: {} } } }) // ????? if (c === 'bar') { $.extend(true, option, { xAxis: { type: 'value' }, yAxis: { type: 'category', name: n, inverse: true } }) } else { $.extend(true, option, { xAxis: { type: 'category', axisLabel: { interval: 0, rotate: r } }, yAxis: { type: 'value', name: n, scale: true, show: y } }) } // ?????????bar??olumn??hadow?????????(line) if (c === 'bar' || c === 'column') { $.extend(true, option, { tooltip: { axisPointer: { type: 'shadow' } } }) } // ???????????(series)???????? var ItemEX = { type: type, smooth: c === 'spline', step: c === 'step' ? 'middle' : false } // ????????????????? if ((c === 'bar' || c === 'column') && s) { $.extend(true, ItemEX, { stack: '???' }) } else if (c === 'bar' && l) { $.extend(true, ItemEX, { label: { position: 'right' } }) } else if (c === 'column' && l) { $.extend(true, ItemEX, { label: { position: 'top' } }) } // ????????????????????????????? if (l) { $.extend(true, ItemEX, { label: { show: true } }) } if (m) { $.extend(true, ItemEX, { markPoint: { silent: true, data: [{ type: 'max' }] } }) } if (a) { $.extend(true, ItemEX, { markLine: { silent: true, label: { position: 'middle', formatter: '??????{c}' }, data: [{ type: 'average' }] } }) } // ?????? var series = [] var seriesLength = Object.prototype.toString.call(v) === '[object Array]' ? v[0].length - 1 : Object.keys(v).length - 1 for (i = 0; i < seriesLength; i++) { series.push(ItemEX) } // ?????? $.extend(true, option, { series: series }) // ????????????????????????x???????????0????????????????? if (seriesLength === 1 && r === 0) { $.extend(true, option, { grid: { bottom: 0 } }) } else { $.extend(true, option, { legend: { top: 'bottom' } }) } // ???????? if (c === 'bar' || c === 'column') { if (s) { $.extend(true, option, { toolbox: { feature: { magicType: { type: ['line', 'tiled'] } } } }) } else { $.extend(true, option, { toolbox: { feature: { magicType: { type: ['line', 'stack'] } } } }) } } else { if (s) { $.extend(true, option, { toolbox: { feature: { magicType: { type: ['bar', 'tiled'] } } } }) } else { $.extend(true, option, { toolbox: { feature: { magicType: { type: ['bar', 'stack'] } } } }) } } } // ?????????????? // ?????? if ('|default|light|dark|'.indexOf('|' + z + '|') < 0) { if ($('body').attr('data-echarts-theme-' + z)) { drawchart() } else { $.ajax('/Scripts/echarts/theme/' + z + '.js', { dataType: 'script', cache: true, success: function () { $('body').attr('data-echarts-theme-' + z, true) drawchart() } }) } } else { drawchart() } // ??? function drawchart() { // ?????? if (e === '') { e = 'chart-' + Math.random().toString().substring(2, 8) $script.after('<div id="' + e + '" class="chart" style="width:' + w + ';height:' + h + 'px;overflow-x:auto;overflow-y:hidden;margin:0 auto;"></div>') } // ?????????????????????????? else if ($('#' + e).height() === 0) { $('#' + e).height(h) } // ???????????????src $('#' + e).attr('data-src', src) // ???data??????Word??? $('#' + e).data({ option: option, theme: z }) // ?????? $script.remove() // ????? var mychart = echarts.init(document.getElementById(e), z) // ?????????dom???????? var domWidth = $('#' + e).width() var chartWidth = mychart.getWidth() if (chartWidth > domWidth) { mychart.resize({ width: domWidth }) } if (d) { console.log(e + '-option:\n' + JSON.stringify(option, null, 2)) } // ???????? if (p) { $.extend(true, option, { animation: false, toolbox: { show: false }, tooltip: { show: false } }) mychart.setOption(option) $('#' + e).html('<img src="' + mychart.getDataURL({ backgroundColor: '#fff', excludeComponents: ['toolbox', 'tooltip'] }) + '">') } // ????????????????????? else if (window.screen.width <= 640) { $.extend(true, option, { animation: false, toolbox: { show: false } }) mychart.setOption(option) } else { mychart.setOption(option) } // ??? // console.log(JSON.stringify(option, null, 2)) } })()
Ms-Dos/Windows
Unix
Write backup
jsp File Browser version 1.2 by
www.vonloesch.de