Highchart-graph does not appear in internet explorer - highcharts
I computed a graph in Highcharts which words perfectly well in any browser but internet explorer (see https://jsfiddle.net/statistik_tg/e69Lp3cv/). I had to add a drill down and drill up as the main chart and the drilled down chart include other metrics. Since then, it hasn't been working in IE.
Does anybody know asolution to let the code run in IE, too? Thanks in advance!
$(document).ready(function() {
var chart = {
type: 'column',
marginBottom: 220,
spacingBottom: 85,
events: {
drilldown: function (e) {
if (!e.seriesOptions) {
var chart = this,
drilldowns = {
'Thurgau': {
name: 'Übrige',
color: '#878787',
data: [
['2009', 106],
['2010', 107],
['2011', 102],
['2012', 102],
['2013', 100],
['2014', 102],
['2015', 107],
['2016', 120],
['2017', 121]
]
}
},
drilldowns2 = {
'Thurgau': {
name: 'Phyisotherapie',
color: '#B5B5B5',
data: [
['2009', 79],
['2010', 83],
['2011', 82],
['2012', 85],
['2013', 89],
['2014', 103],
['2015', 115],
['2016', 128],
['2017', 132]
]
}
},
drilldowns3 = {
'Thurgau': {
name: 'Laboratorien',
color: '#E39E00',
data: [
['2009', 42],
['2010', 43],
['2011', 45],
['2012', 48],
['2013', 55],
['2014', 57],
['2015', 63],
['2016', 69],
['2017', 73]
]
}
},
drilldowns4 = {
'Thurgau': {
name: 'Spitex',
color: '#CD3700',
data: [
['2009', 48],
['2010', 49],
['2011', 53],
['2012', 58],
['2013', 62],
['2014', 68],
['2015', 75],
['2016', 80],
['2017', 83]
]
}
},
drilldowns5 = {
'Thurgau': {
name: 'Pflegeheime',
color: '#8B0000',
data: [
['2009', 192],
['2010', 186],
['2011', 182],
['2012', 182],
['2013', 179],
['2014', 169],
['2015', 171],
['2016', 175],
['2017', 173]
]
}
},
drilldowns6 = {
'Thurgau': {
name: 'Apotheken',
color: '#FFED00',
data: [
['2009', 119],
['2010', 121],
['2011', 126],
['2012', 136],
['2013', 141],
['2014', 145],
['2015', 159],
['2016', 178],
['2017', 188]
]
}
},
drilldowns7 = {
'Thurgau': {
name: 'Ärzte Laboranalysen',
color: '#00B4E8',
data: [
['2009', 52],
['2010', 45],
['2011', 46],
['2012', 47],
['2013', 51],
['2014', 54],
['2015', 58],
['2016', 61],
['2017', 62]
]
}
},
drilldowns8 = {
'Thurgau': {
name: 'Ärzte Medikamente',
color: '#0064e6',
data: [
['2009', 339],
['2010', 331],
['2011', 327],
['2012', 329],
['2013', 335],
['2014', 330],
['2015', 342],
['2016', 361],
['2017', 369]
]
}
},
drilldowns9 = {
'Thurgau': {
name: 'Ärzte Behandlung (ohne Labor)',
color: '#27408B',
data: [
['2009', 477],
['2010', 490],
['2011', 509],
['2012', 521],
['2013', 563],
['2014', 586],
['2015', 632],
['2016', 646],
['2017', 655]
]
}
},
drilldowns10 = {
'Thurgau': {
name: 'Spital ambulant',
color: '#a2c510',
data: [
['2009', 474],
['2010', 481],
['2011', 524],
['2012', 533],
['2013', 579],
['2014', 597],
['2015', 602],
['2016', 658],
['2017', 675]
]
}
},
drilldowns11 = {
'Thurgau': {
name: 'Spital stationär',
color: '#3CA433',
data: [
['2009', 724],
['2010', 733],
['2011', 736],
['2012', 727],
['2013', 874],
['2014', 865],
['2015', 844],
['2016', 833],
['2017', 793]
]
}
},
series = drilldowns[e.point.name],
series2 = drilldowns2[e.point.name];
series3 = drilldowns3[e.point.name];
series4 = drilldowns4[e.point.name];
series5 = drilldowns5[e.point.name];
series6 = drilldowns6[e.point.name];
series7 = drilldowns7[e.point.name];
series8 = drilldowns8[e.point.name];
series9 = drilldowns9[e.point.name];
series10 = drilldowns10[e.point.name];
series11 = drilldowns11[e.point.name];
chart.addSingleSeriesAsDrilldown(e.point, series);
chart.addSingleSeriesAsDrilldown(e.point, series2);
chart.addSingleSeriesAsDrilldown(e.point, series3);
chart.addSingleSeriesAsDrilldown(e.point, series4);
chart.addSingleSeriesAsDrilldown(e.point, series5);
chart.addSingleSeriesAsDrilldown(e.point, series6);
chart.addSingleSeriesAsDrilldown(e.point, series7);
chart.addSingleSeriesAsDrilldown(e.point, series8);
chart.addSingleSeriesAsDrilldown(e.point, series9);
chart.addSingleSeriesAsDrilldown(e.point, series10);
chart.addSingleSeriesAsDrilldown(e.point, series11);
chart.applyDrilldown();
chart.yAxis[0].update({
min: 0,
max: 4000
})
}
},
drillup(){
this.yAxis[0].update({
min: 0,
max: 100
})
}
}
};
var plotOptions = {
column: {
stacking: 'normal'
}
};
var title = {
text: "Fast die Hälfte der Kosten im Kanton Thurgau für Spitalbehandlungen",
style: {
fontSize: '18px',
},
align: 'left'
};
var subtitle = {
text: 'Struktur der Bruttokosten nach Kostengruppe, Kanton Thurgau und Schweiz, 2017, Anteile in %/CHF pro versicherte Person¹',
style: {
fontSize: '12px'
},
align: 'left'
};
var yAxis = {
gridLineWidth: 1,
title: '',
lineWidth: 1,
max: 100
};
var xAxis = {
type: 'category'
};
var tooltip = {
valueSuffix: ' CHF'
};
var series = [{
name: 'Übrige',
tooltip: {
valueSuffix: ' %'
},
color: '#878787',
data: [{
name: 'Thurgau',
y: 3.7,
drilldown: true
},{
name: 'Schweiz',
y: 3.5,
drilldown: false
}]
},{
name: 'Physiotherapie',
tooltip: {
valueSuffix: ' %'
},
color: '#B5B5B5',
data: [{
name: 'Thurgau',
y: 4.0,
drilldown: true
},{
name: 'Schweiz',
y: 3.1,
drilldown: false
}]
},{
name: 'Laboratorien',
color: '#E39E00',
tooltip: {
valueSuffix: ' %'
},
data: [{
name: 'Thurgau',
y: 2.2,
drilldown: true
},{
name: 'Schweiz',
y: 2.8,
drilldown: false
}]
},{
name: 'Spitex',
color: '#CD3700',
tooltip: {
valueSuffix: ' %'
},
data: [{
name: 'Thurgau',
y: 2.5,
drilldown: true
},{
name: 'Schweiz',
y: 2.7,
drilldown: false
}]
},{
name: 'Pflegeheime',
tooltip: {
valueSuffix: ' %'
},
color: '#8B0000',
data: [{
name: 'Thurgau',
y: 5.2,
drilldown: true
},{
name: 'Schweiz',
y: 5.7,
drilldown: false
}]
},{
name: 'Apotheken',
tooltip: {
valueSuffix: ' %'
},
color: '#FFED00',
data: [{
name: 'Thurgau',
y: 5.7,
drilldown: true
},{
name: 'Schweiz',
y: 11.8,
drilldown: false
}]
},{
name: 'Ärzte Laboranalysen',
tooltip: {
valueSuffix: ' %'
},
color: '#00B4E8',
data: [{
name: 'Thurgau',
y: 1.9,
drilldown: true
},{
name: 'Schweiz',
y: 1.7,
drilldown: false
}]
},{
name: 'Ärzte Medikamente',
tooltip: {
valueSuffix: ' %'
},
color: '#0064e6',
data: [{
name: 'Thurgau',
y: 11.1,
drilldown: true
},{
name: 'Schweiz',
y: 6.3,
drilldown: false
}]
},{
name: 'Ärzte Behandlungen (ohne Labor)',
tooltip: {
valueSuffix: ' %'
},
color: '#27408B',
data: [{
name: 'Thurgau',
y: 19.7,
drilldown: true
},{
name: 'Schweiz',
y: 22.6,
drilldown: false
}]
},{
name: 'Spital ambulant',
tooltip: {
valueSuffix: ' %'
},
color: '#a2c510',
data: [{
name: 'Thurgau',
y: 20.3,
drilldown: true
},{
name: 'Schweiz',
y: 19.1,
drilldown: false
}]
},{
name: 'Spital stationär',
tooltip: {
valueSuffix: ' %'
},
color: '#3CA433',
data: [{
name: 'Thurgau',
y: 23.8,
drilldown: true
},{
name: 'Schweiz',
y: 20.7,
drilldown: false
}]
}];
var drilldown = {
series: []
};
var legend = {
layout: 'horizontal',
align: 'center',
verticalAlign: 'bottom',
padding: 25,
symbolPadding: 10,
symbolWidth: 25,
margin: -10,
/*maxHeight: 150,*/
alignColumns: false,
reversed: false,
itemStyle: {
fontWeight: 'normal'
}
};
var credits = {
text: '<b>Hinweis: Für den Vergleich der Kostenanteile im Kanton Thurgau von 2009-2017 klicken Sie <br><b>auf den Balken oder die Balkenbeschriftung zum Thurgau<br>¹ Vergleich Thurgau-Schweiz Anteile in %, Vergleich Thurgau 2009-2017 Anteile in CHF<br>Dienststelle für Statistik Kanton Thurgau <br>Datenquellen: Bundesamt für Gesundheit, Monitoring der Krankenversicherungs-<br>Kostenentwicklung',
href: false,
style: {
color:'#999999',
cursor: false,
fontSize:'10px'
},
position: {
align: 'left',
x: 10,
y: -90
}
};
var exporting = {
allowHTML: true,
enabled: true,
filename:'2019_07_Krankenversicherungskosten_Brutto_2017',
buttons: {
contextButton: {
menuItems: "printChart separator downloadPNG downloadJPEG downloadSVG".split(" ")
}
},
/*csv: {
columnHeaderFormatter: function (item) {
if(item instanceof Highcharts.Axis) {
return 'Quartal';
} else {
if(item instanceof Highcharts.Series) {
return item.name;
}
}
}
}*/
};
var responsive = {
rules: [{
condition: {
maxWidth: 500
},
chartOptions: {
legend: {
enabled: false
}
}
}]
};
var highchartsOptions = Highcharts.setOptions ({
lang: {
decimalPoint: '.',
thousandsSep: "'",
months: ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'],
weekdays: ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'],
shortMonths: ['Jan', 'Feb', 'Mrz', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez'],
contextButtonTitle: 'Drucken, Download, Export',
downloadJPEG: 'Download JPEG Bild',
downloadPNG: 'Download PNG Bild',
downloadSVG: 'Download SVG Vektor Bild',
downloadXLS: 'Download XLS',
printChart: 'Bild drucken',
viewData: 'Datentabelle ein-/ausblenden',
resetZoom: "Zoom zurücksetzen",
resetZoomTitle: "Zoom zurücksetzen",
drillUpText: "Zurück",
numericSymbols: null //otherwise by default ['k', 'M', 'G', 'T', 'P', 'E']
}
});
colors = ["#878787","#B5B5B5","#E39E00","#CD3700","#8B0000","#3CA433","#a2c510","#FFED00","#00B4E8","#0064e6","#27408B"]
var json = {};
json.chart = chart;
json.plotOptions = plotOptions;
json.title = title;
json.subtitle = subtitle;
json.yAxis = yAxis;
json.xAxis = xAxis;
json.tooltip = tooltip;
json.series = series;
json.drilldown = drilldown;
json.legend = legend;
json.credits = credits;
json.exporting = exporting;
json.responsive = responsive;
json.highchartsOptions = highchartsOptions;
json.colors = colors;
$('#2019_07_Krankenversicherungskosten_Brutto_2017').highcharts(json);
});
There is an error in IE developer tools console - you need to change JS line 230 from this:
drillup(){
into this:
drillup: function() {
and then it works fine in IE11
Related
Highcharts Boxplot - box with lower, upper quartile and median is not displaying when min and max are null of a category
navigate to below fiddle and find first category is not showing boxplot. my expectation is that highcharts should show q1,q3 and median box. is there a way to render boxplot without min and max? https://jsfiddle.net/rammohanreddy201/ga20p14y/28/ Highcharts.chart('container', { chart: { type: 'boxplot' }, title: { text: 'Highcharts Box Plot Example' }, legend: { enabled: false }, xAxis: { categories: ['1', '2', '3', '4', '5'], title: { text: 'Experiment No.' } }, yAxis: { title: { text: 'Observations' }, plotLines: [{ value: 932, color: 'red', width: 1, label: { text: 'Theoretical mean: 932', align: 'center', style: { color: 'gray' } } }] }, series: [{ name: 'Observations', data: [ [null, 801, 848, 895, null], [733, 853, 939, 980, 1080], [714, 762, 817, 870, 918], [724, 802, 806, 871, 950], [834, 836, 864, 882, 910] ], tooltip: { headerFormat: '<em>Experiment No {point.key}</em><br/>' } }, { name: 'Outliers', color: Highcharts.getOptions().colors[0], type: 'scatter', data: [ // x, y positions where 0 is the first category [0, 644], [4, 718], [4, 951], [4, 969] ], marker: { fillColor: 'white', lineWidth: 1, lineColor: Highcharts.getOptions().colors[0] }, tooltip: { pointFormat: 'Observation: {point.y}' } }] });
The implemented logic for the boxplot series requires 6 or 5 values in the array or in the data config objects - x,low,q1,median,q3,high. More: https://api.highcharts.com/highcharts/series.boxplot.data and https://www.highcharts.com/docs/chart-and-series-types/box-plot-series However, setting the low and high to the same value as q1 makes that their lines are invisible (are covered by the q1 line), so it could be a good workaround to your requirement. So the data config should look like this: data: [ [801, 801, 848, 895, 801], [733, 853, 939, 980, 1080], [714, 762, 817, 870, 918], [724, 802, 806, 871, 950], [834, 836, 864, 882, 910] ], Next it will be nice to hide those values in the tooltip. We can use the formatter callback to achieve it: tooltip: { formatter(tooltip) { let point = this.point; if (point.low === point.q1 || point.high === point.q1) { point.low = null; point.high = null; } return tooltip.defaultFormatter.call(this, tooltip); } }, Demo: https://jsfiddle.net/BlackLabel/rd4aLgne/ API: https://api.highcharts.com/highcharts/tooltip.formatter
Highstock Stockchart with custom color for single grouped column
I implemented the following stockchart with grouped columns: var seriesData = []; Highcharts.setOptions({ lang: { rangeSelectorFrom: "Von", rangeSelectorTo: "Bis", months: ["Jannuar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"], weekdays: ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'], shortMonths: ["Jan", "Feb", "Mrz", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez"], rangeSelectorZoom: '', decimalPoint: "." } }); columnChartOptions = { exporting: { enabled: false }, navigator: { enabled: false }, scrollbar: { enabled: false }, chart: { type: 'column' }, credits: { href: " ", text: " " }, title: { text: '' }, yAxis: { min: 0, title: { text: 'kWh' }, lineWidth: 1, opposite: false }, xAxis: { type: 'datetime', dateTimeLabelFormats: { month: '%B', week: '%e. %b', day: '%e. %b', hour: '%H' } }, legend: { enabled: false }, tooltip: { shared: true, valueDecimals: 2 }, plotOptions: { series: { marker: { enabled: true } }, column: { grouping: false, shadow: false, borderWidth: 0, groupPadding: 0, color: '#688DC4' } }, rangeSelector: { inputDateFormat: '%d.%m.%Y', inputEditDateFormat: '%d.%m.%Y', inputEnabled: true, inputDateParser: function (value) { value = value.split(/[\.]/); return Date.UTC( value[2], value[1]-1, value[0] ); }, verticalAlign: 'top', x: 0, y: 0, buttonPosition: { align: 'left', x: 0, y: 0 }, buttonTheme: { width: 50 }, allButtonsEnabled: true, selected: 3, buttonSpacing: 5, buttons: [{ type: 'day', count: 1, text: 'Tag', dataGrouping: { approximation: "sum", enabled: true, forced: true, units: [['hour', [1]]] } }, { type: 'week', count: 1, text: 'Woche', dataGrouping: { approximation: "sum", enabled: true, forced: true, units: [['day', [1]]] } }, { type: 'month', count: 1, text: 'Monat', dataGrouping: { approximation: "sum", enabled: true, forced: true, units: [['week', [1]]] } }, { type: 'year', count: 1, text: 'Jahr', dataGrouping: { approximation: "sum", enabled: true, forced: true, units: [['month', [1]]] } }] }, series: [] }; Initialization of the chart: myChart = new Highcharts.StockChart('consumptionGraph', columnChartOptions); myChart.showLoading("Wird geladen..."); setChartData(); Setting seriesdata dynamicaly (actually with an async AJAX call, but for better understanding replaced with static array): function setChartData() { var consumerSeries = [ [Date.UTC(2018, 1, 1), 150], [Date.UTC(2018, 1, 11), 180], [Date.UTC(2018, 1, 12), 199], [Date.UTC(2018, 7, 1), 150], [Date.UTC(2018, 7, 2), 130], [Date.UTC(2018, 7, 5), 280], [Date.UTC(2018, 9, 1), 150], [Date.UTC(2018, 9, 2), 130], [Date.UTC(2018, 9, 5), 190], [Date.UTC(2018, 12, 1), 150], [Date.UTC(2018, 12, 2), 130], [Date.UTC(2018, 12, 5), 250], ]; consumerSeriesObject = { name: "Consumption", data: consumerSeries, showInNavigator: true, color: '#688DC4', dataGrouping: { approximation: "sum", enabled: true, forced: true, units: [['month', [1]]] } }; myChart.addSeries(consumerSeriesObject, true); myChart.hideLoading(); }` JS Fiddle Now I want to change the color of every column which includes a xAxis value over and equal to 200. (column 2+4 of my Example). Is there any way to do this?
Yes. update({color: newColor}) won't work for grouped points but you can directly modify their SVGs by calling css method on their graphic property: chart: { events: { render: function() { this.series[0].groupedData.forEach(function(groupedPoint) { if (groupedPoint.y > 40) { groupedPoint.graphic.css({ color: 'red' }); } }); } } }, Live demo: http://jsfiddle.net/BlackLabel/bhtqoyj9/ render event fires after initial load of the chart (directly after the load event) and after each redraw (directly after the redraw event).
Highcharts legend how to show multiple charts data category?
This is my example crossSell1.push({ x: new Date(data[i][0]).getTime(), y: data[i][1], name: 'Category1' }); crossSell2.push({ x: new Date(data[i][0]).getTime(), y: data[i][2], name: 'Category2' }); crossSell3.push({ x: new Date(data[i][0]).getTime(), y: data[i][3], name: 'Category3' }); crossSell4.push({ x: new Date(data[i][0]).getTime(), y: data[i][4], name: 'Category4' }); renew1.push({ x: new Date(data[i][0]).getTime(), y: data[i][5], name: 'Category1' }); renew2.push({ x: new Date(data[i][0]).getTime(), y: data[i][6], name: 'Category2' }); renew3.push({ x: new Date(data[i][0]).getTime(), y: data[i][7], name: 'Category3' }); renew4.push({ x: new Date(data[i][0]).getTime(), y: data[i][8], name: 'Category4' }); upSell1.push({ x: new Date(data[i][0]).getTime(), y: data[i][9], name: 'Category1' }); upSell2.push({ x: new Date(data[i][0]).getTime(), y: data[i][10], name: 'Category2' }); upSell3.push({ x: new Date(data[i][0]).getTime(), y: data[i][11], name: 'Category3' }); upSell4.push({ x: new Date(data[i][0]).getTime(), y: data[i][12], name: 'Category4' }); Is there any way for the legend to show only Category1、Category2、Category3、Category4? Expected Or is there a better way to make my example?
Check series.column.linkedTo and I updated your series accordingly series: [{ name: 'Category 1', //updated name accordingly id: 'crossSell1', data: crossSell1, dataGrouping: { units: groupingUnits }, color: '#4E79A7' }, { name: 'Category 2', id: 'crossSell2', data: crossSell2, dataGrouping: { units: groupingUnits }, color: '#F28E2B' }, { name: 'Category 3', id: 'crossSell3', data: crossSell3, dataGrouping: { units: groupingUnits }, color: '#E15759' }, { name: 'Category 4', id: 'crossSell4', data: crossSell4, dataGrouping: { units: groupingUnits }, color: '#59A14F' }, { name: 'Renew', data: renew1, linkedTo: 'crossSell1', yAxis: 1, dataGrouping: { units: groupingUnits }, color: '#4E79A7' }, { name: 'Renew', data: renew2, linkedTo: 'crossSell2', yAxis: 1, dataGrouping: { units: groupingUnits }, color: '#F28E2B' }, { name: 'Renew', data: renew3, yAxis: 1, linkedTo: 'crossSell3', dataGrouping: { units: groupingUnits }, color: '#E15759' }, { name: 'Renew', data: renew4, linkedTo: 'crossSell4', yAxis: 1, dataGrouping: { units: groupingUnits }, color: '#59A14F' }, { name: 'Up Sell', data: upSell1, linkedTo: 'crossSell1', yAxis: 2, dataGrouping: { units: groupingUnits }, color: '#4E79A7' }, { name: 'Up Sell', data: upSell2, linkedTo: 'crossSell2', yAxis: 2, dataGrouping: { units: groupingUnits }, color: '#F28E2B' }, { name: 'Up Sell', data: upSell3, yAxis: 2, linkedTo: 'crossSell3', dataGrouping: { units: groupingUnits }, color: '#E15759' }, { name: 'Up Sell', data: upSell4, yAxis: 2, linkedTo: 'crossSell4', dataGrouping: { units: groupingUnits }, color: '#59A14F' }] var data = [ ['2017-01-01', 252, null, 77, null, null, null, null, 77, 219, null, null, null], ['2017-02-01', null, 65, null, null, 35, null, 199, 276, 210, null, null, null], ['2017-03-01', 247, 244, null, 50, null, 66, null, null, null, null, null, 12], ['2017-04-01', null, 25, 45, null, null, null, 23, 72, null, null, null, null], ['2017-05-01', null, null, 24, 85, null, 65, null, null, 175, null, null, 0], ['2017-06-01', null, 557, null, 60, null, 44, null, 274, 0, null, null, null], ['2017-07-01', null, null, 50, null, 35, null, 199, 280, null, null, null, null], ['2017-08-01', null, null, 25, null, 32, null, 199, 278, 13, null, null, null], ['2017-09-01', null, null, null, null, 150, 244, 199, 278, null, null, null, null], ['2017-10-01', null, 486, 35, null, null, null, null, null, null, null, null, null] ]; // split the data set into ohlc and volume var crossSell1 = [], crossSell2 = [], crossSell3 = [], crossSell4 = [], renew1 = [], renew2 = [], renew3 = [], renew4 = [], upSell1 = [], upSell2 = [], upSell3 = [], upSell4 = [], dataLength = data.length, // set the allowed units for data grouping groupingUnits = [ [ 'month', [2] ] ], i = 0; for (i; i < dataLength; i += 1) { crossSell1.push({ x: new Date(data[i][0]).getTime(), y: data[i][1], name: 'Category1' }); crossSell2.push({ x: new Date(data[i][0]).getTime(), y: data[i][2], name: 'Category2' }); crossSell3.push({ x: new Date(data[i][0]).getTime(), y: data[i][3], name: 'Category3' }); crossSell4.push({ x: new Date(data[i][0]).getTime(), y: data[i][4], name: 'Category4' }); renew1.push({ x: new Date(data[i][0]).getTime(), y: data[i][5], name: 'Category1' }); renew2.push({ x: new Date(data[i][0]).getTime(), y: data[i][6], name: 'Category2' }); renew3.push({ x: new Date(data[i][0]).getTime(), y: data[i][7], name: 'Category3' }); renew4.push({ x: new Date(data[i][0]).getTime(), y: data[i][8], name: 'Category4' }); upSell1.push({ x: new Date(data[i][0]).getTime(), y: data[i][9], name: 'Category1' }); upSell2.push({ x: new Date(data[i][0]).getTime(), y: data[i][10], name: 'Category2' }); upSell3.push({ x: new Date(data[i][0]).getTime(), y: data[i][11], name: 'Category3' }); upSell4.push({ x: new Date(data[i][0]).getTime(), y: data[i][12], name: 'Category4' }); } // create the chart Highcharts.stockChart('container', { chart: { type: 'column', marginRight: 150 }, rangeSelector: { selected: 0 }, legend: { enabled: true, align: 'right', borderWidth: 1, layout: 'vertical', verticalAlign: 'top', y: 100, labelFormatter: function() { return this.name; } }, title: { text: 'Gross Sales' }, plotOptions: { series: { stacking: 'normal' } }, yAxis: [{ labels: { align: 'right', x: -3 }, title: { text: 'Cross Sell' }, height: '33%', lineWidth: 2 }, { labels: { align: 'right', x: -3 }, title: { text: 'Renew' }, top: '34%', height: '33%', offset: 0, lineWidth: 2 }, { labels: { align: 'right', x: -3 }, title: { text: 'Up Sell' }, top: '67%', height: '33%', offset: 0, lineWidth: 2, plotOptions: { column: { stacking: 'normal' } } } ], tooltip: { split: false, formatter: function() { var date = new Date(this.x); return 'Category: <b>' + this.key + '</b><br>Date: <b>' + date.getFullYear() + "/" + (date.getMonth() + 1) + "/" + date.getDate() + '</b><br>USD: <b>$' + this.y + 'K</b>'; } }, series: [{ name: 'Category 1', id: 'crossSell1', data: crossSell1, dataGrouping: { units: groupingUnits }, color: '#4E79A7' }, { name: 'Category 2', id: 'crossSell2', data: crossSell2, dataGrouping: { units: groupingUnits }, color: '#F28E2B' }, { name: 'Category 3', id: 'crossSell3', data: crossSell3, dataGrouping: { units: groupingUnits }, color: '#E15759' }, { name: 'Category 4', id: 'crossSell4', data: crossSell4, dataGrouping: { units: groupingUnits }, color: '#59A14F' }, { name: 'Renew', data: renew1, linkedTo: 'crossSell1', yAxis: 1, dataGrouping: { units: groupingUnits }, color: '#4E79A7' }, { name: 'Renew', data: renew2, linkedTo: 'crossSell2', yAxis: 1, dataGrouping: { units: groupingUnits }, color: '#F28E2B' }, { name: 'Renew', data: renew3, yAxis: 1, linkedTo: 'crossSell3', dataGrouping: { units: groupingUnits }, color: '#E15759' }, { name: 'Renew', data: renew4, linkedTo: 'crossSell4', yAxis: 1, dataGrouping: { units: groupingUnits }, color: '#59A14F' }, { name: 'Up Sell', data: upSell1, linkedTo: 'crossSell1', yAxis: 2, dataGrouping: { units: groupingUnits }, color: '#4E79A7' }, { name: 'Up Sell', data: upSell2, linkedTo: 'crossSell2', yAxis: 2, dataGrouping: { units: groupingUnits }, color: '#F28E2B' }, { name: 'Up Sell', data: upSell3, yAxis: 2, linkedTo: 'crossSell3', dataGrouping: { units: groupingUnits }, color: '#E15759' }, { name: 'Up Sell', data: upSell4, yAxis: 2, linkedTo: 'crossSell4', dataGrouping: { units: groupingUnits }, color: '#59A14F' } ] }); <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script> <script src="https://code.highcharts.com/stock/highstock.js"></script> <script src="https://code.highcharts.com/stock/modules/drag-panes.js"></script> <script src="https://code.highcharts.com/stock/modules/exporting.js"></script> <div id="container" style="height: 400px; min-width: 310px"></div> Fiddle demo
Why Highchart area color is black?
I use Highchart with areaspline type and my problem is the area is got be blacked or gray based on fillOpacity in plotOptionsp property. I use this in different syntax type but the result is same. For example : plotOptions: { area: { fillOpacity: 0.5, }, } or : plotOptions: { series: { fillOpacity: 0.5, }, } You can see the screenshot of result: And here is my code: chart: { type: 'areaspline' }, title: { text: 'Average fruit consumption during one week' }, legend: { layout: 'vertical', align: 'left', verticalAlign: 'top', x: 150, y: 100, floating: true, borderWidth: 1, backgroundColor: (Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF' }, xAxis: { categories: [ 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday' ], plotBands: [{ // visualize the weekend from: 4.5, to: 6.5, color: 'rgba(68, 170, 213, .2)' }] }, yAxis: { title: { text: 'Fruit units' } }, tooltip: { shared: true, valueSuffix: ' units' }, credits: { enabled: false }, plotOptions: { areaspline: { fillOpacity: 0.5 } }, series: [{ name: 'John', data: [3, 4, 3, 5, 4, 10, 12] }, { name: 'Jane', data: [1, 3, 4, 3, 3, 5, 4] }] What should I do to resolve this problem?
How do I prevent Highcharts from truncating categories?
If space is too tight, the axis labels are truncated. I'm dealing with variable categories, so I'd prefer to have them overlap rather than disappear. Example: http://jsfiddle.net/z1axtk31/ $(function () { $('#container').highcharts({ chart: { type: 'bar' }, title: { text: 'Historic World Population by Region' }, subtitle: { text: 'Source: Wikipedia.org' }, xAxis: { categories: ['Sub-saharan Africa', 'North America', 'South America', 'East Asia', 'Middle East', 'Europe', 'Oceania', 'Ancapistan', 'North Africa', 'Mordor', 'Atlantis'], title: { text: null } }, yAxis: { min: 0, title: { text: 'Population (millions)', align: 'high' }, labels: { overflow: 'justify' } }, tooltip: { valueSuffix: ' millions' }, plotOptions: { bar: { dataLabels: { enabled: true } } }, legend: { layout: 'vertical', align: 'right', verticalAlign: 'top', x: -40, y: 100, floating: true, borderWidth: 1, backgroundColor: ((Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF'), shadow: true }, credits: { enabled: false }, series: [{ name: 'Year 1800', data: [107, 31, 635, 203, 2, 45, 23, 201, 50, 89, 210] }/*, { name: 'Year 1900', data: [133, 156, 947, 408, 6, 45, 23, 166, 50, 20, 110] }, { name: 'Year 2008', data: [973, 914, 4054, 732, 34, 45, 23, 20, 50, 133, 100] }*/] }); });
Simply set: xAxis: { labels: { step: 1 } } Example