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

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/

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

Highcharts bug - label formatter function does not fire with multiple axis

I have a chart with multiple yAxis and I want to format each one differently. However, it seems with multiple yAxis, the label formatter function does not fire at all. Here's my options:
{
chart: {
backgroundColor: 'transparent',
pinchType: 'none',
height: 320,
events: {
load: (e) => {
}
}
},
plotOptions: {
line: {
states: {
hover: {
enabled: true
}
},
animation: {
duration: 750
}
},
series: {
lineWidth: 2,
}
},
series : [
{ name: 'charts',
type: 'line',
id: 0,
dataGrouping: {
groupPixelWidth: 8
},
},
{ name: 'marketcap',
type: 'line',
id: 1,
color: '#1fd3a3',
dataGrouping: {
groupPixelWidth: 8
},
},
{ name: 'volume',
type: 'area',
id: 2,
color: '#ddd',
lineWidth: 1,
dataGrouping: {
groupPixelWidth: 8
},
}
],
navigator: {
enabled: false
},
scrollbar: {
enabled: false
},
rangeSelector: {
enabled: false
},
// responsive: {
// rules: [{
// condition: {
// maxWidth: 500
// },
// }]
// },
xAxis: {
// crosshair: {
// width: 1,
// color: 'rgba(255,255,255,.5)'
// },
visible: true,
type: 'datetime'
},
yAxis: [
{
opposite: false,
gridLineWidth: 0,
minorGridLineWidth: 0,
height: '75%',
tickAmount: 5,
labels: {
formatter: () => {
// this does not fire
console.log('firing!!');
return this.value
}
}
},
{
opposite: true,
gridLineWidth: 0,
minorGridLineWidth: 0,
height: '75%',
tickAmount: 5
},
{
top: '75%',
height: '25%',
opposite: false,
gridLineWidth: 0,
minorGridLineWidth: 0,
visible: false,
},
],
tooltip: {
followPointer: true,
shared: true,
},
credits: { enabled: false }
}
Notice that I have 3 yAxis, and within each of those I have different keys and values. I need to have a custom format for each, but when I try to use the formatter function, nothing happens. Using the format string value works, but it does not allow me to format the string the way I want. Any ideas?

Unable to change default rangeSelector Highstock

I am trying to make 5M as my default rangeSelector but it seems that it keeps on insisting the 'all' on the selector.
rangeSelector: {
enabled: true,
buttons: [{
count: 2,
type: 'minute',
text: '2M'
}, {
count: 5,
type: 'minute',
text: '5M'
}, {
count: 15,
type: 'minute',
text: '15M'
}, {
count: 30,
type: 'minute',
text: '30M'
}, {
count: 3,
type: 'hour',
text: '3H'
}, {
count: 1,
type: 'day',
text: '1D'
}, {
count: 30,
type: 'day',
text: '30D'
}, {
type: 'all',
text: 'All'
}],
selected: 5,
},
Can someone tell me where my code goes wrong ?
Appreciate your help.
I have fixed my problem by adding allButtonsEnabled: true and changing selected: 1. I just got a bit confused a while ago
rangeSelector: {
enabled: true,
allButtonsEnabled: true,
buttons: [{
count: 2,
type: 'minute',
text: '2M'
}, {
count: 5,
type: 'minute',
text: '5M'
}, {
count: 15,
type: 'minute',
text: '15M'
}, {
count: 30,
type: 'minute',
text: '30M'
}, {
count: 3,
type: 'hour',
text: '3H'
}, {
count: 1,
type: 'day',
text: '1D'
}, {
count: 30,
type: 'day',
text: '30D'
}, {
type: 'all',
text: 'All'
}],
selected: 1,
},

How do I not show GMT and Timezone labels for Highcharts

As shown below:
Instead of that I want the x-axis labels to look something like this:
Without the GMT and time-zone. Sorry I am new to Highcharts !
EDIT: added code
Highcharts.theme = {
colors: ["#2b908f", "#90ee7e", "#f45b5b", "#7798BF", "#aaeeee", "#ff0066", "#eeaaee",
"#55BF3B", "#DF5353", "#7798BF", "#aaeeee"],
chart: {
backgroundColor: {
linearGradient: { x1: 0, y1: 0, x2: 1, y2: 1 },
stops: [
[0, '#2a2a2b'],
[1, '#3e3e40']
]
},
style: {
fontFamily: "'Unica One', sans-serif"
},
plotBorderColor: '#606063'
},
title: {
style: {
color: '#E0E0E3',
textTransform: 'uppercase',
fontSize: '20px'
}
},
subtitle: {
style: {
color: '#E0E0E3',
textTransform: 'uppercase'
}
},
xAxis: {
type: 'datetime',
dateTimeLabelFormats: {
month: '%e. %b'
},
gridLineColor: '#707073',
labels: {
style: {
color: '#E0E0E3'
}
},
lineColor: '#707073',
minorGridLineColor: '#505053',
tickColor: '#707073',
title: {
style: {
color: '#A0A0A3'
}
}
},
yAxis: {
gridLineColor: '#707073',
labels: {
style: {
color: '#E0E0E3'
}
},
lineColor: '#707073',
minorGridLineColor: '#505053',
tickColor: '#707073',
tickWidth: 1,
title: {
style: {
color: '#A0A0A3'
}
}
},
tooltip: {
backgroundColor: 'rgba(0, 0, 0, 0.85)',
style: {
color: '#F0F0F0'
}
},
plotOptions: {
series: {
dataLabels: {
color: '#B0B0B3'
},
marker: {
lineColor: '#333'
}
},
boxplot: {
fillColor: '#505053'
},
candlestick: {
lineColor: 'white'
},
errorbar: {
color: 'white'
}
},
credits: {
style: {
color: '#666'
}
},
labels: {
style: {
color: '#707073'
}
},
drilldown: {
activeAxisLabelStyle: {
color: '#F0F0F3'
},
activeDataLabelStyle: {
color: '#F0F0F3'
}
},
navigation: {
buttonOptions: {
symbolStroke: '#DDDDDD',
theme: {
fill: '#505053'
}
}
},
navigator: {
handles: {
backgroundColor: '#666',
borderColor: '#AAA'
},
outlineColor: '#CCC',
maskFill: 'rgba(255,255,255,0.1)',
series: {
color: '#7798BF',
lineColor: '#A6C7ED'
},
xAxis: {
gridLineColor: '#505053'
}
},
scrollbar: {
barBackgroundColor: '#808083',
barBorderColor: '#808083',
buttonArrowColor: '#CCC',
buttonBackgroundColor: '#606063',
buttonBorderColor: '#606063',
rifleColor: '#FFF',
trackBackgroundColor: '#404043',
trackBorderColor: '#404043'
},
global: {
useUTC: false
},
// special colors for some of the
legendBackgroundColor: 'rgba(0, 0, 0, 0.5)',
background2: '#505053',
dataLabelsColor: '#B0B0B3',
textColor: '#C0C0C0',
contrastTextColor: '#F0F0F3',
maskColor: 'rgba(255,255,255,0.3)'
};
Highcharts.setOptions(Highcharts.theme);
////////////////////
$('#high').highcharts({
chart: {
borderColor: '#EBBA95',
borderRadius: 20,
borderWidth: 2,
zoomType: 'x',
spacingTop: 40
},
title: {
text: 'Humidity/Temperature Graph',
x: -20, //center
y: 5
},
subtitle: {
text: 'Elemental Electronics | Click and drag to zoom',
x: -20,
},
xAxis: {
type: 'datetime',
dateTimeLabelFormats: {
month: '%e. %b'
},
categories: yearSeries,
},
yAxis: {
title: {
text: 'All points on one graph'
},
plotBands: [
{
color: 'orange', // Color value
from: 0, // Start of the plot band
to: -25 // End of the plot band
,label: {
text: 'Lower Range: 1 ppm',
color: '#ffffff',
align: 'left'
}
},
{
label: {
text: 'Upper Range: 5ppm',
color: '#ffffff',
align: 'left'
},
color: 'orange', // Color value
from: 75, // Start of the plot band
to: 100// End of the plot band
}
],
},
tooltip: {
valueSuffix: '°C'
},
series: [
{
name: 'Temperature',
textColor: '#ffffff',
data: mySeriestemp
}
],
});
});
mySeriestemp and yearSeries are both from arrays that I got using:
for (var i = 0; i < year.length; i++) {
yearSeries.push(new Date(year[i]));
mySeriestemp.push(temp[i]);
}
update
As I seen your code you need to add following
labels: {
formatter: function() {
return Highcharts.dateFormat('%e. %b', this.value);
}
See the working fiddle with your code
Use this
xAxis: {
type: 'datetime',
dateTimeLabelFormats: {
month: '%e. %b'
}
}
formatter function needs to added here to show the labels in desired format
labels: {
formatter: function() {
return Highcharts.dateFormat('%e. %b', this.value);
}

Set file type dynamically when click on exporting menu in highcharts using chart.exportChart function

I want to set filetype according to click on export menu on the right in the given url. For example if click on pdf then filetype should be set as application/pdf.
var defaultTitle = "Kalar";
var drilldownTitle = "";
var ydrillupTitle = "# of Kalar";
var ydrilldownTitle = "";
var chart = new Highcharts.Chart({
chart: {
type: 'column',
renderTo: 'upendra',
events: {
drilldown: function(e) {
chart.setTitle({ text: drilldownTitle + e.point.title });
chart.yAxis[0].axisTitle.attr({
text: ydrilldownTitle
});
},
drillup: function(e) {
chart.setTitle({ text: defaultTitle });
chart.yAxis[0].axisTitle.attr({
text: ydrillupTitle
});
},
click: function(e) {
chart.exportChart({
filename: chart.options.title.text
});
}
}
},
title: {
text: defaultTitle
},
subtitle: {
text: ''
},
credits: {
enabled: false
},
xAxis: {
categories: ['one', 'two']
},
yAxis: {
allowDecimals: false,
min: 0,
title: {
text: ydrillupTitle
}
},
plotOptions: {
column: {
stacking: 'normal',
showInLegend: true
}
},
series:[
{
name:'A',
color:'#E9ECEE',
tooltip: {
headerFormat: '',
pointFormat: '{point.name}:<br/><b>{point.y}</b> Bookings (<b>{point.percentage:, .1f} %</b>)<br/>'
},
data:[
{
name: "A",
title: "A by Company",
x:0, y:2
}, {
name: "",
x:1, y:0
}
]
},
{
name:'Arrived',
color:'#B3E5C4',
tooltip: {
headerFormat: '',
pointFormat: '{point.name}:<br/><b>{point.y}</b> Bookings (<b>{point.percentage:, .1f} %</b>)<br/>'
},
data:[
{
name: "Arrived",
title: "Planned Bookings by Goods Type",
x:0, y:10
}, {
name: "",
x:1, y:0
}
]
},
{
name:'Unscheduled',
color:'#A9ABAD',
tooltip: {
headerFormat: '',
pointFormat: '{point.name}:<br/><b>{point.y}</b> Deliveries (<b>{point.percentage:, .1f} %</b>)<br/>'
},
data:[
{
name: "",
x:0, y:0
},
{
name: "Unscheduled",
title: "Unscheduled Deliveries by Company",
x:1, y:8
}
]
},
{
name:'Rejected',
color:'#FF838F',
tooltip: {
headerFormat: '',
pointFormat: '{point.name}:<br/><b>{point.y}</b> Deliveries (<b>{point.percentage:, .1f} %</b>)<br/>'
},
data:[
{
name: "",
x:0, y:0
},
{
name: "Rejected",
title: "Rejected Deliveries Reasons",
x:1, y:7
}
]
},
{
name:'Complete',
color:'#B3E5C4',
tooltip: {
headerFormat: '',
pointFormat: '{point.name}:<br/><b>{point.y}</b> Deliveries (<b>{point.percentage:, .1f} %</b>)<br/>'
},
data:[
{
name: "",
x:0, y:0
},
{
name: "Complete",
title: "Actual Deliveries by Goods Type",
x:1, y:6
}
]
}
]
});
});
You can edit menuItems in exporting options and then set filename, extracting that information from title.
exporting: {
buttons: {
contextButton: {
menuItems: [{
textKey: 'printChart',
onclick: function () {
this.print();
}
}, {
separator: true
}, {
textKey: 'downloadPNG',
onclick: function () {
var title = this.title.textStr;
this.exportChart({
type: 'image/png',
filename: title
});
}
}, {
textKey: 'downloadJPEG',
onclick: function () {
var title = this.title.textStr;
this.exportChart({
type: 'image/jpeg',
filename: title
});
}
}, {
textKey: 'downloadPDF',
onclick: function () {
var title = this.title.textStr;
this.exportChart({
type: 'application/pdf',
filename: title
});
}
}, {
textKey: 'downloadSVG',
onclick: function () {
var title = this.title.textStr;
this.exportChart({
type: 'image/svg+xml',
filename: title
});
}
}]
}
}
},
Example: http://jsfiddle.net/bmp6Leh5/4/

Resources