Highcharts Single Data Label in middle of Area - highcharts

This should be easy, I don't know why its not!
Trying to add a single label to for each of the series in the middle of the area.
So instead of a data label on each point, I just want one in the middle.
http://jsfiddle.net/CgAj2/
dataLabels: {
enabled: true,
align: 'center',
verticalAlign: 'bottom',
formatter: function() {return this.series.name; },
}
Any anyone help with this? I am sure its possible by manually adding as positioning labels, but this seems like a work around.
Thanks!

Not only for the entire series, you can have labels enabled for individual points also,
plotOptions:{
arearspline:{
datalabels: {
enabled: false
}
}
}
in series data:
data: [37707.0, 37031.0, {
y: 37037.0,
dataLabels: {
enabled: true,
formatter: function () {
return this.series.name;
}
}
},
37748.0,
39672.0,
41747.0],
updated your fiddle here: http://jsfiddle.net/CgAj2/1/
hope this will help you

Related

Highcharts datalabels are overlapping

I have a pretty busy chart that I need to clean up the overlapping datalabels on. I have tried all of the Highcharts options and previous forum answers I can find without much success. Here is my code on JSfiddle:
http://jsfiddle.net/cs4djfut/4/
plotOptions: {
column: { dataLabels: { allowOverlap: true, crop: false, overflow: 'none', enabled: true, formatter: function () { return this.series.name; } }, } },
Tried a function to change the datalabel position but it only worked on the fist datalabel.

Highchart: Bubble heading is not showing if two bubbles intersect or comes near one another in Bubble chart

In Highcharts Bubblechart if i two bubbles comes near one another or intersect one another, the name on top of one bubble is not displaying.
Is there a way to display both the bubble names.
In this the notice the two bubbles in top right enter code herehttp://jsfiddle.net/htb38096/
You can enable the allowOverlap property for data labels:
plotOptions: {
series: {
dataLabels: {
allowOverlap: true,
...
}
}
}
Live demo: http://jsfiddle.net/BlackLabel/k23xLjmn/
API Reference: https://api.highcharts.com/highcharts/series.bubble.dataLabels.enabled
try this on dataLabels:
dataLabels: {
enabled: true,
useHTML: true,
style: { textShadow: 'none',fontSize: '10px',color:'black' },
formatter: function() {
return this.point.name;
},
}

Show label for each bar in highcharts

How can I show labels for each bar in Highcharts as shown in the image below?
I think the solution you are looking is some thing like this.
This canbe achieved using the datalabels and placing them properly at the position you have desired to.
plotOptions: {
column: {
dataLabels: {
enabled: true,
y: 0,
verticalAlign: 'bottom',
inside: true,
color: 'white',
formatter: function(e) {
return this.series.name
}
}
}
},
You can set overflow to 'none' and crop to false to be able to display data labels out of the area plot.
API Reference:
http://api.highcharts.com/highcharts/plotOptions.series.dataLabels.crop
http://api.highcharts.com/highcharts/plotOptions.series.dataLabels.overflow
Example:
http://jsfiddle.net/5m0kkbhf/

Highcharts - Data label cut off

I took a sample jsfiddle and modified it here just to show a sample of what I experienced:
http://jsfiddle.net/pMwuv/
Here is what my actual datalabel code looks like:
dataLabels: {
enabled: true,
align: 'left',
verticalAlign: 'top',
style: {
color: 'black'
},
formatter: function () {
if (this.x == 19) {
return this.y + '<br>units left';
};
}
}
What I am having on my area chart is that the last data label is cut off. Is there a way to increase the width of the container or add some type of padding so that the full label shows?
Just changing the x and y position of the label will not work for my area chart. I have my chart customized so that only the last point of the chart has a data label and i want it aligned to the right of the last point and not within the chart.
But if we can get the above sample fiddle to work then the same solution should work for me.
You can add marginRight to chart like this:
chart: {
renderTo: container,
width: 550,
marginRight: 35
}
jsFiddle.
This is not a direct solution, but I suggest you to put the label at the yAxis:
yAxis: {
title: {
text: 'Units left'
}
},
And remove the other attributes, leaving just enabled: true:
plotOptions: {
series: {
dataLabels: {
enabled: true
}
}
},
See the fiddle
You can set spacingRight and add correct value.

Change placement of "exporting" option

I'd like to change the placement of the "exporting" buttons. In the moment they are positioned at the top right, and thus hiding pieces of a longer title. I'd like to change that, but don't see in the references a parameter for that.
Thanks for any hints!
There are many options to style buttons, you just have to take a look the reference.
Using exporting, you can directly style the button, like:
exporting: {
buttons: {
exportButton: {
align: 'left',
x: 40
}
}
}
demo
Using navigation you can style all buttons:
navigation: {
buttonOptions: {
align: 'center'
}
}
demo
Reference:
http://api.highcharts.com/highstock#exporting.buttons.exportButton
Ricardo's answer is almost correct. I believe the syntax has changed since he answered.
exporting button documentation
exporting: {
buttons: {
contextButton: {
align: 'left',
x: 0,
y: 380,
verticalAlign: 'top'
}
}
},
This works for me:
exporting: {
buttons: {
contextButton: {
align: 'center',
x: 50
}
}
},
You can use x/y or align parameter: ExportButton Align

Resources