Highcharts图表插件X轴数据过多,ie8下面文字竖排显示
2017-02-13 11:34
441 查看
function Bind_Chart(obj_time, arr_data_list) {
//alert(obj_time.length);
var n_l=obj_time.length;
var userAgent = navigator.userAgent;
var is_ie8=0;
if(userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1)
{
var reIE = new RegExp("MSIE (\\d+\\.\\d+);");
reIE.test(userAgent);
var fIEVersion = parseFloat(RegExp["$1"]);
//alert(fIEVersion);
if( parseInt(fIEVersion)<=8&&n_l>7)
{
is_ie8=1;
}
}
// alert(is_ie8);
if(is_ie8==1)
{
var chart_02 = Highcharts.chart('new_chart', {
chart: {
type: 'areaspline'
},
title: {
text: ''
},
legend: {
align: 'right',
verticalAlign: 'top',
x: 0,
y: 0,
floating: true,
borderWidth: 1,
symbolRadius: 2,
symbolWidth: 10,
backgroundColor: (Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF',
rtl: false
},
xAxis: {
categories: obj_time,
labels: {
rotation: 0,
style: {
fontSize: '12px',
fontFamily: 'Verdana, sans-serif',
writingMode:'tb-rl' //文字竖排样式
}
},
plotBands: [{ // visualize the weekend
from: 4.5,
to: 6.5,
color: 'rgba(68, 170, 213, .2)'
}]
},
yAxis: {
title: {
text: ''
}
},
tooltip: {
shared: true,
valueSuffix: ' 个'
},
credits: {
enabled: false
},
plotOptions: {
areaspline: {
fillOpacity: 0.5
},
series: {
marker: {
fillColor: '#ffffff',
lineWidth: 2,
lineColor: null // inherit from series
}
}
},
series: arr_data_list
});
}
else
{
var chart_02 = Highcharts.chart('new_chart', {
chart: {
type: 'areaspline'
},
title: {
text: ''
},
legend: {
align: 'right',
verticalAlign: 'top',
x: 0,
y: 0,
floating: true,
borderWidth: 1,
symbolRadius: 2,
symbolWidth: 10,
backgroundColor: (Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF',
rtl: false
},
xAxis: {
categories: obj_time,
plotBands: [{ // visualize the weekend
from: 4.5,
to: 6.5,
color: 'rgba(68, 170, 213, .2)'
}]
},
yAxis: {
title: {
text: ''
}
},
tooltip: {
shared: true,
valueSuffix: ' 个'
},
credits: {
enabled: false
},
plotOptions: {
areaspline: {
fillOpacity: 0.5
},
series: {
marker: {
fillColor: '#ffffff',
lineWidth: 2,
lineColor: null // inherit from series
}
}
},
series: arr_data_list
});
}
}
//alert(obj_time.length);
var n_l=obj_time.length;
var userAgent = navigator.userAgent;
var is_ie8=0;
if(userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1)
{
var reIE = new RegExp("MSIE (\\d+\\.\\d+);");
reIE.test(userAgent);
var fIEVersion = parseFloat(RegExp["$1"]);
//alert(fIEVersion);
if( parseInt(fIEVersion)<=8&&n_l>7)
{
is_ie8=1;
}
}
// alert(is_ie8);
if(is_ie8==1)
{
var chart_02 = Highcharts.chart('new_chart', {
chart: {
type: 'areaspline'
},
title: {
text: ''
},
legend: {
align: 'right',
verticalAlign: 'top',
x: 0,
y: 0,
floating: true,
borderWidth: 1,
symbolRadius: 2,
symbolWidth: 10,
backgroundColor: (Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF',
rtl: false
},
xAxis: {
categories: obj_time,
labels: {
rotation: 0,
style: {
fontSize: '12px',
fontFamily: 'Verdana, sans-serif',
writingMode:'tb-rl' //文字竖排样式
}
},
plotBands: [{ // visualize the weekend
from: 4.5,
to: 6.5,
color: 'rgba(68, 170, 213, .2)'
}]
},
yAxis: {
title: {
text: ''
}
},
tooltip: {
shared: true,
valueSuffix: ' 个'
},
credits: {
enabled: false
},
plotOptions: {
areaspline: {
fillOpacity: 0.5
},
series: {
marker: {
fillColor: '#ffffff',
lineWidth: 2,
lineColor: null // inherit from series
}
}
},
series: arr_data_list
});
}
else
{
var chart_02 = Highcharts.chart('new_chart', {
chart: {
type: 'areaspline'
},
title: {
text: ''
},
legend: {
align: 'right',
verticalAlign: 'top',
x: 0,
y: 0,
floating: true,
borderWidth: 1,
symbolRadius: 2,
symbolWidth: 10,
backgroundColor: (Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF',
rtl: false
},
xAxis: {
categories: obj_time,
plotBands: [{ // visualize the weekend
from: 4.5,
to: 6.5,
color: 'rgba(68, 170, 213, .2)'
}]
},
yAxis: {
title: {
text: ''
}
},
tooltip: {
shared: true,
valueSuffix: ' 个'
},
credits: {
enabled: false
},
plotOptions: {
areaspline: {
fillOpacity: 0.5
},
series: {
marker: {
fillColor: '#ffffff',
lineWidth: 2,
lineColor: null // inherit from series
}
}
},
series: arr_data_list
});
}
}
相关文章推荐
- 我需要把数据库的数据以图表的形式(饼状,线状,柱状)显示出来,不知道django下面有没有比较好用的一些插件工具或者自带的类等等
- 图表插件Highcharts的动态化赋值,实现图表数据的动态化设置显示
- HighCharts 图表插件 自定义绑定 时间轴数据
- JQuery Highcharts图表控件多样式显示多组数据
- 数据呈现&图表插件Highcharts介绍+图表联动案例
- JQuery Highcharts图表控件多样式显示多组数据
- HighCharts 图表插件 自定义绑定 时间轴数据
- easyUI draggable插件使用不当,导致拖动div内部文本框无法输入;设置echarts数据为空时就显示空白,不要动画和文字
- 关于highCharts加载出图表却不显示数据的问题
- 使用highcharts绘制图表,如何在tooltip里显示服务器端的其他数据
- Android TextView文字过多时通过滚动条显示多余内容并实时显示最下面那行
- Django向Highcharts图表发送数据并用模板语言实现动态显示
- 使用highcharts插件时图表无法显示且jQuery报错:Uncaught ReferenceError: $ is not defined
- 数据可视化图表插件--HighCharts
- jquery结合highcharts插件显示实时数据动态曲线图
- 专门做图表数据显示的js插件
- highcharts插件动态添加数据(图表内容)
- Highcharts、AJAX、JSON、JQuery实现动态数据交互显示图表柱形图
- ajax读取数据,使用jqchart显示图表
- 关于显示数据时内容过多的问题和动态的tooltip实现