Highcharts条形图缩放不工作
如果在Highcharts中使用条形图,缩放似乎无法正常工作。 您可以选择该区域,并显示“重置缩放”按钮。但是,图表没有放大 我添加到基本条形图示例中的唯一代码是缩放类型:Highcharts条形图缩放不工作,highcharts,zooming,bar-chart,Highcharts,Zooming,Bar Chart,如果在Highcharts中使用条形图,缩放似乎无法正常工作。 您可以选择该区域,并显示“重置缩放”按钮。但是,图表没有放大 我添加到基本条形图示例中的唯一代码是缩放类型: chart: { type: 'bar', zoomType: 'x' }, 完整示例: 这是一个bug还是一个特性?;-) 我认为这是Highcharts中的一个缺陷,当您使用categorizedaxis时。但解决方法是对该轴使用min: xAxis: { categories: ['A
chart: {
type: 'bar',
zoomType: 'x'
},
完整示例:
这是一个bug还是一个特性?;-) 我认为这是Highcharts中的一个缺陷,当您使用
categorized
axis时。但解决方法是对该轴使用min
:
xAxis: {
categories: ['Africa', 'America', 'Asia', 'Europe', 'Oceania'],
title: {
text: null
},
min: 0
}
另一种可能是数据量大于cropThreshold变量。看
您还可以看到此变量的。每种图形都有一个具有不同默认值的变量。您应该检查一下以确定。只需在xAxis中添加“minRange”:
$(函数(){
$(“#容器”)。高图({
图表:{
类型:'bar',
zoomType:'x'
},
标题:{
正文:“按区域分列的历史世界人口”
},
副标题:{
文本:“来源:Wikipedia.org”
},
xAxis:{
类别:[“非洲”、“美洲”、“亚洲”、“欧洲”、“大洋洲”],
标题:{
文本:空
},
最小范围:1,
},
亚克斯:{
标题:{
正文:“人口(百万)”,
对齐:“高”
},
标签:{
溢出:'justify'
}
},
工具提示:{
valueSuffix:'百万'
},
打印选项:{
酒吧:{
数据标签:{
已启用:true
}
}
},
图例:{
布局:“垂直”,
对齐:“右”,
垂直排列:“顶部”,
x:-40,
y:100,
浮动:是的,
边框宽度:1,
背景颜色:((Highcharts.theme&&Highcharts.theme.legendBackgroundColor)| |'#FFFFFF'),
影子:对
},
学分:{
已启用:false
},
系列:[{
名称:“1800年”,
数据:[107,31635203,2]
}, {
名称:"1900年",,
数据:[133156947408,6]
}, {
名称:"二零零八年",,
数据:[9739144054732,34]
}]
});
});
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js"></script>
<div id="container" style="min-width: 310px; max-width: 800px; height: 400px; margin: 0 auto"></div>
$(function () {
$('#container').highcharts({
chart: {
type: 'bar',
zoomType: 'x'
},
title: {
text: 'Historic World Population by Region'
},
subtitle: {
text: 'Source: Wikipedia.org'
},
xAxis: {
categories: ['Africa', 'America', 'Asia', 'Europe', 'Oceania'],
title: {
text: null
},
minRange: 1,
},
yAxis: {
title: {
text: 'Population (millions)',
align: 'high'
},
labels: {
overflow: 'justify'
}
},
tooltip: {
valueSuffix: ' millions'
},
plotOptions: {
bar: {
dataLabels: {
enabled: true
}
}
},
legend: {
layout: 'vertical',
align: 'right',
verticalAlign: 'top',
x: -40,
y: 100,
floating: true,
borderWidth: 1,
backgroundColor: ((Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF'),
shadow: true
},
credits: {
enabled: false
},
series: [{
name: 'Year 1800',
data: [107, 31, 635, 203, 2]
}, {
name: 'Year 1900',
data: [133, 156, 947, 408, 6]
}, {
name: 'Year 2008',
data: [973, 914, 4054, 732, 34]
}]
});
});