Highcharts I've lost my drilldown scrollbar - highcharts

So I'm baby stepping my chart to awesome levels, but somewhere along the way I have lost my scrollbar when drilling down to the detail data. It used to work perfectly, now it just shows however many it can fit in the viewing area and acts like the rest of them are not there.
I've been able to recreate the issue in this JSFiddle: https://jsfiddle.net/BigSexy/qx5uzdf6/38/
var categoriesSL = ['Elementary', 'Middle', 'High'];
var categoriesElem = ["Ack/Bingham (E)", "Ackerly (E)", "AR Kennedy", "Atkinson", "Auburndale", "Audubon", "Bates", "Bellewood (E)", "Binet (E)", "Blake"];
var categoriesMid = ["Ack/Bingham (M)", "Ackerly (M)", "Barret", "Bellewood (M)", "Binet (M)", "Boys Haven (M)", "Brook-Dupont (M)", "Brook-KMI (M)", "Brooklawn (M)", "Brown (M)"];
var categoriesHigh = ["Ack/Bingham (H)", "Ackerly (H)", "Atherton", "Ballard", "Bellewood (H)", "Binet (H)", "Boys Haven (H)", "Breck-Metro", "Brook-KMI (H)", "Brooklawn (H)"]
refChart = new Highcharts.chart('ctReferrals', {
chart: {
backgroundColor: 'whiteSmoke',
events: {
drilldown: function() {
switch (this.ddDupes[0]) {
case 'elem':
case 'elem2':
refChart.xAxis[0].setCategories(categoriesElem);
break;
case 'mid':
case 'mid2':
refChart.xAxis[0].setCategories(categoriesMid);
break;
case 'high':
case 'high2':
refChart.xAxis[0].setCategories(categoriesHigh);
break;
default:
break;
}
refChart.xAxis[0].update({
max: 5
}, true);
console.log('scroll!');
this.update({
scrollbar: {
enabled: true,
}
}, false);
},
drillupall: function() {
refChart.xAxis[0].setCategories(categoriesSL);
refChart.xAxis[0].update({
max: 2
}, true);
console.log('dont scroll!');
this.update({
scrollbar: {
enabled: false
}
}, false);
}
},
type: 'column',
},
title: {
text: 'Total # of Referrals by School Level'
},
subtitle: {
text: 'By Year'
},
xAxis: {
categories: categoriesSL,
min: 0,
max: 2,
},
yAxis: [{
title: {
useHtml: true,
text: '<strong># Referrals</strong>'
}
}],
tooltip: {
shared: true,
},
plotOptions: {
column: {
borderRadius: 5,
dataLabels: {
enabled: true,
},
}
},
series: [{
name: '2017-18',
data: [{
color: '#7cb5ec',
drilldown: 'elem',
y: 13734
}, {
color: '#7cb5ec',
drilldown: 'mid',
y: 11999
}, {
color: '#7cb5ec',
drilldown: 'high',
y: 21245
}]
}, {
name: '2018-19',
data: [{
color: '#90ed7d',
drilldown: 'elem2',
y: 12500
}, {
color: '#90ed7d',
drilldown: 'mid2',
y: 10617
}, {
color: '#90ed7d',
drilldown: 'high2',
y: 21044
}]
}],
drilldown: {
allowPointDrilldown: false,
series: [{
id: 'elem',
name: '2017-18',
data: [{
schoolLevel: "01",
schoolID_alt: "993",
color: "#7cb5ec",
drilldown: "elem",
y: 0
},
{
schoolLevel: "01",
schoolID_alt: "990",
color: "#7cb5ec",
drilldown: "elem",
y: 0
},
{
schoolLevel: "01",
schoolID_alt: "194",
color: "#7cb5ec",
drilldown: "elem",
y: 5
},
{
schoolLevel: "01",
schoolID_alt: "117",
color: "#7cb5ec",
drilldown: "elem",
y: 562
},
{
schoolLevel: "01",
schoolID_alt: "92",
color: "#7cb5ec",
drilldown: "elem",
y: 88
},
{
schoolLevel: "01",
schoolID_alt: "30",
color: "#7cb5ec",
drilldown: "elem",
y: 48
},
{
schoolLevel: "01",
schoolID_alt: "39",
color: "#7cb5ec",
drilldown: "elem",
y: 51
},
{
schoolLevel: "01",
schoolID_alt: "989",
color: "#7cb5ec",
drilldown: "elem",
y: 0
},
{
schoolLevel: "01",
schoolID_alt: "932",
color: "#7cb5ec",
drilldown: "elem",
y: 271
},
{
schoolLevel: "01",
schoolID_alt: "103",
color: "#7cb5ec",
drilldown: "elem",
y: 282
},
{
schoolLevel: "01",
schoolID_alt: "123",
color: "#7cb5ec",
drilldown: "elem",
y: 44
}
]
}, {
id: 'elem2',
name: '2018-19',
data: [{
schoolLevel: "01",
schoolID_alt: "993",
color: "#fdfd96",
drilldown: "elem2",
y: 0
},
{
schoolLevel: "01",
schoolID_alt: "990",
color: "#fdfd96",
drilldown: "elem2",
y: 0
},
{
schoolLevel: "01",
schoolID_alt: "194",
color: "#ff6961",
drilldown: "elem2",
y: 43
},
{
schoolLevel: "01",
schoolID_alt: "117",
color: "#90ed7d",
drilldown: "elem2",
y: 178
},
{
schoolLevel: "01",
schoolID_alt: "92",
color: "#90ed7d",
drilldown: "elem2",
y: 83
},
{
schoolLevel: "01",
schoolID_alt: "30",
color: "#90ed7d",
drilldown: "elem2",
y: 9
},
{
schoolLevel: "01",
schoolID_alt: "39",
color: "#ff6961",
drilldown: "elem2",
y: 103
},
{
schoolLevel: "01",
schoolID_alt: "989",
color: "#ff6961",
drilldown: "elem2",
y: 33
},
{
schoolLevel: "01",
schoolID_alt: "932",
color: "#ff6961",
drilldown: "elem2",
y: 322
},
{
schoolLevel: "01",
schoolID_alt: "103",
color: "#90ed7d",
drilldown: "elem2",
y: 74
},
{
schoolLevel: "01",
schoolID_alt: "123",
color: "#ff6961",
drilldown: "elem2",
y: 57
}
]
}, {
id: 'mid',
name: '2017-18',
data: [{
schoolLevel: "02",
schoolID_alt: "994",
color: "#7cb5ec",
drilldown: "mid",
y: 0
},
{
schoolLevel: "02",
schoolID_alt: "925",
color: "#7cb5ec",
drilldown: "mid",
y: 0
},
{
schoolLevel: "02",
schoolID_alt: "28",
color: "#7cb5ec",
drilldown: "mid",
y: 27
},
{
schoolLevel: "02",
schoolID_alt: "930",
color: "#7cb5ec",
drilldown: "mid",
y: 0
},
{
schoolLevel: "02",
schoolID_alt: "933",
color: "#7cb5ec",
drilldown: "mid",
y: 178
},
{
schoolLevel: "02",
schoolID_alt: "936",
color: "#7cb5ec",
drilldown: "mid",
y: 2
},
{
schoolLevel: "02",
schoolID_alt: "917",
color: "#7cb5ec",
drilldown: "mid",
y: 0
},
{
schoolLevel: "02",
schoolID_alt: "940",
color: "#7cb5ec",
drilldown: "mid",
y: 0
},
{
schoolLevel: "02",
schoolID_alt: "943",
color: "#7cb5ec",
drilldown: "mid",
y: 1
},
{
schoolLevel: "02",
schoolID_alt: "904",
color: "#7cb5ec",
drilldown: "mid",
y: 25
},
{
schoolLevel: "02",
schoolID_alt: "113",
color: "#7cb5ec",
drilldown: "mid",
y: 677
}
]
}, {
id: 'mid2',
name: '2018-19',
data: [{
schoolLevel: "02",
schoolID_alt: "994",
color: "#fdfd96",
drilldown: "mid2",
y: 0
},
{
schoolLevel: "02",
schoolID_alt: "925",
color: "#fdfd96",
drilldown: "mid2",
y: 0
},
{
schoolLevel: "02",
schoolID_alt: "28",
color: "#ff6961",
drilldown: "mid2",
y: 37
},
{
schoolLevel: "02",
schoolID_alt: "930",
color: "#fdfd96",
drilldown: "mid2",
y: 0
},
{
schoolLevel: "02",
schoolID_alt: "933",
color: "#90ed7d",
drilldown: "mid2",
y: 80
},
{
schoolLevel: "02",
schoolID_alt: "936",
color: "#ff6961",
drilldown: "mid2",
y: 6
},
{
schoolLevel: "02",
schoolID_alt: "917",
color: "#ff6961",
drilldown: "mid2",
y: 1
},
{
schoolLevel: "02",
schoolID_alt: "940",
color: "#fdfd96",
drilldown: "mid2",
y: 0
},
{
schoolLevel: "02",
schoolID_alt: "943",
color: "#ff6961",
drilldown: "mid2",
y: 35
},
{
schoolLevel: "02",
schoolID_alt: "904",
color: "#90ed7d",
drilldown: "mid2",
y: 6
},
{
schoolLevel: "02",
schoolID_alt: "113",
color: "#90ed7d",
drilldown: "mid2",
y: 625
}
]
}, {
id: 'high',
name: '2017-18',
data: [{
schoolLevel: "03",
schoolID_alt: "995",
color: "#7cb5ec",
drilldown: "high",
y: 0
},
{
schoolLevel: "03",
schoolID_alt: "926",
color: "#7cb5ec",
drilldown: "high",
y: 0
},
{
schoolLevel: "03",
schoolID_alt: "11",
color: "#7cb5ec",
drilldown: "high",
y: 1322
},
{
schoolLevel: "03",
schoolID_alt: "80",
color: "#7cb5ec",
drilldown: "high",
y: 604
},
{
schoolLevel: "03",
schoolID_alt: "931",
color: "#7cb5ec",
drilldown: "high",
y: 0
},
{
schoolLevel: "03",
schoolID_alt: "934",
color: "#7cb5ec",
drilldown: "high",
y: 553
},
{
schoolLevel: "03",
schoolID_alt: "937",
color: "#7cb5ec",
drilldown: "high",
y: 12
},
{
schoolLevel: "03",
schoolID_alt: "938",
color: "#7cb5ec",
drilldown: "high",
y: 725
},
{
schoolLevel: "03",
schoolID_alt: "941",
color: "#7cb5ec",
drilldown: "high",
y: 0
},
{
schoolLevel: "03",
schoolID_alt: "944",
color: "#7cb5ec",
drilldown: "high",
y: 0
},
{
schoolLevel: "03",
schoolID_alt: "905",
color: "#7cb5ec",
drilldown: "high",
y: 52
}
]
}, {
id: 'high2',
name: '2018-19',
data: [{
schoolLevel: "03",
schoolID_alt: "995",
color: "#fdfd96",
drilldown: "high2",
y: 0
},
{
schoolLevel: "03",
schoolID_alt: "926",
color: "#fdfd96",
drilldown: "high2",
y: 0
},
{
schoolLevel: "03",
schoolID_alt: "11",
color: "#90ed7d",
drilldown: "high2",
y: 1079
},
{
schoolLevel: "03",
schoolID_alt: "80",
color: "#90ed7d",
drilldown: "high2",
y: 548
},
{
schoolLevel: "03",
schoolID_alt: "931",
color: "#fdfd96",
drilldown: "high2",
y: 0
},
{
schoolLevel: "03",
schoolID_alt: "934",
color: "#ff6961",
drilldown: "high2",
y: 647
},
{
schoolLevel: "03",
schoolID_alt: "937",
color: "#ff6961",
drilldown: "high2",
y: 13
},
{
schoolLevel: "03",
schoolID_alt: "938",
color: "#ff6961",
drilldown: "high2",
y: 823
},
{
schoolLevel: "03",
schoolID_alt: "941",
color: "#fdfd96",
drilldown: "high2",
y: 0
},
{
schoolLevel: "03",
schoolID_alt: "944",
color: "#ff6961",
drilldown: "high2",
y: 81
},
{
schoolLevel: "03",
schoolID_alt: "905",
color: "#90ed7d",
drilldown: "high2",
y: 3
}
]
}]
},
exporting: {
scale: 2,
chartOptions: {
xAxis: [{
categories: categoriesElem,
min: 0,
max: categoriesElem.length
}]
}
},
credits: {
enabled: false
}
})
$(function() {
(function(H) {
//DATALABELS
H.wrap(H.Series.prototype, 'drawDataLabels', function(proceed) {
var css = this.chart.options.drilldown.activeDataLabelStyle;
proceed.call(this);
css.textDecoration = 'none';
css.fontWeight = 'bold';
css.cursor = 'default';
css.color = 'black';
H.each(this.points, function(point) {
if (point.drilldown && point.dataLabel) {
point.dataLabel
.css(css)
.on('click', function() {
return false;
});
}
});
});
})(Highcharts);
})
And here's a link to the actual graph if that helps any: https://assessment.jefferson.kyschools.us/DMC/District%20Datacard/ddReferrals
Any help you could give would be greatly, greatly appreciated

You used Highcharts source code:
<script src="https://code.highcharts.com/highcharts.js"></script>
The scrollbar feature is available only for Highstock:
<script src="https://code.highcharts.com/stock/highstock.js"></script>
Live demo: https://jsfiddle.net/BlackLabel/a126pnxv/

Related

How could I edit the color of the data elements in highchart graphic?

This is the original js code from the library:
<script type="text/javascript">
Highcharts.chart('container', {
chart: {
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false,
type: 'pie'
},
title: {
text: 'Browser market shares in January, 2018'
},
tooltip: {
pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: true,
format: '<b>{point.name}</b>: {point.percentage:.1f} %',
style: {
color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black'
}
}
}
},
series: [{
name: 'Brands',
colorByPoint: true,
data: [{
name: 'Chrome',
y: 61.41,
sliced: true,
selected: true
}, {
name: 'Internet Explorer',
y: 11.84
}, {
name: 'Firefox',
y: 10.85
}, {
name: 'Edge',
y: 4.67
}, {
name: 'Safari',
y: 4.18
}, {
name: 'Sogou Explorer',
y: 1.64
}, {
name: 'Opera',
y: 1.6
}, {
name: 'QQ',
y: 1.2
}, {
name: 'Other',
y: 2.61
}]
}]
});
</script>
You can specify color for each data point:
data: [{
name: 'Chrome',
color: 'yellow',
y: 61.41
}, ... ]
Live demo: http://jsfiddle.net/BlackLabel/mvoc016h/
API Reference: https://api.highcharts.com/highcharts/series.pie.data.color

Highchart drilldown and drillup 2 times, column will cut off

I got problem with when drilldown and drillup 2 times, column will cut off.
$(function() {
var series = [{
"color": "#4D94FF",
"data": [{
"y": 16900.6037097732,
drilldown: true
}, {
"y": 16598.1127253779,
drilldown: true
}, {
"y": 16258.989480705406,
drilldown: true
}, {
"y": 16248.5235795968,
drilldown: true
}, {
"y": 16193.565467835093,
drilldown: true
}, {
"y": 16024.382188677004,
drilldown: true
}, {
"y": 15939.296911716798,
drilldown: true
}, {
"y": 15878.156538128704,
drilldown: true
}, {
"y": 15859.042314678803,
drilldown: true
}, {
"y": 15849.380712985894,
drilldown: true
}, {
"y": 15631.992957442704,
drilldown: true
}, {
"y": 15231.375360610198,
drilldown: true
}, {
"y": 15177.678970454403,
drilldown: true
}, {
"y": 15138.9262791871,
drilldown: true
}, {
"y": 14907.178343607397,
drilldown: true
}, {
"y": 14712.1957852833,
drilldown: true
}, {
"y": 14604.5089572668,
drilldown: true
}, {
"y": 14566.970745146,
drilldown: true
}, {
"y": 14293.398250609893,
drilldown: true
}, {
"y": 14152.719995200001,
drilldown: true
}, {
"y": 14134.626426503697,
drilldown: true
}, {
"y": 13932.180859923708,
drilldown: true
}, {
"y": 13790.796702384303,
drilldown: true
}, {
"y": 13695.544447660202,
drilldown: true
}, {
"y": 13592.867697953701,
drilldown: true
}, {
"y": 13438.378718139,
drilldown: true
}, {
"y": 13188.681403070605,
drilldown: true
}, {
"y": 13109.667549848804,
drilldown: true
}, {
"y": 13059.584681272194,
drilldown: true
}, {
"y": 13000.372347950506,
drilldown: true
}, {
"y": 12813.297465918698,
drilldown: true
}, {
"y": 12532.475437284096,
drilldown: true
}, {
"y": 12515.3238663081,
drilldown: true
}, {
"y": 12462.217596782904,
drilldown: true
}, {
"y": 12193.2304492299,
drilldown: true
}, {
"y": 11967.110670820603,
drilldown: true
}, {
"y": 11766.267797112201,
drilldown: true
}, {
"y": 11688.796452044002,
drilldown: true
}, {
"y": 11676.0905818916,
drilldown: true
}, {
"y": 11542.720954126396,
drilldown: true
}, {
"y": 11524.478820919496,
drilldown: true
}, {
"y": 11176.910431652994,
drilldown: true
}, {
"y": 11148.9910212459,
drilldown: true
}, {
"y": 11147.984512210307,
drilldown: true
}, {
"y": 11036.183924155506,
drilldown: true
}, {
"y": 11028.906307756699,
drilldown: true
}, {
"y": 10924.515023171602,
drilldown: true
}, {
"y": 10870.417462228703,
drilldown: true
}, {
"y": 10794.527314604702,
drilldown: true
}, {
"y": 10711.816713451695,
drilldown: true
}, {
"y": 10647.2742567055,
drilldown: true
}, {
"y": 10245.294984622598,
drilldown: true
}, {
"y": 10159.2771334649,
drilldown: true
}, {
"y": 9746.344335019592,
drilldown: true
}, {
"y": 9588.249892114301,
drilldown: true
}, {
"y": 9457.898081183495,
drilldown: true
}, {
"y": 9439.750602872802,
drilldown: true
}, {
"y": 9419.698462570595,
drilldown: true
}, {
"y": 9384.5649919506,
drilldown: true
}, {
"y": 9349.794785022399,
drilldown: true
}, {
"y": 9345.9970427974,
drilldown: true
}, {
"y": 9333.461412205797,
drilldown: true
}, {
"y": 9025.358668211804,
drilldown: true
}, {
"y": 8971.495120078502,
drilldown: true
}, {
"y": 8848.795317591103,
drilldown: true
}, {
"y": 8800.908385901705,
drilldown: true
}, {
"y": 8737.5662531284,
drilldown: true
}, {
"y": 8678.7351885136,
drilldown: true
}, {
"y": 8456.7764961048,
drilldown: true
}, {
"y": 8311.562995553999,
drilldown: true
}, {
"y": 8089.600704193201,
drilldown: true
}, {
"y": 7932.7021273966,
drilldown: true
}, {
"y": 7804.2916799635,
drilldown: true
}, {
"y": 7665.482617346795,
drilldown: true
}, {
"y": 7545.366637899508,
drilldown: true
}, {
"y": 7523.392442792501,
drilldown: true
}, {
"y": 7422.4791104775,
drilldown: true
}, {
"y": 7277.150820999399,
drilldown: true
}, {
"y": 6813.364086545702,
drilldown: true
}, {
"y": 6810.916735649401,
drilldown: true
}, {
"y": 6497.3502318857,
drilldown: true
}, {
"y": 6456.528889776102,
drilldown: true
}, {
"y": 5989.065391362199,
drilldown: true
}, {
"y": 5930.785978138099,
drilldown: true
}, {
"y": 5550.153407216101,
drilldown: true
}, {
"y": 5363.220678388802,
drilldown: true
}, {
"y": 5231.219058841301,
drilldown: true
}, {
"y": 5090.3239122032,
drilldown: true
}, {
"y": 4838.792917356903,
drilldown: true
}, {
"y": 4831.680135994997,
drilldown: true
}, {
"y": 4811.924926727499,
drilldown: true
}, {
"y": 4658.4734687807,
drilldown: true
}, {
"y": 3072.9029491395,
drilldown: true
}, {
"y": 3045.4683175089,
drilldown: true
}, {
"y": 2923.221351564,
drilldown: true
}, {
"y": 2627.7834042233994,
drilldown: true
}, {
"y": 2555.6538610446996,
drilldown: true
}, {
"y": 2295.7969994545997,
drilldown: true
}, {
"y": 2083.750450286002,
drilldown: true
}, {
"y": 1042.7531691782997,
drilldown: true
}, {
"y": 600.8115959168999,
drilldown: true
}, {
"y": 367.57857791260005,
drilldown: true
}, {
"y": 215.2800102234,
drilldown: true
}, {
"y": 173.26539802559998,
drilldown: true
}, {
"y": 115.9506267755,
drilldown: true
}, {
"y": 111.3006117336,
drilldown: true
}, {
"y": 106.3389907677,
drilldown: true
}, {
"y": 90.6992223262,
drilldown: true
}, {
"y": 78.10283124449998,
drilldown: true
}, {
"y": 76.0523023606,
drilldown: true
}, {
"y": 60.6059997679,
drilldown: true
}, {
"y": 60.306639909699996,
drilldown: true
}, {
"y": 48.5610792629,
drilldown: true
}, {
"y": 44.905503748200005,
drilldown: true
}, {
"y": 38.2437795848,
drilldown: true
}, {
"y": 28.2788424492,
drilldown: true
}, {
"y": 25.900499820700002,
drilldown: true
}, {
"y": 19.516943574000003,
drilldown: true
}, {
"y": 14.662200450899999,
drilldown: true
}, {
"y": 8.3534003496,
drilldown: true
}, {
"y": 7.6086006463,
drilldown: true
}, {
"y": 4.0950002671,
drilldown: true
}, {
"y": 2.0880999565,
drilldown: true
}, {
"y": 1.670040071,
drilldown: true
}, {
"y": 0.418789953,
drilldown: true
}, {
"y": 0.4134699926,
drilldown: true
}, {
"y": 0.0074499843,
drilldown: true
}, {
"y": 2.0880000000000002e-07,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": 0,
drilldown: true
}, {
"y": -1.3704e-06,
drilldown: true
}, {
"y": -6.6820799112,
drilldown: true
}],
"id": "something",
"name": "Value"
}];
var assetNames = ["Brad 4-12H ", "KRETCHMAR_5-30H_", "Rock 1-16H ", "Martin TR 1-21H ", "Heidi 1-23H ", "Harriet 1-8H ", "RONCK_2-27H_", "Ward 2-34H ", "Conrady 2-14H ", "HUDSON_3-23H_", "Kay 1-24H ", "Boyer 1-36H ", "HOFFMAN_1-16H_", "Kim 2-32H ", "Thomason 2-2H ", "WILDLIFE_1-9H_", "Heidi 3-23H ", "Hazel 1-24H ", "Timberlake 2-16H ", "Ward 3-34H ", "Kilian 1-7H ", "Stafford 1-25H ", "Rickabaugh 1-2H ", "Iva Woods 1-20H ", "Hudson 2-23H ", "BLACKBIRD_3-13H_", "MEANS_3-25H_", "Hoffman 2-16H ", "JOAN_MAR_3-20H_", "RAGAN_2-22H_", "TC_FARMS_1-14H_", "Jennifer 6-34H ", "Clark Trust 4-11H ", "MYRTLE_1-21H_", "Dexter 3-8H ", "BARNARD_3-30H_", "LAUER_1-14H_", "DRACO_2-24H_", "Betty 1-14H ", "Raymond 1-7H ", "Ava Rose 2305 1-16H ", "PHILLIPS_2-22H_", "Wildlife 3-9H ", "Hankey 1-14H ", "Patrick 1-30H ", "Schantz 1-35H ", "KENO_CREEK_1-26H_", "Conrady 1-14H ", "Norma 1-25H ", "Deana 3-24H ", "Lauer 2-14H ", "ROSE_1-20H_", "LIVESTOCK_2-25H_", "CA_2-27H_", "NOEMI_1-30H_", "Beckham 2-15H ", "Haunschild 2-34H ", "Brown 1-26H ", "LAUER_3-14H_", "STEPP_2-19H_", "Oliver 1-14H ", "CA 2820 1-27H ", "JUDY_1-20H_", "Sandy Creek 2-2H ", "CANFIELD_1-23H_", "KENO_CREEK_3-26H_", "Trenton 2-12H ", "Simpson Trust 2-27H ", "Lillian 3-31H ", "JOAN_MAR_2-20H_", "ELMER_2-4H_", "Riley 1-9H ", "Noble 2-16H ", "BLISS_FAM_1-21H_", "Keno Creek 2-26H ", "Gilbert 3-24H ", "Brad 2-12H ", "SANDY_2-19H_", "Patricia 1-7H ", "NOEMI_3-30H_", "Ragan 3-22H ", "Larry 1-29H ", "DAVIS_1-13H_", "Zaloudek 2-24H ", "Hudson 1-23H ", "PETRIK_1-22H_", "Saratoga 3-25H ", "Red Fern 2-16H ", "HUGHES 1-10H", "Gilbert 1-24H ", "SARATOGA_1-25H_", "LIT Trust 5-14H ", "Sean 3-18H ", "Randy 4-19H ", "Molly 1-14H ", "Shrack 1-28H ", "SANDY_1-19H_", "Thomason 1-2H ", "ELMER_1-4H_", "Bird 3-6 ", "Rose 2-20H ", "Victor 1-19H ", "HENSLEE_1-16H_", "Jennie 2-10H ", "William 2-11H ", "Yazel 1-3H ", "Forster 1-8H ", "Jennifer 2-34H ", "William 3-11H ", "Bryant 6-10H ", "Allen 1-5H ", "LIT Trust 1-14H ", "Lori 2-2H ", "Bryant 5-10H ", "Sean 4-18H ", "KIMMY_1-26H_", "Harold 1-26H ", "Lee 2-34H ", "Hoffman 3-16H ", "Liebhart 1-35H ", "Britt 4-20H ", "JoAnn 2-8H ", "Lana 1-1A ", "PAUL_1-24H_", "Ferris 1-5H ", "Hazel 2-24H ", "Sarah 2-34H ", "Harlow 1-28H ", "Cormack 1-30H ", "Yost 1-33H ", "Rahm 1-3H ", "Lee 1-34H ", "Donna Mae 1-23H ", "Gabriel 1-36H ", "Faldtz 1-26H ", "Toews 1-28H ", "Ellis 3-19H ", "NADOLA_4-25H_", "Coach 1-26H ", "Ky 1-34H ", "Kathleen 1-1H ", "RENBARGER_4-12H_", "Montgomery 2-7H ", "Perth 2-1H ", "VICKIE_1-33H_", "Gurney Trust 2-27H ", "Barbara 1-9H ", "South Point Farms 1-17H ", "Starks Trust 1-21H ", "Myra 1-8H ", "Powers 3-2H ", "Nokes 1-35H ", "Tasset 1-34H ", "Boardwalk 2-6H ", "Michael 1-20H ", "Brent 2-6H ", "Appaloosa 2-3H ", "Isaac Farms 1-36H ", "Britt 3-20H ", "NADOLA_3-25H_", "Lawyer 2629 1-30H ", "Miller Trust 1-27H ", "Bones 2821 1-11H ", "Dexter 4-8H ", "Garlow 2-16H ", "RENBARGER_2-12H_", "SHAFER_1-21H_", "JAMES_1-9H_", "LIT Trust 2-14H ", "Bowen 4-34H ", "Powers 1-2H ", "Bleumer 2-13H ", "Clark Trust 2-11H ", "Clark Trust 3-11H ", "Wood 1-17H ", "Bobek 1-22H ", "Sandy Creek 1-2H ", "Noble 1-16H ", "Daniell 1-17H ", "Marks 1-24H ", "Robb 2-16H ", "Fox 3-26H ", "Millershaski 1-15H ", "WATKINS_1-14H_", "STAHL_1-2H_", "Lori A 1-15H ", "Miller 2-3H ", "James 1-4H ", "John 3404 1-20H ", "Kenneth 2-11H ", "Appaloosa 3-3H ", "Lorimer 1-9H ", "Murray 2-5H ", "Bernice 1-17H ", "Schwab 2-29H ", "James 2922 1-13H ", "Unruh 2-17H ", "CONRADY_4-14H_", "PARR_3-36H_", "WAYNE_1-14H_", "Conrady 3-14H ", "SARATOGA_2-25H_", "Richard 3-30H ", "Sutton 3-3H ", "CMG_1-35H_", "James 2-4H ", "Herschelle 1-10H ", "TC Farms 2-14H "];
var theChart = {
chart: {
type: 'column',
height: 300,
spacingTop: 20,
spacingBottom: 50,
spacingLeft: 20,
spacingRight: 20,
style: {
fontFamily: '"open_sansregular", sans-serif'
},
events: {
drilldown: function(e) {
this.setTitle({
text: e.point.name
});
this.update({
scrollbar: {
enabled: false
}
});
this.xAxis[0].update({
max: 5
});
this.addSeriesAsDrilldown(e.point, {
data: [5, 10]
});
},
drillup: function(e) {
// shouldn't hit this
this.setTitle({
text: 'title'
});
this.update({
scrollbar: {
enabled: true
}
});
this.xAxis[0].update({
max: 50
});
}
}
},
title: {
text: ''
},
xAxis: {
type: 'category',
categories: assetNames,
lineColor: '#000000',
scrollbar: {
enabled: true
},
tickColor: '#000000',
tickLength: 5,
max: 50,
range: 50,
},
yAxis: {
title: {
enabled: false
},
lineColor: '#000000',
gridLineWidth: 1,
gridLineColor: '#D8D8D8',
tickColor: '#000000',
tickAmount: 6,
tickWidth: 1,
tickLength: 5,
lineWidth: 1,
},
legend: {
enabled: false
},
credits: {
enabled: false
},
plotOptions: {
column: {
animation: false
},
series: {
borderWidth: 0,
dataLabels: {
enabled: false
},
point: {
events: {
mouseOver: function() {
$(".highcharts-axis-labels span").eq(this.x).css('text-decoration', 'underline');
},
mouseOut: function() {
$(".highcharts-axis-labels span").eq(this.x).css('text-decoration', 'none');
}
}
},
states: {
hover: {
brightness: -0.2 // darken
}
},
turboThreshold: 0
},
},
tooltip: {
headerFormat: '',
pointFormatter: function() {
let v = this.y;
let hasDecimal = (!isNaN(parseFloat(v)) && v.toString().indexOf('.') > -1);
v = Highcharts.numberFormat(v, hasDecimal ? 2 : 0, '.', ',');
let text = `${this.category} <br /> <strong>${this.series.name}: ${v}</strong>`;
return text;
},
backgroundColor: '#666666',
borderColor: '#CCCCCC',
shadow: false,
style: {
color: '#FFFFFF'
}
},
drilldown: {
activeAxisLabelStyle: {
textDecoration: 'none'
}
},
series: series
};
// create the chart
Highcharts.chart('container', theChart);
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://code.highcharts.com/stock/highstock.src.js"></script>
<script src="https://code.highcharts.com/modules/drilldown.src.js"></script>
<div id="container" style="height: 600px; min-width: 310px"></div>
Please help me to solve this problem.
Thank you.

How do get highcharts combo column scatter to work?

Trying to create a combo chart of with 3 column series and 1 scatter series; column should be 100% and scatter overlaid on it. When I use plotOptions: {column: {stacking: "percent"}, the columns are maximized in the plot area but scatter series goes to bottom of chart; when replace with plotOptions: {column: {stacking: "normal"}, it displays well but columns are not maximizing the plot area. Ideas?
Highcharts.chart('container', {
chart: {
ignoreHiddenSeries: false,
backgroundColor: "#FFFFFF",
width: 509,
height: 400,
borderColor: "#FFFFFF",
borderWidth: 1,
plotShadow: false
},
title: {
text: "Your organization in comparison",
style: {color: "#333333", fontFamily: "Arial", fontSize: 16, fontWeight: "bold"}
},
legend: {
enabled: true,
verticalAlign: "bottom",
align: "center",
symbolRadius: 0,
style: {color: "#333333", fontFamily: "Arial", fontSize: 13}
},
plotOptions: {
column: {stacking: "percent"},
// column: {stacking: "normal"},
series: {animation: true}},
tooltip: {enabled: false},
yAxis: {title: {text: null}, labels: {enabled: false}, gridLineWidth: 0, reversedStacks: false},
xAxis: {
title: {text: null},
categories: ['Experience', 'Security', 'Management'],
labels: {enabled: true, style: {color: "#333333", fontFamily: "Arial", fontSize: 13}},
gridLineWidth: 0,
reversedStacks: false
},
series: [{
type: "column",
name: "Low",
invertIfNegative: false,
color: "#002E73",
showInLegend: true,
data: [{y: 0.42}, {y: 0.42}, {y: 0.48}],
dataLabels: {
enabled: false,
verticalAlign: "top",
style: {color: "#FFFFFF", fontFamily: "Arial", fontSize: 13, textOutline: ""}
}
}, {
type: "column",
name: "Medium",
invertIfNegative: false,
color: "#297EFF",
showInLegend: true,
data: [{y: 0.37}, {y: 0.47}, {y: 0.36}],
dataLabels: {enabled: false}
}, {
type: "column",
name: "High",
invertIfNegative: false,
color: "#B8D4FF",
showInLegend: true,
data: [{y: 0.21}, {y: 0.11}, {y: 0.16}],
dataLabels: {enabled: false}
}, {
type: "scatter",
name: "Your organization today",
invertIfNegative: false,
color: "#FFC000",
lineWidth: 0,
marker: {enabled: true, radius: 14},
states: {hover: {lineWidthPlus: 0}},
showInLegend: true,
data: [{y: 0.21}, {y: 0.21}, {y: 0.24}],
dataLabels: {enabled: false}
}],
credits: {enabled: false}
})
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/highcharts-more.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<div id="container" style="width: 600px; height: 300px; margin: 0 auto"></div>
Your should use Multiple axes to make combinations chart.
Refer document about YAxis here: http://api.highcharts.com/highcharts/yAxis
I've fixed your code as bellow. Please try!
Highcharts.chart('container', {
chart: {
ignoreHiddenSeries: false,
backgroundColor: "#FFFFFF",
width: 509,
height: 400,
borderColor: "#FFFFFF",
borderWidth: 1,
plotShadow: false
},
title: {
text: "Your organization in comparison",
style: {
color: "#333333",
fontFamily: "Arial",
fontSize: 16,
fontWeight: "bold"
}
},
legend: {
enabled: true,
verticalAlign: "bottom",
align: "center",
symbolRadius: 0,
style: {
color: "#333333",
fontFamily: "Arial",
fontSize: 13
}
},
plotOptions: {
column: {
stacking: "percent"
},
// column: {stacking: "normal"},
series: {
animation: true
}
},
tooltip: {
enabled: false
},
// Create Multiple axes
yAxis: [{
title: {
text: null
},
labels: {
enabled: false
},
gridLineWidth: 0,
reversedStacks: false
}, {
title: {
text: null
},
labels: {
enabled: false
},
gridLineWidth: 0,
reversedStacks: false
}],
xAxis: {
title: {
text: null
},
categories: ['Experience', 'Security', 'Management'],
labels: {
enabled: true,
style: {
color: "#333333",
fontFamily: "Arial",
fontSize: 13
}
},
gridLineWidth: 0,
reversedStacks: false
},
series: [{
type: "column",
name: "Low",
invertIfNegative: false,
color: "#002E73",
showInLegend: true,
data: [{
y: 0.42
}, {
y: 0.42
}, {
y: 0.48
}],
dataLabels: {
enabled: false,
verticalAlign: "top",
style: {
color: "#FFFFFF",
fontFamily: "Arial",
fontSize: 13,
textOutline: ""
}
}
}, {
type: "column",
name: "Medium",
invertIfNegative: false,
color: "#297EFF",
showInLegend: true,
data: [{
y: 0.37
}, {
y: 0.47
}, {
y: 0.36
}],
dataLabels: {
enabled: false
}
}, {
type: "column",
name: "High",
invertIfNegative: false,
color: "#B8D4FF",
showInLegend: true,
data: [{
y: 0.21
}, {
y: 0.11
}, {
y: 0.16
}],
dataLabels: {
enabled: false
}
}, {
yAxis: 1, // Define axis will be use here
type: "scatter",
name: "Your organization today",
invertIfNegative: false,
color: "#FFC000",
lineWidth: 0,
marker: {
enabled: true,
radius: 14
},
states: {
hover: {
lineWidthPlus: 0
}
},
showInLegend: true,
data: [{
y: 0.21
}, {
y: 0.21
}, {
y: 0.24
}],
dataLabels: {
enabled: false
}
}],
credits: {
enabled: false
}
})
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/highcharts-more.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<div id="container" style="width: 600px; height: 300px; margin: 0 auto"></div>

How to add another same chart but with different data?

I create chart using HighCharts and I copy some example from official site, I havesomething exactly like this jsfidle How to add on the same page another same chart with different data?
I'm looking on google and here for some example but can't find something matching my example.
$(function () {
var colors = Highcharts.getOptions().colors,
categories = ['MSIE', 'Firefox', 'Chrome', 'Safari', 'Opera'],
data = [{
y: 56.33,
color: colors[0],
drilldown: {
name: 'MSIE versions',
categories: ['MSIE 6.0', 'MSIE 7.0', 'MSIE 8.0', 'MSIE 9.0', 'MSIE 10.0', 'MSIE 11.0'],
data: [1.06, 0.5, 17.2, 8.11, 5.33, 24.13],
color: colors[0]
}
}, {
y: 10.38,
color: colors[1],
drilldown: {
name: 'Firefox versions',
categories: ['Firefox v31', 'Firefox v32', 'Firefox v33', 'Firefox v35', 'Firefox v36', 'Firefox v37', 'Firefox v38'],
data: [0.33, 0.15, 0.22, 1.27, 2.76, 2.32, 2.31, 1.02],
color: colors[1]
}
}, {
y: 24.03,
color: colors[2],
drilldown: {
name: 'Chrome versions',
categories: ['Chrome v30.0', 'Chrome v31.0', 'Chrome v32.0', 'Chrome v33.0', 'Chrome v34.0',
'Chrome v35.0', 'Chrome v36.0', 'Chrome v37.0', 'Chrome v38.0', 'Chrome v39.0', 'Chrome v40.0', 'Chrome v41.0', 'Chrome v42.0', 'Chrome v43.0'
],
data: [0.14, 1.24, 0.55, 0.19, 0.14, 0.85, 2.53, 0.38, 0.6, 2.96, 5, 4.32, 3.68, 1.45],
color: colors[2]
}
}, {
y: 4.77,
color: colors[3],
drilldown: {
name: 'Safari versions',
categories: ['Safari v5.0', 'Safari v5.1', 'Safari v6.1', 'Safari v6.2', 'Safari v7.0', 'Safari v7.1', 'Safari v8.0'],
data: [0.3, 0.42, 0.29, 0.17, 0.26, 0.77, 2.56],
color: colors[3]
}
}, {
y: 0.91,
color: colors[4],
drilldown: {
name: 'Opera versions',
categories: ['Opera v12.x', 'Opera v27', 'Opera v28', 'Opera v29'],
data: [0.34, 0.17, 0.24, 0.16],
color: colors[4]
}
}, {
y: 0.2,
color: colors[5],
drilldown: {
name: 'Proprietary or Undetectable',
categories: [],
data: [],
color: colors[5]
}
}],
browserData = [],
versionsData = [],
i,
j,
dataLen = data.length,
drillDataLen,
brightness;
// Build the data arrays
for (i = 0; i < dataLen; i += 1) {
// add browser data
browserData.push({
name: categories[i],
y: data[i].y,
color: data[i].color
});
// add version data
drillDataLen = data[i].drilldown.data.length;
for (j = 0; j < drillDataLen; j += 1) {
brightness = 0.2 - (j / drillDataLen) / 5;
versionsData.push({
name: data[i].drilldown.categories[j],
y: data[i].drilldown.data[j],
color: Highcharts.Color(data[i].color).brighten(brightness).get()
});
}
}
// Create the chart
$('#container').highcharts({
chart: {
type: 'pie'
},
title: {
text: 'Browser market share, January, 2015 to May, 2015'
},
subtitle: {
text: 'Source: netmarketshare.com'
},
yAxis: {
title: {
text: 'Total percent market share'
}
},
plotOptions: {
pie: {
shadow: false,
center: ['50%', '50%']
}
},
tooltip: {
valueSuffix: '%'
},
series: [{
name: 'Browsers',
data: browserData,
size: '60%',
dataLabels: {
formatter: function () {
return this.y > 5 ? this.point.name : null;
},
color: '#ffffff',
distance: -30
}
}, {
name: 'Versions',
data: versionsData,
size: '80%',
innerSize: '60%',
dataLabels: {
formatter: function () {
// display only if larger than 1
return this.y > 1 ? '<b>' + this.point.name + ':</b> ' + this.y + '%' : null;
}
}
}]
});
});
By setting a second container and add 3 new arrays: Data2, browserData2 and versionsData2, don't forget to add the last two arrays (browserData2 and versionsData2) to the series option in the second container:
series: [{
name: 'Browsers',
data: browserData2,
size: '60%',
dataLabels: {
formatter: function () {
return this.y > 5 ? this.point.name : null;
},
color: '#ffffff',
distance: -30
}
}, {
name: 'Versions',
data: versionsData2,
size: '80%',
innerSize: '60%',
dataLabels: {
formatter: function () {
// display only if larger than 1
return this.y > 1 ? '<b>' + this.point.name + ':</b> ' + this.y + '%' : null;
}
}
}]
Please check the following example (jsfiddle):
$(function () {
var colors = Highcharts.getOptions().colors,
categories = ['MSIE', 'Firefox', 'Chrome', 'Safari', 'Opera'],
data = [{
y: 56.33,
color: colors[0],
drilldown: {
name: 'MSIE versions',
categories: ['MSIE 6.0', 'MSIE 7.0', 'MSIE 8.0', 'MSIE 9.0', 'MSIE 10.0', 'MSIE 11.0'],
data: [1.06, 0.5, 17.2, 8.11, 5.33, 24.13],
color: colors[0]
}
}, {
y: 10.38,
color: colors[1],
drilldown: {
name: 'Firefox versions',
categories: ['Firefox v31', 'Firefox v32', 'Firefox v33', 'Firefox v35', 'Firefox v36', 'Firefox v37', 'Firefox v38'],
data: [0.33, 0.15, 0.22, 1.27, 2.76, 2.32, 2.31, 1.02],
color: colors[1]
}
}, {
y: 24.03,
color: colors[2],
drilldown: {
name: 'Chrome versions',
categories: ['Chrome v30.0', 'Chrome v31.0', 'Chrome v32.0', 'Chrome v33.0', 'Chrome v34.0',
'Chrome v35.0', 'Chrome v36.0', 'Chrome v37.0', 'Chrome v38.0', 'Chrome v39.0', 'Chrome v40.0', 'Chrome v41.0', 'Chrome v42.0', 'Chrome v43.0'
],
data: [0.14, 1.24, 0.55, 0.19, 0.14, 0.85, 2.53, 0.38, 0.6, 2.96, 5, 4.32, 3.68, 1.45],
color: colors[2]
}
}, {
y: 4.77,
color: colors[3],
drilldown: {
name: 'Safari versions',
categories: ['Safari v5.0', 'Safari v5.1', 'Safari v6.1', 'Safari v6.2', 'Safari v7.0', 'Safari v7.1', 'Safari v8.0'],
data: [0.3, 0.42, 0.29, 0.17, 0.26, 0.77, 2.56],
color: colors[3]
}
}, {
y: 0.91,
color: colors[4],
drilldown: {
name: 'Opera versions',
categories: ['Opera v12.x', 'Opera v27', 'Opera v28', 'Opera v29'],
data: [0.34, 0.17, 0.24, 0.16],
color: colors[4]
}
}, {
y: 0.2,
color: colors[5],
drilldown: {
name: 'Proprietary or Undetectable',
categories: [],
data: [],
color: colors[5]
}
}],
categories2 = ['A', 'B', 'C', 'D', 'E'],
data2 = [{
y: 56.33,
color: colors[0],
drilldown: {
name: 'MSIE versions',
categories: ['MSIE 6.0', 'MSIE 7.0', 'MSIE 8.0', 'MSIE 9.0', 'MSIE 10.0', 'MSIE 11.0'],
data: [1.06, 0.5, 17.2, 8.11, 5.33, 24.13],
color: colors[0]
}
}, {
y: 10.38,
color: colors[1],
drilldown: {
name: 'Firefox versions',
categories: ['F7', 'F6', 'F5', 'F4', 'F3', 'F2', 'F1'],
data: [0.33, 0.15, 0.22, 1.27, 2.76, 2.32, 2.31, 1.02],
color: colors[1]
}
}, {
y: 24.03,
color: colors[2],
drilldown: {
name: 'Chrome versions',
categories: ['Cn', 'Cm', 'Cj', 'Ct', 'Cb',
'Cc', 'Cf', 'Cy', 'Ct', 'Cr', 'Cr', 'Ce', 'Cw', 'Cq'
],
data: [0.14, 1.24, 0.55, 0.19, 0.14, 0.85, 2.53, 0.38, 0.6, 2.96, 5, 4.32, 3.68, 1.45],
color: colors[2]
}
}, {
y: 4.77,
color: colors[3],
drilldown: {
name: 'Safari versions',
categories: ['S7', 'S6', 'S5', 'S4', 'S3', 'S2', 'S1'],
data: [0.3, 0.42, 0.29, 0.17, 0.26, 0.77, 2.56],
color: colors[3]
}
}, {
y: 0.91,
color: colors[4],
drilldown: {
name: 'Opera versions',
categories: ['O1', 'O2', 'O3', 'O4'],
data: [0.34, 0.17, 0.24, 0.16],
color: colors[4]
}
}, {
y: 0.2,
color: colors[5],
drilldown: {
name: 'Proprietary or Undetectable',
categories: [],
data: [],
color: colors[5]
}
}],
browserData = [],
versionsData = [],
browserData2 = [],
versionsData2 = [],
i,
j,
dataLen = data.length,
dataLen2 = data2.length,
drillDataLen,
brightness;
// Build the data arrays
for (i = 0; i < dataLen; i += 1) {
// add browser data
browserData.push({
name: categories[i],
y: data[i].y,
color: data[i].color
});
// add version data
drillDataLen = data[i].drilldown.data.length;
for (j = 0; j < drillDataLen; j += 1) {
brightness = 0.2 - (j / drillDataLen) / 5;
versionsData.push({
name: data[i].drilldown.categories[j],
y: data[i].drilldown.data[j],
color: Highcharts.Color(data[i].color).brighten(brightness).get()
});
}
}
// Build the data arrays
for (i = 0; i < dataLen2; i += 1) {
// add browser data
browserData2.push({
name: categories2[i],
y: data2[i].y,
color: data2[i].color
});
// add version data
drillDataLen = data2[i].drilldown.data.length;
for (j = 0; j < drillDataLen; j += 1) {
brightness = 0.2 - (j / drillDataLen) / 5;
versionsData2.push({
name: data2[i].drilldown.categories[j],
y: data2[i].drilldown.data[j],
color: Highcharts.Color(data2[i].color).brighten(brightness).get()
});
}
}
// Create the chart
$('#container2').highcharts({
chart: {
type: 'pie'
},
title: {
text: 'Browser market share, January, 2015 to May, 2015'
},
subtitle: {
text: 'Source: netmarketshare.com'
},
yAxis: {
title: {
text: 'Total percent market share'
}
},
plotOptions: {
pie: {
shadow: false,
center: ['50%', '50%']
}
},
tooltip: {
valueSuffix: '%'
},
series: [{
name: 'Browsers',
data: browserData,
size: '60%',
dataLabels: {
formatter: function () {
return this.y > 5 ? this.point.name : null;
},
color: '#ffffff',
distance: -30
}
}, {
name: 'Versions',
data: versionsData,
size: '80%',
innerSize: '60%',
dataLabels: {
formatter: function () {
// display only if larger than 1
return this.y > 1 ? '<b>' + this.point.name + ':</b> ' + this.y + '%' : null;
}
}
}]
});
$('#container').highcharts({
chart: {
type: 'pie'
},
title: {
text: 'Second Chart'
},
subtitle: {
text: 'Source: netmarketshare.com'
},
yAxis: {
title: {
text: 'Total percent market share'
}
},
plotOptions: {
pie: {
shadow: false,
center: ['50%', '50%']
}
},
tooltip: {
valueSuffix: '%'
},
series: [{
name: 'Browsers',
data: browserData2,
size: '60%',
dataLabels: {
formatter: function () {
return this.y > 5 ? this.point.name : null;
},
color: '#ffffff',
distance: -30
}
}, {
name: 'Versions',
data: versionsData2,
size: '80%',
innerSize: '60%',
dataLabels: {
formatter: function () {
// display only if larger than 1
return this.y > 1 ? '<b>' + this.point.name + ':</b> ' + this.y + '%' : null;
}
}
}]
});
});
If you need 3 charts you can copy-paste the initialization and just change the data and container name.
Or you can make a function, that populate a chart by given data and container name. Something like this:
function populateChart(renderTo,data,title) {
var chart = new Highcharts.Chart({
chart: {
renderTo: renderTo,
type: 'column'
},
title: {
text: title
},
xAxis: {
categories: ['Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas']
},
yAxis: {
allowDecimals: false,
min: 0,
title: {
text: 'Number of fruits'
}
},
tooltip: {
formatter: function () {
return '<b>' + this.x + '</b><br/>' +
this.series.name + ': ' + this.y + '<br/>' +
'Total: ' + this.point.stackTotal;
}
},
series: [{
name: 'John',
data: data,
stack: 'male'
}]
});
}
And then just call it when needed:
$(function(){
populateChart('container1',[5, 3, 4, 7, 2],'Title 1');
populateChart('container2',[3, 4, 4, 2, 5],'Title 2');
populateChart('container3',[2, 5, 6, 2, 1],'Title 3');
});
You can check my example

Highcharts - Can a column chart drill down to a bar chart?

I have a project where the data in the main chart is best represented as a column chart and the data in a drilldown should be a bar chart.
However when I try to drilldown, the drilldown is still a column chart even with the type set to bar.
Is this possible to do with the provided Highcharts drilldown API? I would like to have the "back" button and support multiple drilldown levels.
Here is a basic example that demonstrates the problem:
$(function () {
// Create the chart
$('#container').highcharts({
chart: {
type: 'column'
},
title: {
text: 'Basic drilldown'
},
xAxis: {
type: 'category'
},
legend: {
enabled: false
},
plotOptions: {
series: {
borderWidth: 0,
dataLabels: {
enabled: true,
}
}
},
series: [{
name: 'Things',
colorByPoint: true,
data: [{
name: 'Animals',
y: 5,
drilldown: 'animals'
}, {
name: 'Fruits',
y: 2,
drilldown: 'fruits'
}, {
name: 'Cars',
y: 4,
drilldown: 'cars'
}]
}],
drilldown: {
series: [{
id: 'animals',
type: 'bar',
data: [
['Cats', 4],
['Dogs', 2],
['Cows', 1],
['Sheep', 2],
['Pigs', 1]
]
}, {
id: 'fruits',
type: 'bar',
data: [
['Apples', 4],
['Oranges', 2]
]
}, {
id: 'cars',
type: 'bar',
data: [
['Toyota', 4],
['Opel', 2],
['Volkswagen', 2]
]
}]
}
})
});
Here is a JSFIDDLE
http://jsfiddle.net/N2g98/
EDIT: This seems like it could be considered a bug in Highcharts as it is more of a problem than just drilling down from a column to a bar chart. If you start with a bar graph and drill down to a line graph, the axes are messed up in the drilldown.
EDIT2: Here is the solution I ended up with
$(function () {
(function (H) {
H.wrap(H.Point.prototype, 'init', function (proceed, series, options, x) {
var point = proceed.call(this, series, options, x),
chart = series.chart,
tick = series.xAxis && series.xAxis.ticks[x],
tickLabel = tick && tick.label;
if (point.drilldown) {
if (tickLabel) {
if (!tickLabel._basicStyle) {
tickLabel._basicStyle = tickLabel.element.getAttribute('style');
}
tickLabel.addClass('highcharts-drilldown-axis-label').css({
'text-decoration': 'none',
'font-weight': 'normal',
'cursor': 'auto'
}).on('click', function () {
if (point.doDrilldown) {
return false;
}
});
}
}
return point;
});
H.wrap(H.Pointer.prototype, 'setDOMEvents', function (proceed) {
proceed.call(this);
var pointer = this,
container = pointer.chart.container;
container.onclick = function (e) {
if (typeof pointer.onContainerClick === 'function') {
pointer.onContainerClick(e);
}
};
});
H.wrap(H.Chart.prototype, 'drillUp', function (proceed) {
if (!this.customDrilldown) {
proceed.call(this);
} else {
var userOptions = this.userOptions;
var drilldownLevels = this.drilldownLevels;
var level = drilldownLevels.pop();
var newChartConfig = level.userOptions;
this.destroy();
$(userOptions.chart.renderTo).highcharts(newChartConfig);
var newChart = $(userOptions.chart.renderTo).highcharts();
newChart.drilldownLevels = drilldownLevels;
if (drilldownLevels.length !== 0) {
newChart.showDrillUpButton();
}
newChart.customDrilldown = true;
HighchartsAdapter.fireEvent(newChart, 'drillup', {
seriesOptions: newChartConfig
});
}
});
H.wrap(H.Point.prototype, 'doDrilldown', function (proceed, _holdRedraw) {
if (!$.isPlainObject(this.drilldown)) {
proceed.call(this, _holdRedraw);
} else {
var newChartConfig = this.drilldown;
var oldChart = this.series.chart;
var userOptions = oldChart.userOptions;
var drilldownLevels = oldChart.drilldownLevels;
if (!drilldownLevels) {
drilldownLevels = [];
}
var oldSeries = this.series;
var level = {
userOptions: userOptions,
seriesOptions: oldSeries.userOptions
};
drilldownLevels.push(level);
oldChart.destroy();
$(userOptions.chart.renderTo).highcharts(newChartConfig);
var newChart = $(userOptions.chart.renderTo).highcharts();
newChart.drilldownLevels = drilldownLevels;
newChart.showDrillUpButton();
newChart.customDrilldown = true;
HighchartsAdapter.fireEvent(newChart, 'drilldown', {
point: this,
seriesOptions: newChartConfig
});
}
});
}(Highcharts));
var pieDD1 = {
chart: {
type: 'pie'
},
title: {
text: 'Basic drilldown'
},
subtitle: {
text: 'colors'
},
series: [{
name: 'Color',
data: [{
name: 'Red',
y: 5
}, {
name: 'Blue',
y: 25
}]
}]
};
var pieDD2 = {
chart: {
type: 'pie'
},
title: {
text: 'Basic drilldown'
},
subtitle: {
text: 'colors'
},
series: [{
name: 'Color',
data: [{
name: 'Red',
y: 15
}, {
name: 'Blue',
y: 25
}]
}]
};
var pieDD3 = {
chart: {
type: 'pie'
},
title: {
text: 'Basic drilldown'
},
subtitle: {
text: 'colors'
},
series: [{
name: 'Color',
data: [{
name: 'Red',
y: 3
}, {
name: 'Blue',
y: 5
}]
}]
};
var pieDD4 = {
chart: {
type: 'pie'
},
title: {
text: 'Basic drilldown'
},
subtitle: {
text: 'colors'
},
series: [{
name: 'Color',
data: [{
name: 'Red',
y: 50
}, {
name: 'Blue',
y: 3
}]
}]
};
var pieDD5 = {
chart: {
type: 'pie'
},
title: {
text: 'Basic drilldown'
},
subtitle: {
text: 'colors'
},
series: [{
name: 'Color',
data: [{
name: 'Red',
y: 13
}, {
name: 'Blue',
y: 11
}]
}]
};
var pieDD6 = {
chart: {
type: 'pie'
},
title: {
text: 'Basic drilldown'
},
subtitle: {
text: 'colors'
},
series: [{
name: 'Color',
data: [{
name: 'Red',
y: 50
}, {
name: 'Blue',
y: 25
}]
}]
};
var pieDD7 = {
chart: {
type: 'pie'
},
title: {
text: 'Basic drilldown'
},
subtitle: {
text: 'colors'
},
series: [{
name: 'Color',
data: [{
name: 'Red',
y: 5
}, {
name: 'Blue',
y: 5
}]
}]
};
var pieDD8 = {
chart: {
type: 'pie'
},
title: {
text: 'Basic drilldown'
},
subtitle: {
text: 'colors'
},
series: [{
name: 'Color',
data: [{
name: 'Red',
y: 15
}, {
name: 'Blue',
y: 5
}]
}]
};
var pieDD9 = {
chart: {
type: 'pie'
},
title: {
text: 'Basic drilldown'
},
subtitle: {
text: 'colors'
},
series: [{
name: 'Color',
data: [{
name: 'Red',
y: 4
}, {
name: 'Blue',
y: 8
}]
}]
};
var pieDD10 = {
chart: {
type: 'pie'
},
title: {
text: 'Basic drilldown'
},
subtitle: {
text: 'colors'
},
series: [{
name: 'Color',
data: [{
name: 'Red',
y: 33
}, {
name: 'Blue',
y: 66
}]
}]
};
var pieDD11 = {
chart: {
type: 'pie'
},
title: {
text: 'Basic drilldown'
},
subtitle: {
text: 'colors'
},
series: [{
name: 'Color',
data: [{
name: 'Red',
y: 9
}, {
name: 'Blue',
y: 1
}]
}]
};
var pieDD12 = {
chart: {
type: 'pie'
},
title: {
text: 'Basic drilldown'
},
subtitle: {
text: 'colors'
},
series: [{
name: 'Color',
data: [{
name: 'Red',
y: 8
}, {
name: 'Blue',
y: 13
}]
}]
};
var pieDD13 = {
chart: {
type: 'pie'
},
title: {
text: 'Basic drilldown'
},
subtitle: {
text: 'colors'
},
series: [{
name: 'Color',
data: [{
name: 'Red',
y: 70
}, {
name: 'Blue',
y: 25
}]
}]
};
var pieDD14 = {
chart: {
type: 'pie'
},
title: {
text: 'Basic drilldown'
},
subtitle: {
text: 'colors'
},
series: [{
name: 'Color',
data: [{
name: 'Red',
y: 50
}, {
name: 'Blue',
y: 10
}]
}]
};
var pieDD15 = {
chart: {
type: 'pie'
},
title: {
text: 'Basic drilldown'
},
subtitle: {
text: 'colors'
},
series: [{
name: 'Color',
data: [{
name: 'Red',
y: 8
}, {
name: 'Blue',
y: 5
}]
}]
};
var pieDD16 = {
chart: {
type: 'pie'
},
title: {
text: 'Basic drilldown'
},
subtitle: {
text: 'colors'
},
series: [{
name: 'Color',
data: [{
name: 'Red',
y: 5
}, {
name: 'Blue',
y: 8
}]
}]
};
var drilldown = {
chart: {
type: 'column'
},
title: {
text: 'Basic drilldown'
},
subtitle: {
text: 'subtitle'
},
xAxis: {
type: 'category',
title: {
text: 'X Axis'
}
},
yAxis: {
title: {
text: 'Y Axis'
}
},
plotOptions: {
column: {
stacking: 'normal'
}
},
series: [{
name: 'Widget A',
data: [{
name: 'Qtr 1',
y: 5,
drilldown: pieDD1
}, {
name: 'Qtr 2',
y: 25,
drilldown: pieDD2
}, {
name: 'Qtr 3',
y: 25,
drilldown: pieDD3
}, {
name: 'Qtr 4',
y: 20,
drilldown: pieDD4
}]
}, {
name: 'Widget B',
data: [{
name: 'Qtr 1',
y: 25,
drilldown: pieDD5
}, {
name: 'Qtr 2',
y: 5,
drilldown: pieDD6
}, {
name: 'Qtr 3',
y: 5,
drilldown: pieDD7
}, {
name: 'Qtr 4',
y: 15,
drilldown: pieDD8
}]
}]
};
var drilldown2 = {
chart: {
type: 'column'
},
title: {
text: 'Basic drilldown'
},
subtitle: {
text: 'subtitle2'
},
xAxis: {
type: 'category',
title: {
text: 'X Axis'
}
},
yAxis: {
title: {
text: 'Y Axis'
}
},
plotOptions: {
column: {
stacking: 'normal'
}
},
series: [{
name: 'Widget A',
data: [{
name: 'Qtr 1',
y: 15,
drilldown: pieDD9
}, {
name: 'Qtr 2',
y: 15,
drilldown: pieDD10
}, {
name: 'Qtr 3',
y: 30,
drilldown: pieDD11
}, {
name: 'Qtr 4',
y: 5,
drilldown: pieDD12
}]
}, {
name: 'Widget B',
data: [{
name: 'Qtr 1',
y: 5,
drilldown: pieDD13
}, {
name: 'Qtr 2',
y: 25,
drilldown: pieDD14
}, {
name: 'Qtr 3',
y: 10,
drilldown: pieDD15
}, {
name: 'Qtr 4',
y: 20,
drilldown: pieDD16
}]
}]
};
// Create the chart
$('#container').highcharts({
chart: {
type: 'bar'
},
title: {
text: 'Basic drilldown'
},
xAxis: {
type: 'category'
},
plotOptions: {
column: {
stacking: 'normal'
}
},
series: [{
name: 'Yearly Orders',
data: [{
name: 'Location 1',
y: 100,
drilldown: drilldown
}, {
name: 'Location 2',
y: 150,
drilldown: drilldown2
}]
}]
});
});
http://jsfiddle.net/skTHx/22/

Resources