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 Articles
- 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
- The empty space on the chart xaxis
- Highcharts not working with jQuery 1.8, any workaround?
- HighCharts round down when over 100
- How to build chart in highchart.js where xAxis(miliseconds) and yAxis(days)?
- Using the source version instead of mimified when import lib with reactjs and npm
- Highcharts: How we can sort series with animation?
- Sorting data from database, to use in chart. PHP
- Python Flask: Highcharts path allocation
- dataClasses name in tooltip through formatter function [Highcharts]
- Highcharts gauge chart customization
- How to make the percentage symbol smaller than the number?
- Showing arrays in an array in tooltip in Highcharts
- UseHTML=True in legend ignores itemWidth on click
- Selecting different types of charts
- how to pass json string to line highchart?
- highcharts heatmap Uncaught TypeError: Cannot read property 'prototype' of undefined
- highcharts from event LegendItemClick to event textItemClick and iconItemClick
- VueJS App put data from GET request inside an array
- How to show BAr graph rather than line graph in High Stoch Chart
- HighCarts Tooltip position relative to mouse