我想知道,在基本条形图中,是否有限制类别的数量(条形图的数目)。
问题是:有多少个类别,一个基本的条形图,可以支持?
我已经在官方医生里搜过了,但我没有找到任何关于这个的东西。
任何线索都欢迎。
发布于 2019-02-14 11:52:46
每个轴的类别数限制在1000。
在1001个类别时,图表就会中断。
实际测试见此小提琴(1000 vs1001类别):https://jsfiddle.net/3r2psy8u/4/
html
<script src="https://code.highcharts.com/highcharts.js"></script>
<div id="container" style="min-width: 100%; height: 400px; margin: 10px auto"></div>
<div id="container2" style="min-width: 100%; height: 400px; margin: 0 auto"></div>js
var thousandCategories = [];
var thousandValues = [];
for(var x = 1; x < 1001; x++) {
thousandCategories.push('category ' + x);
thousandValues.push(['category ' + x, x]);
}
var thousandCategoriesPlusOne = thousandCategories.concat(['category 1001'])
var thousandValuesPlusOne = thousandValues.concat([['category 1001', 1001]])
Highcharts.chart('container', {
chart: {
type: 'bar',
zoomType: 'x'
},
title: {
text: '1000 categories'
},
xAxis: {
categories: thousandCategories
},
series: [{
name: '1000 categories',
data: thousandValues
}]
});
Highcharts.chart('container2', {
chart: {
type: 'column'
},
title: {
text: '1000 categories plus one'
},
xAxis: {
categories: thousandCategoriesPlusOne
},
series: [{
name: '1001 categories',
data: thousandValuesPlusOne
}]
});https://stackoverflow.com/questions/31539399
复制相似问题