Highcharts/highstock set yAxis Min and Max with Scroll - highcharts

I have a stacked column highstock chart with positive and negative stacks and a horizontal scrollbar. I am trying to have the yAxis with min and max values according to the max data and min data so I've setup those values (after calculating them) in highstock's json.
However, the length of the names of the users on the xAxis are overriding these max values, is there a way around that?
Here's my js fiddle: http://jsfiddle.net/fj6d2/3931/
As the code is too large to be posted here, here's the configuration without all the data:
Highcharts.chart('container', {
"chart":{
"type":"column"
},
"title":{
"text":""
},
"xAxis":{
"min":0,
"max":31,
"categories":[
"Xxx Xxxx",
"Xxx Xxxx",
"Xxx Xxxx",
"Xxx Xxxxx",
],
"labels":{
"style":{
"font-size":"12px"
},
"useHTML":true,
"events":{
}
}
},
"scrollbar":{
"enabled":true,
"barBackgroundColor":"gray",
"barBorderRadius":7,
"barBorderWidth":0,
"buttonBackgroundColor":"gray",
"buttonBorderWidth":0,
"buttonArrowColor":"yellow",
"buttonBorderRadius":7,
"rifleColor":"yellow",
"trackBackgroundColor":"white",
"trackBorderWidth":1,
"trackBorderColor":"silver",
"trackBorderRadius":7
},
"yAxis":{
"title":{
"text":"Time (hh:mm)"
},
"tickInterval":600,
"labels":{
},
"gridLineWidth":0,
"plotLines":[
{
"value":0,
"width":1,
"color":"#000",
"zIndex":4
}
],
"tickmarkPlacement":"on",
"max":45336,
"min":-21443
},
"plotOptions":{
"column":{
"stacking":"normal",
"events":{
}
}
},
"credits":{
"enabled":false
},
"tooltip":{
"shared":true,
"crosshairs":true
},
"legend":{
"align":"right",
"verticalAlign":"top",
"itemStyle":{
"display":"none"
},
"title":{
"text":"Click a colour"
}
},
"series":[
{
"name":"On Task Teacher Recommended",
"data":[
487,
13512,
10064,
2664,
],
"color":"#86E067",
"events":{
},
"point":{
"events":false
},
"customEvents":{
"series":{
},
"point":{
}
}
},
{
"name":"On Task Student Discovered",
"data":[
1276,
5495,
1307,
3369,
],
"color":"#5CB5E5",
"events":{
},
"point":{
"events":false
},
"customEvents":{
"series":{
},
"point":{
}
}
},
{
"name":"Uncategorised",
"data":[
944,
12202,
2920,
4643,
],
"color":"#F98157",
"events":{
},
"point":{
"events":false
},
"customEvents":{
"series":{
},
"point":{
}
}
},
{
"name":"Off Task",
"data":[
-126,
-686,
-1998,
-927,
],
"color":"#E3454D",
"events":{
},
"point":{
"events":false
},
"customEvents":{
"series":{
},
"point":{
}
}
}
]
});

you can truncate long name (xAxis) of highcharts using function
function truncString(str, max, add){
add = add || '...';
return (typeof str === 'string' && str.length > max ? str.substring(0,max)+add : str);
};
And call this function in formatter
"labels":{
"formatter": function() {
return truncString(this.value,8,'...')
},
"style":{
"font-size":"12px"
},
"useHTML":true,
"events":{
}
}
Fiddle demo

Related

Highcharts custom formatting/coloring of category labels

I need to be able to apply background coloring (and text coloring to maintain contrast) to category labels.
I couldn't find an easy way to set each category label independently and came up with a working solution but now the width of my label column is too wide and applying marginLeft doesn't work.
First is there an easier way to achieve what I want or a solution to the width.
Here's the result:
and fiddle can be found here
Highcharts.ganttChart('container', {
chart: {
// marginLeft: 400,
events: {
load: function() {
for (var tickPos in this.yAxis[0].ticks) {
console.log(tickPos);
var ch = this.yAxis[0].chart;
var tick = this.yAxis[0].ticks[tickPos];
var label = tick.label;
if (typeof label !== "undefined") {
var text = label.textStr;
var obj = JSON.parse(text);
var element = label.element;
element.textContent = obj.name;
if (typeof obj.background !== "undefined") {
element.style["background-color"] = obj.background;
}
if (typeof obj.color !== "undefined") {
element.style["color"] = obj.color;
}
}
}
}
}
},
title: {
text: 'Highcharts Gantt Chart'
},
subtitle: {
text: 'With linked to split'
},
xAxis: {
minPadding: 0.05,
maxPadding: 0.05
},
"yAxis": [{
"scrollbar": {
"enabled": true
},
labels: {
useHTML: true
},
"uniqueNames": true
}],
tooltip: {
outside: true
},
rangeSelector: {
enabled: true,
selected: 5
},
time: {
useUTC: true
},
plotOptions: {
column: {
grouping: true
}
},
"series": [{
"name": "main",
"tooltip": {
"headerFormat": null
},
"data": [{
"name": '{"name": "Color prep and printing", "background":"green", "color":"white"}',
"id": "_dqbcsMWXEeeTdKTuQU2hRA",
"start": 1577836800000,
"end": 1582934400000,
"color": {
"patternIndex": 0
}
}, {
"name": '{"name": "Send to color house", "background":"blue", "color":"white"}',
"id": "_dqkmv8WXEeeTdKTuQU2hRA",
"parent": "_dqbcsMWXEeeTdKTuQU2hRA",
"start": 1577836800000,
"end": 1580428800000,
"duration": 30
}, {
"name": '{"name": "Generate proofs", "background":"teal", "color":"white"}',
"id": "_dq3hkMWXEeeTdKTuQU2hRA",
"parent": "_dqbcsMWXEeeTdKTuQU2hRA",
"start": 1578614400000,
"end": 1579651200000,
"duration": 12,
"dependency": [{
"to": "_dqkmv8WXEeeTdKTuQU2hRA"
}]
}, {
"name": '{"name": "Print and ship", "background":"crimson"}',
"id": "_drLDlcWXEeeTdKTuQU2hRA",
"parent": "_dqbcsMWXEeeTdKTuQU2hRA",
"start": 1581292800000,
"end": 1582934400000,
"duration": 19,
"dependency": [{
"to": "_dq3hkMWXEeeTdKTuQU2hRA"
}]
}],
"dataLabels": [{}, {
"enabled": true,
"align": "right",
"format": "{point.duration}"
}]
}],
});
To increase the width, you can set width style:
yAxis: {
labels: {
useHTML: true,
style: {
width: '300px',
textOverflow: 'ellipsis'
}
},
...
},
Live demo: https://jsfiddle.net/BlackLabel/nkz9xmh0/
API Reference: https://api.highcharts.com/gantt/yAxis.labels.style

Highcharts xAxis has extra gap when multiple yAxis

We have a chart that plots multiple series at once.
There are the main y-series (line type) that will have the main data readings.
There is the option to set two different 'levels' (line types) on the y-axis as well.
There are also options to have multiple additional y-axis bars (bar types).
With the x-axis being the datetime
Here is what a typical example of a chart looks like with valid date for the given range
This is working as expected.
We have the main y-series as the average air temp (left y-axis)
Then we have two bars, one for rainfall and one for irrigation (right y-axis)
And then the two 'levels', one red and one blue.
This is all great.
However, when we go to a date range in the future, where there is no air temp data, we get the following
Note that the start date is 2 days before the date range, and the end date looks equal distance from the end of the 'levels'
Interestingly if we remove the bars we get the following
This now shows the 'levels' to span the full width of the chart
If we remove the lines and just have the bars then we get the following (which is how it should look, but with the 'levels')
There seems to be something in here that is causing the conflict when there are multiple y-series without the main y-series.
I am setting the xAxis.setExtremes to the start and end dates of the date range we are looking at, but that seems to be doing nothing.
Here is the config;
{
"chart": {
"type":"line",
"animation": {
"duration":150
},
"events":{}
},
"credits":{
"enabled":false
},
"title":{
"text":""
},
"subtitle":{
"text":""
},
"tooltip":{
"shared":true,
"crosshairs":true,
"borderWidth":0,
"followPointer":true,
"useHTML":true,
"headerFormat":"<span style=\"font-size: 10px;\">{point.key}</span><br><br>"
},
"xAxis":[
{
"id":"x-axis",
"type":"datetime",
"crosshair":{
"snap":false
},
"title":{
"text":"25th Sep 2019 - 1st Oct 2019",
"margin":15
}
}
],
"yAxis":[
{
"id":"y-axis-sensors",
"title":{
"text":"ºC"
},
"reversed":false,
"visible":true,
"endOnTick":false,
"startOnTick":false,
"alignTicks":false
},
{
"id":"y-axis-moisture",
"title":{
"text":"mm"
},
"opposite":true,
"min":0,
"endOnTick":false,
"startOnTick":false,
"alignTicks":false,
"tickWidth":0,
"gridLineWidth":0
}
],
"series":[
{
"type":"line",
"yAxis":"y-axis-sensors",
"marker":{
"enabled":false
},
"lineWidth":1,
"animation":false,
"name":"Full",
"seriesGroup":"levelSeries",
"id":"series-level-range-full",
"color":"#31B5E0",
"showInLegend":false,
"states":{
"hover":{
"enabled":false
}
},
"enableMouseTracking":false,
"zIndex":5,
"step":true,
"data":[
[1569369600000,5],
[1569974400000,5]
]
},
{
"type":"line",
"yAxis":"y-axis-sensors",
"marker":{
"enabled":false
},
"lineWidth":1,
"animation":false,
"name":"Refill",
"seriesGroup":"levelSeries",
"id":"series-level-range-refill",
"color":"#D23333",
"showInLegend":false,
"states":{
"hover":{
"enabled":false
}
},
"enableMouseTracking":false,
"zIndex":5,
"step":true,
"data":[
[1569369600000,17],
[1569974400000,17]
]
},
{
"type":"column",
"yAxis":"y-axis-moisture",
"marker":{
"enabled":false
},
"name":"Rainfall",
"seriesGroup":"rainfallSeries",
"states":{
"hover":{
"enabled":false
}
},
"id":"series-rainfall",
"pointWidth":6,
"borderWidth":0,
"color":"rgba(41, 182, 246, 0.3)",
"data":[
[1569488400000,5]
],
"zIndex":10,
"stacking":"normal",
"stack":"moisture"
},
{
"type":"column",
"yAxis":"y-axis-moisture",
"marker":{
"enabled":false
},
"states":{
"hover":{
"enabled":false
}
},
"name":"Irrigation",
"seriesGroup":"irrigationSeries",
"id":"series-irrigation",
"pointWidth":6,
"borderWidth":0,
"color":"rgba(205,220,57, 0.3)",
"data":[[1569574800000,3]],
"zIndex":10,
"stacking":"normal",
"stack":"moisture"
}
]
}
I am at a bit of a loss here as to why this is happening.
Can anyone shed some light on this?
One of the solutions can be to add additional x-axis and bind line series to it. Then it looks like your expected result. Check demo and code posted below.
Code:
Highcharts.chart('container', {
"chart": {
"type": "line",
"animation": {
"duration": 150
},
"events": {}
},
"credits": {
"enabled": false
},
"title": {
"text": ""
},
"subtitle": {
"text": ""
},
"tooltip": {
"shared": true,
"crosshairs": true,
"borderWidth": 0,
"followPointer": true,
"useHTML": true,
"headerFormat": "<span style=\"font-size: 10px;\">{point.key}</span><br><br>"
},
"xAxis": [{
"id": "x-axis1",
"type": "datetime",
"crosshair": {
"snap": false
},
"title": {
"text": "25th Sep 2019 - 1st Oct 2019",
"margin": 15
}
}, {
"id": "x-axis2",
visible: false,
"type": "datetime"
}],
"yAxis": [{
"id": "y-axis-sensors",
"title": {
"text": "ºC"
},
"reversed": false,
"visible": true,
"endOnTick": false,
"startOnTick": false,
"alignTicks": false
},
{
"id": "y-axis-moisture",
"title": {
"text": "mm"
},
"opposite": true,
"min": 0,
"endOnTick": false,
"startOnTick": false,
"alignTicks": false,
"tickWidth": 0,
"gridLineWidth": 0
}
],
"series": [
{
"type": "line",
xAxis: 'x-axis2',
"yAxis": "y-axis-sensors",
"marker": {
"enabled": false
},
"lineWidth": 1,
"animation": false,
"name": "Full",
"seriesGroup": "levelSeries",
"id": "series-level-range-full",
"color": "#31B5E0",
"showInLegend": false,
"states": {
"hover": {
"enabled": false
}
},
"enableMouseTracking": false,
"zIndex": 5,
"step": true,
"data": [
[1569369600000, 5],
[1569974400000, 5]
]
},
{
"type": "line",
xAxis: 'x-axis2',
"yAxis": "y-axis-sensors",
"marker": {
"enabled": false
},
"lineWidth": 1,
"animation": false,
"name": "Refill",
"seriesGroup": "levelSeries",
"id": "series-level-range-refill",
"color": "#D23333",
"showInLegend": false,
"states": {
"hover": {
"enabled": false
}
},
"enableMouseTracking": false,
"zIndex": 5,
"step": true,
"data": [
[1569369600000, 17],
[1569974400000, 17]
]
},
{
"type": "column",
xAxis: 'x-axis1',
"yAxis": "y-axis-moisture",
"marker": {
"enabled": false
},
"name": "Rainfall",
"seriesGroup": "rainfallSeries",
"states": {
"hover": {
"enabled": false
}
},
"id": "series-rainfall",
"pointWidth": 6,
"borderWidth": 0,
"color": "rgba(41, 182, 246, 0.3)",
"data": [
[1569488400000, 5]
],
"zIndex": 10,
"stacking": "normal",
"stack": "moisture"
},
{
"type": "column",
xAxis: 'x-axis1',
"yAxis": "y-axis-moisture",
"marker": {
"enabled": false
},
"states": {
"hover": {
"enabled": false
}
},
"name": "Irrigation",
"seriesGroup": "irrigationSeries",
"id": "series-irrigation",
"pointWidth": 6,
"borderWidth": 0,
"color": "rgba(205,220,57, 0.3)",
"data": [
[1569574800000, 3]
],
"zIndex": 10,
"stacking": "normal",
"stack": "moisture"
}
]
});
<script src="https://code.highcharts.com/highcharts.js"></script>
<div id="container"></div>
Demo:
https://jsfiddle.net/BlackLabel/juwc8f37/

Display series labels at the end of each line in Highcharts Editor

I am a beginner in Highcharts and I am trying to achieve what has been explained in the following case using the Highcharts Editor:
Highcharts Line Chart, display series name at the end of line series
I don't know if the same can be achieved by just using the Editor's interface but if custom code needs to be used, I can do that in the Custom Code tab of the Editor.
I tried inputting in the Custom Code section of the Highcharts Editor the code written by jlbriggs but nothing happens.
Is it possible to get a basic explanation on how to achieve what I want?
Below is the HTML code I took from the graph I created in Highcharts Editor.
<div id="highcharts-825789cd-edd9-4d9e-aba4-e3a80fa42369"></div>
<script>
(function() {
var files = ["https://code.highcharts.com/stock/highstock.js", "https://code.highcharts.com/highcharts-more.js", "https://code.highcharts.com/highcharts-3d.js", "https://code.highcharts.com/modules/data.js", "https://code.highcharts.com/modules/exporting.js", "https://code.highcharts.com/modules/funnel.js", "https://code.highcharts.com/modules/annotations.js", "https://code.highcharts.com/modules/solid-gauge.js"],
loaded = 0;
if (typeof window["HighchartsEditor"] === "undefined") {
window.HighchartsEditor = {
ondone: [cl],
hasWrapped: false,
hasLoaded: false
};
include(files[0]);
} else {
if (window.HighchartsEditor.hasLoaded) {
cl();
} else {
window.HighchartsEditor.ondone.push(cl);
}
}
function isScriptAlreadyIncluded(src) {
var scripts = document.getElementsByTagName("script");
for (var i = 0; i < scripts.length; i++) {
if (scripts[i].hasAttribute("src")) {
if ((scripts[i].getAttribute("src") || "").indexOf(src) >= 0 || (scripts[i].getAttribute("src") === "http://code.highcharts.com/highcharts.js" && src === "https://code.highcharts.com/stock/highstock.js")) {
return true;
}
}
}
return false;
}
function check() {
if (loaded === files.length) {
for (var i = 0; i < window.HighchartsEditor.ondone.length; i++) {
try {
window.HighchartsEditor.ondone[i]();
} catch (e) {
console.error(e);
}
}
window.HighchartsEditor.hasLoaded = true;
}
}
function include(script) {
function next() {
++loaded;
if (loaded < files.length) {
include(files[loaded]);
}
check();
}
if (isScriptAlreadyIncluded(script)) {
return next();
}
var sc = document.createElement("script");
sc.src = script;
sc.type = "text/javascript";
sc.onload = function() {
next();
};
document.head.appendChild(sc);
}
function each(a, fn) {
if (typeof a.forEach !== "undefined") {
a.forEach(fn);
} else {
for (var i = 0; i < a.length; i++) {
if (fn) {
fn(a[i]);
}
}
}
}
var inc = {},
incl = [];
each(document.querySelectorAll("script"), function(t) {
inc[t.src.substr(0, t.src.indexOf("?"))] = 1;
});
function cl() {
if (typeof window["Highcharts"] !== "undefined") {
var options = {
"title": {
"text": "One year, five year and 10 year survival estimates for the 21 most common cancers in England, 1971"
},
"subtitle": {
"text": "Survival estimates in 1971 (%)"
},
"exporting": {},
"chart": {
"type": "line",
"parallelAxes": {
"labels": {
"enabled": true
},
"alignTicks": true,
"endOnTick": true,
"max": 4,
"maxRange": 4,
"minorGridLineWidth": 0,
"gridLineWidth": -1
},
"inverted": false,
"height": 872,
"alignTicks": true,
"showAxes": false,
"ignoreHiddenSeries": true
},
"series": [{
"name": "Oesophagus",
"turboThreshold": 0,
"marker": {
"enabled": true
},
"type": "line",
"colorByPoint": false,
"selected": true,
"showInNavigator": true,
"dataLabels": {
"enabled": false
},
"label": {
"onArea": true,
"enabled": true
},
"allowPointSelect": true,
"xAxis": 0,
"yAxis": 0
}, {
"name": "Stomach",
"turboThreshold": 0
}, {
"name": "Colon",
"turboThreshold": 0
}, {
"name": "Rectum",
"turboThreshold": 0
}, {
"name": "Pancreas",
"turboThreshold": 0,
"marker": {
"enabled": true
},
"type": "line"
}, {
"name": "Larynx",
"turboThreshold": 0
}, {
"name": "Lung",
"turboThreshold": 0
}, {
"name": "Melanoma of skin",
"turboThreshold": 0
}, {
"name": "Breast",
"turboThreshold": 0
}, {
"name": "Cervix",
"turboThreshold": 0
}, {
"name": "Uterus",
"turboThreshold": 0
}, {
"name": "Ovary",
"turboThreshold": 0
}, {
"name": "Prostate",
"turboThreshold": 0,
"marker": {
"enabled": true
},
"colorByPoint": false
}, {
"name": "Testis",
"turboThreshold": 0
}, {
"name": "Kidney",
"turboThreshold": 0
}, {
"name": "Bladder",
"turboThreshold": 0
}, {
"name": "Brain",
"turboThreshold": 0
}, {
"name": "Hodgkin's disease",
"turboThreshold": 0
}, {
"name": "Non-Hodgkin lymphoma",
"turboThreshold": 0
}, {
"name": "Multiple myeloma",
"turboThreshold": 0
}, {
"name": "Leukaemia",
"turboThreshold": 0
}, {
"name": "Other cancers",
"turboThreshold": 0,
"label": {
"connectorAllowed": true
}
}],
"plotOptions": {
"series": {
"dataLabels": {
"enabled": false
}
}
},
"data": {
"csv": "\"Year\";\"Oesophagus\";\"Stomach\";\"Colon\";\"Rectum\";\"Pancreas\";\"Larynx\";\"Lung\";\"Melanoma of skin\";\"Breast\";\"Cervix\";\"Uterus\";\"Ovary\";\"Prostate\";\"Testis\";\"Kidney\";\"Bladder\";\"Brain\";\"Hodgkin's disease\";\"Non-Hodgkin lymphoma\";\"Multiple myeloma\";\"Leukaemia\";\"Other cancers\"\n\"1-year\";14.7;15.3;42.6;54.1;10.2;16;16.3;74.5;74;75.6;43.7;66.1;83.3;44.9;45.4;62.8;17.6;73.9;49.4;36.8;35.4;57.3\n\"5-year\";4;5.2;25.3;23.6;2.4;4.6;4.8;40.5;51.3;59;20.5;36.9;70.5;28.5;28.9;40.9;6.6;54.2;29.3;12.1;13.1;40.4\n\"10-year\";3.3;4;23;19.1;1.3;3.1;3.2;34.9;46;55.5;17.9;25.1;69.2;23;23;33.7;5;45.2;21.7;6.8;6.6;36.9",
"googleSpreadsheetKey": false,
"googleSpreadsheetWorksheet": false
},
"legend": {
"floating": false,
"enabled": false,
"verticalAlign": "bottom",
"align": "center",
"layout": "horizontal"
},
"pane": {
"background": []
},
"responsive": {
"rules": []
},
"colorAxis": {
"plotLines": [{
"label": {
"useHTML": false,
"text": "'series'",
"x": 5,
"y": 5,
"verticalAlign": "'middle'",
"textAlign": "'left'"
}
}],
"plotBands": [{}],
"labels": {
"x": 3,
"y": 2
}
},
"tooltip": {
"shared": true,
"enabled": true
},
"rangeSelector": {
"enabled": false,
"floating": false
},
"credits": {
"enabled": false
},
"xAxis": [{
"type": "category",
"labels": {
"x": 0,
"zIndex": 7
},
"opposite": true
}],
"yAxis": [{
"title": {
"text": ""
},
"labels": {
"format": "{hide}"
},
"type": "linear"
}],
"accessibility": {
"describeSingleSeries": false,
"enabled": true
}
};
new Highcharts.Chart("highcharts-825789cd-edd9-4d9e-aba4-e3a80fa42369", options);
}
}
})();
</script>
I just need the names of each series to be displayed at the end of each line rather than in the legend.
In the "Custom code" section you need to merge your custom options with the options from the editor. There should be an example of how to do that. In essense:
Highcharts.merge(true, options, {
// custom code
});
For example, you could use Highcharts.merge in the following way to achieve this:
Highcharts.merge(true, options, {
plotOptions: {
series: {
dataLabels: {
enabled: true,
formatter: function () {
// if last point
if(this.point === this.series.data[this.series.data.length-1]) {
return this.series.name;
}
}
}
}
}
});
See this Highcharts Cloud example of it in use.

Highcharts Horizontal stacked bar, reduce space between bar and x-axis

I have been working on a horizontal stacked bar in highchart. I need to remove the space between the x-axis and the bar in the chart.
You can get the details from this image:
.
Below are the chart options:
{
"chart":{
"type":"bar",
"renderTo":"ConfigurationTickets"
},
"title":{
"text":null
},
"xAxis":{
"groupPadding":0
},
"yAxis":{
"min":0,
"title":{
"text":null
},
"gridLineWidth":0,
"labels":{
"enabled":true
},
"minorTickLength":0,
"tickLength":0,
"minPadding":0.5,
"maxPadding":0.5
},
"legend":{
"enabled":false,
"reversed":true
},
"plotOptions":{
"series":{
"stacking":"percent",
"minPointLength":1,
"pointWidth":20,
"pointPadding":0,
"point":{
"events":{
}
},
"column":{
"pointPadding":0,
"groupPadding":0
},
"showInLegend":false,
"softThreshold":true
},
"cursor":"pointer",
"bar":{
"groupPadding":0.1,
"pointWidth":20,
"pointPadding":0
}
},
"series":[
{
"data":[
{
"y":3,
"color":"#ac89cb"
}
],
"name":"more than 31"
},
{
"data":[
{
"y":2,
"color":"#8d749a"
}
],
"name":"21 - 30"
},
{
"data":[
{
"y":3,
"color":"#72557b"
}
],
"name":"Less than 20"
}
]}
So, you had a lot of things out of place in your chart options.
Here's an example that uses this updated code to fill the space with the bar:
"plotOptions": {
"series": {
"stacking": "percent",
"minPointLength": 1,
"pointPadding": 0,
"groupPadding": 0,
"cursor": "pointer"
}
}
Fiddle:
http://jsfiddle.net/jlbriggs/muyz8rjz/1/

Highcharts pie legend clipped off

When the Pie chart legend is paginated, the legend items on the first line of the legend are not fully displayed, it is clipped off
Here's the fiddle for it, with the code here:
function(){
$('#container').highcharts({
credits:{
enabled:false
},
legend:{
itemStyle:{
fontFamily:'Arial',
fontSize:'10pt'
},
maxHeight:55,
},
tooltip:{
style:{
fontFamily:'Arial',
fontSize:'10pt'
}
},
title:{
style:{
color:'#000000',
fontFamily:'Arial'
},
text:'Pie legend problem',
margin:50
},
chart:{
renderTo:'container'
},
series:[
{
name:'Incident',
type:'pie',
data:[
{
name:'Nadia Wilshire',
y:49,
color:'#73a8f0'
},
{
name:'ITIL User',
y:15,
color:'#318047'
},
{
name:'David Luie',
y:9,
color:'#f5c533',
},
{
name:'Don Godfire',
y:7,
color:'#004789',
},
{
name:'Bethline Angleen',
y:5,
color:'#f18320',
},
{
name:'Howard Johnwind',
y:3,
color:'#8f5699',
},
{
name:'Luke Smith',
y:3,
color:'#1e90ff',
},
{
name:'(empty)',
y:2,
color:'#3ed662',
},
{
name:'(empty2)',
y:2,
color:'#3ed662',
},
{
name:'(empty3)',
y:2,
color:'#3ed662',
},
{
name:'(empty4)',
y:2,
color:'#3ed662',
},
]
}
],
exporting:{
enabled:true
},
plotOptions:{
pie:{
cursor:'pointer',
size:'95%',
dataLabels:{
enabled:false
},
showInLegend:true,
tooltip:{
pointFormat:'<b>{point.y}</b>'
}
}
}
});
Adjust fontsize by px and use maxHeight accordingly.
legend:{
itemStyle:{
fontFamily:'Arial',
fontSize:'13px'
},
maxHeight:58
DEMO: http://jsfiddle.net/Ly3Zr/

Resources