Stacked HBar labelsAbove not appearing correctly

Share RGraph:   To help my Google visibility (it can't get much worse!), if you like and use RGraph I'd appreciate it if you could link to me

« Back to message list

Enter your email address to get email updates on this topic. You can stop receiving updates by clicking the link in the update email messages.

Posted by John S on 4th June 2016
Richard,

I'm trying to create a horizontal "range" bar chart. I need each horizontal bar to display a single color showing range between two numbers.

I also want use labelAboveSpecific text to show label text to the right of each bar.

Some items have *no* range, and I'd like to display that with a blank bar, and the appropriate label, with the label appearing in the horizontal center of the chart for that item.

The problem I'm having a problem is with labels: The last item (in the example linked to below) doesn't display the label ("Boss TU-2 (438-445)"), but rather, displays the sum of the first and second values in the data array for that item.

So, the label for the third item is showing up on the chart as "145" rather than "Boss TU-2 (438-445)".

I have the chart working locally (except for this label issue). Here is the jsfiddle with the Javascript (but I couldn't get it to link to your js libraries).


jsfiddle.net/jdscomms/w7auu559/9/


Many thanks.

--John
Posted by Richard on 4th June 2016
Hi there,

I think it's because the stacked HBar doesn't account for labelsAbove correctly - so you need to specify a blank label for the segments of the bars that aren't at the end of the bar. Like this:

www.rgraph.net/fiddle/view.html/hbar-range-example





Richard

PLEASE READ:

If RGraph has helped you please give your feedback - thanks! You can give your feedback or leave a testimonial by adding a forum post or clicking on the speech bubble icon at the very top right.

But most of all: Please link to the RGraph website! (get information by clicking on the chain icon at the top right of the page)
Posted by John S on 4th June 2016
That did it. Thanks much for the software and your help.

--John

Add a reply




« Back to message list