I am attempting to generate a stacked column chart in Highcharts with SVG images as x-axis labels, similar to the image displayed here:
https://i.stack.imgur.com/y5gL1.png
I have managed to achieve this with individual data points per label (non-stacked data), but when I switch to an array input, the data fails to render. This example is functional: https://jsfiddle.net/jakobhl/krx4e5pm/2/
var dataName = function(imgSrc) {
return '<span><img src=' + imgSrc + ' ' + 'style="width: 40px; height: 40px;"/><br></span>';
};
var data2016 = [
[11, dataName("https://image.flaticon.com/icons/svg/197/197571.svg")],
[11, dataName("https://image.flaticon.com/icons/svg/197/197408.svg")],
[11, dataName("https://image.flaticon.com/icons/svg/197/197375.svg")],
[14, dataName("https://image.flaticon.com/icons/svg/197/197374.svg")],
[12, dataName("https://image.flaticon.com/icons/svg/197/197484.svg")],
];
Highcharts.chart('container', {
chart: {
type: 'column'
},
plotOptions: {
column: {
stacking: 'normal',
dataLabels: {
enabled: true
}
}
},
xAxis: {
tickmarkPlacement: 'on',
lineWidth: 0,
type: 'category',
labels: {
useHTML: true,
align: 'center'
}
},
series: [{
keys: ['y', 'name'],
data: data2016,
}]
});
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/highcharts-more.js"></script>
<div id="container"></div>
However, the following does not work: https://jsfiddle.net/jakobhl/2rfa645x/3/
var dataName = function(imgSrc) {
return '<span><img src=' + imgSrc + ' ' + 'style="width: 40px; height: 40px;"/><br></span>';
};
var data2016 = [
[[11, 15], dataName("https://image.flaticon.com/icons/svg/197/197571.svg")],
[[12, 15], dataName("https://image.flaticon.com/icons/svg/197/197408.svg")],
[[13, 15], dataName("https://image.flaticon.com/icons/svg/197/197375.svg")],
[[41, 15], dataName("https://image.flaticon.com/icons/svg/197/197374.svg")],
[[11, 15], dataName("https://image.flaticon.com/icons/svg/197/197484.svg")],
];
Highcharts.chart('container', {
chart: {
type: 'column'
},
plotOptions: {
column: {
stacking: 'normal',
dataLabels: {
enabled: true
}
}
},
xAxis: {
tickmarkPlacement: 'on',
lineWidth: 0,
type: 'category',
labels: {
useHTML: true,
align: 'center'
}
},
series: [{
keys: ['y', 'name'],
data: data2016,
}]
});
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/highcharts-more.js"></script>
<div id="container"></div>
Is there a way to stack the data by country while still using SVGs as labels?
Credits and thanks go to the jsfiddle user BlackLabel for the inspiration.