93 lines
2.7 KiB
JavaScript
93 lines
2.7 KiB
JavaScript
/* 图表模版内使用字体配置 */
|
|
var fntxt = 12,
|
|
fntit = 20;
|
|
var ww = $(window).width();
|
|
if(ww>2000){
|
|
fntxt = 18;
|
|
fntit = 30;
|
|
}
|
|
|
|
/* 修改字符串,每几个字换行 \n 换行 */
|
|
function tempChartBr(str,type, long) {
|
|
var res = '';
|
|
var length = str.length;
|
|
var long = long?long:7;
|
|
var num = long;
|
|
//console.log(str)
|
|
length <= long ? num = length : (length <= 20 ? num = Math.ceil(length / 2) : num = Math.ceil(length / 3));
|
|
if (length > long) {
|
|
var reg = new RegExp("(.{" + num + "})", "g")
|
|
if(type){
|
|
res = str.replace(reg, '$1<br>').replace(/<br>$/, "");
|
|
}else{
|
|
res = str.replace(reg, '$1\n').replace(/\n$/, "");
|
|
}
|
|
//res = str.replace(reg, '$1\n').replace(/\n$/, "");
|
|
//str.replace(reg, '$1\n').replace(/\n$/,"");
|
|
} else {
|
|
res = str;
|
|
}
|
|
//console.log(res)
|
|
return res;
|
|
}
|
|
|
|
var defaultsBar = {
|
|
title:{
|
|
x:'50%',
|
|
textAlign: 'center',
|
|
textStyle:{ color:'#fff'}
|
|
},
|
|
tooltip:{trigger: 'axis', axisPointer:{type:'shadow'} ,textStyle:{ fontSize: fntxt } },
|
|
grid:{top:'14%',left:'3%',right:'4%',bottom:'3%',containLabel:true},
|
|
xAxis: {
|
|
axisLabel:{ textStyle:{ color:"#f8f8f8", fontSize : fntxt} , rotate:40},
|
|
},
|
|
yAxis: {
|
|
axisLabel:{ textStyle:{ color:"#f8f8f8", fontSize : fntxt} }
|
|
},
|
|
series:[{
|
|
type:'bar',
|
|
barWidth:'15',
|
|
label:{
|
|
show:true,
|
|
textStyle:{ color:"#f8f8f8", fontSize :fntxt},
|
|
position:'outside',
|
|
//rotate:17
|
|
},
|
|
itemStyle:{normal:{barBorderRadius:30,color:new echarts.graphic.LinearGradient(0,0,0,1,[{offset:0,color:'#00feff'},{offset:0.5,color:'#027eff'},{offset:1,color:'#0286ff'}])}},
|
|
}]
|
|
}
|
|
|
|
var defaultsStackBar = {
|
|
color:['#031C9E','#0058AA','#016CC7','#007DE3','#01B2F8','#00CAFC','#00CAFC','#031C9E','#0058AA','#016CC7','#007DE3','#01B2F8','#00CAFC','#031C9E','#016CC7','#007DE3','#01B2F8','#00CAFC','#031C9E'],
|
|
tooltip:{
|
|
trigger: 'axis',
|
|
axisPointer : { type : 'shadow' },
|
|
textStyle:{ fontSize: fntxt },
|
|
position:function(point, params, dom, rect, size){
|
|
return [point[1],0];
|
|
},
|
|
|
|
},
|
|
toolbox:{
|
|
feature: {
|
|
saveAsImage: {
|
|
backgroundColor:"#050A18"
|
|
}
|
|
}
|
|
},
|
|
xAxis: {
|
|
axisLabel:{ textStyle:{ color:"#f8f8f8", fontSize : fntxt} , rotate:40},
|
|
},
|
|
yAxis: {
|
|
axisLabel:{ textStyle:{ color:"#f8f8f8", fontSize : fntxt} }
|
|
},
|
|
grid: {
|
|
top: '8%',
|
|
left: '3%',
|
|
right: '4%',
|
|
bottom: '3%',
|
|
containLabel: true
|
|
},
|
|
|
|
}; |