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 milliseconds displaying incorrectly in xaxis
- Highcharts Drawing a line with chart.renderer.path
- Highchart highlight area between points with custom colors
- Highchart.getSVG convert to png
- Highcharts - Stack Graph Display Average of all values
- Creating large heatmap using highcharts freezes browser
- Single Quotes not showing up properly in HighCharts graph
- How to add thousands separator in highcharts tool tip text box
- Enlarge points in highcharts
- Highcharts - Keep Zero Centered on Y-Axis with Negative Values
- Angularjs highcharts and modal windows clear previous chart
- Javascript not working when using async attribute : Highcharts
- How to display monthly data in Highcharts graph?
- Highcharts pie charts can have url links
- highchart - irregular time series
- How to design a yAxis plotline with our own CSS?
- R highcharts multiple stacked bar chart
- Issue transferring Angular2 example from Plnkr to real application
- How to make a Highstocks x-axis even and regular?
- HighChart World Map not rendering in Angular 7
- Highcharts JS remove tips & squared legends for linear chart
- Superimpose charts in highcharts
- Trigger an event when i scroll the scrollbar in highchart?
- How to convert Django datetime to HighCharts format
- Highcharts swipe smooth move feature
- How to Change the color of the text in donut chart
- Highstocks - Display year when hovering over a point
- Highstock innacurate rendering of line data series
- Highcharts sankey diagram node rearrangement
- Highcharts Line Chart with Only x-axis