Home
Analytics
Embedding a label in a bar chart
CodeRookie
<p>Good morning, all! </p>
<p> </p>
<p>Developing another chart report, and have been asked to embed a data value in each bar. Now, you might say, 'That can be done in the Chart building pop-up.', which is true, but this is a bit different. What I have been tasked to do is instead of the data showing up in the Tooltip on the mouse-over function, they want the data to be placed in an embedded label. The main pieces of data I'm charting are 'Scrap Type' and 'Weight', while the Tooltip shows 'Cost'. I'm attaching a mock-up of the actual report to show what I'm working with.</p>
<p> </p>
<p>
Find more posts tagged with
Comments
Clement Wong
<p>We can use the HTML5 chart's <strong>renderer </strong>(<a data-ipb='nomediaparse' href='
http://api.highcharts.com/highcharts/Renderer'>http://api.highcharts.com/highcharts/Renderer</a>)
to add additional text on the chart.</p>
<p> </p>
<p>Attached is an example, and the code is in the <em>afterRendering </em>event. First, we get the values of the tooltips. Then, for each tooltip, we add the text to the chart.</p>
CodeRookie
<p>Clement,</p>
<p>That worked beautifully! Thanks so much for the help!</p>
<p> </p>
<p>Have a great day!</p>
<p> </p>
<p>Scott</p>