I recently integrated a highcharts column chart, it was working well until my data reached about 60 columns, when I reached 60 columns most of the labels and bars disappear. When I remove the scroll ability from the chart all labels and data show again.
Please see https://jsfiddle.net/essensebryant/bnh2z6k7/15/ for an illustration of the problem.
I’ve looked all over the documentation but could not find an easy fix.
JavaScript
x
75
75
1
var data = [];
2
for(let i = 0; i < 60; i++){
3
4
5
data.push({
6
name: "name"+i,
7
y: Math.floor(Math.random() * 100) + 1,
8
});
9
}
10
11
12
Highcharts.chart("container", {
13
chart: {
14
type: 'column',
15
},
16
plotOptions: {
17
series: {
18
dataLabels: {
19
enabled: true,
20
format:'{point.y}', },
21
},
22
},
23
tooltip:{ enabled:false, },
24
xAxis: {
25
type: 'category',
26
min: 0,
27
max: 9,
28
scrollbar: {
29
enabled: true,
30
},
31
},
32
series: [{
33
name: 'Data',
34
colorByPoint: true,
35
data: data,
36
}],
37
responsive: {
38
rules: [
39
{
40
condition: {
41
maxWidth: 1000,
42
},
43
chartOptions: {
44
xAxis: {
45
min: 0,
46
max: 4,
47
},
48
},
49
},
50
{
51
condition: {
52
maxWidth: 600,
53
},
54
chartOptions: {
55
xAxis: {
56
min: 0,
57
max: 2,
58
},
59
},
60
},
61
{
62
condition: {
63
maxWidth: 400,
64
},
65
chartOptions: {
66
xAxis: {
67
min: 0,
68
max: 1,
69
},
70
},
71
},
72
]
73
}
74
});
75
Advertisement
Answer
You have set xAxis type as category but categories are not defined in your config. Remove
JavaScript
1
2
1
type: 'category'
2
from your config and it should work.