score:2
Accepted answer
you can render the text once, then look at the bounding box of the element to determine the width of the text, and then use this information to create a correctly positioned text by rendering it again.
for example:
var element = r.text('19% yoy increase ', 0 , 0)
.css({
fontsize: '11px'
}).add();
var width = element.getbbox().width;
element.destroy();
r.text('19% yoy increase ', data[0].plotx + chart.plotleft - (width/2) , starty)
.css({
color: '#4572a7',
fontsize: '11px'
}).add();
see this jsfiddle for a demonstration.
Source: stackoverflow.com
Related Query
- adding labels exactly above x-axis categories in highcharts
- Highcharts : How do i align data labels above the axis in column chart?
- Width for labels on x Axis with grouped Categories in Highcharts
- Always display data labels above columns in HighCharts
- Highcharts Area graph, use 2 fill colors above / below X axis
- Highcharts - Long multi-line y axis labels causing following label to be removed
- Highcharts - with datetime axis labels overlap
- Highcharts use series labels as x-axis categories
- Highcharts - Multiple Axis Graph not displaying labels
- Show some specefic number on gauge highcharts axis labels
- How to adjust line-height/ellipses in Highcharts axis labels
- Swap categories and labels highcharts (bar plots)
- Highcharts -- Can't apply style to x axis labels
- How to position labels for plotbands on y axis in Highcharts
- HighCharts - Show categories in x axis intead of the value of x in Bubble Chart
- Chart's width is impacting to my second x axis labels in Highcharts
- How To Show All Data Labels For Datetime Axis In Highcharts
- Wrong labels on X axis on Highcharts
- Replace axis labels with custom in highcharts r
- Negative value for categories axis in highcharts
- How to handle mouse events on axis labels in highcharts
- Fourth y axis does not show labels in Highcharts
- How to display rounded corners in a highcharts column on a Y Axis that starts above 0
- HighCharts Bubble Chart: text for axis interval labels
- Multiple images for Highcharts X Axis Labels
- Highcharts - How to force line chart to be visible above X Axis
- Highcharts 4.1.1 adding a severe drop shadow to data labels if you specify a font color
- Add Sub categories to y axis on highcharts
- How to resize bar chart based on no of x axis categories in HighCharts
- Highcharts X axis categories name gets only shows 1 character
More Query from same tag
- Highcharts y-axis tick interval
- How to format the following JSON data using Javascript/Jquery?
- How To Use Epoch Time With Highcharts Series Data?
- Highcharts - kind of hack for stick plot timeseries
- Negative Fill color in AreaSpline Graph
- How to display rounded corners in a highcharts column on a Y Axis that starts above 0
- How to customize highchart treemap datalabels?
- Highchart (stockchart) Yaxis on opposite side miss align when left axis is not visible
- Prolems with highcharts
- HighCharts - applying a formatting function over plot options
- Highcharts - temperature gauge
- How to draw single line graph using Highchart bullet graph?
- Is there a way to limit legends on a horizontal layout on specific amount of rows during export?
- Highcharts numericSymbols when rendered server-side with Phantomjs
- HighCharts is not defined
- Highchart is not working when I am fetching the axis values from database
- How to open new chart to the adjacent <div> on bar click in highchart
- Configure Data Table at bottom in Highcharts
- High charts Donut Chart not rendering
- Highcharts increasing/decreasing data from input
- Displaying data into a graph in web service ASP.NET MVC Framework
- In highcharts, is it possible get the exact position of x axis labels for overlap detection purpose?
- Align points with grouped bars
- Highcharts Legend: Overlapping Chart on Small Screens
- Highcharts erroneously inserting numbered extra categories in error
- HighCharts show selected point from chart on Pie Chart
- Convert DataTable to array for highcharts
- highcharts series remove function deletes all original series data (even after stored in new variable)
- Highcharts organization charts - nodes displayed incorrectly
- getting csv data into highcharts