c3.js how to display values inside/at the top of the bars
Asked Answered
S

1

6

I've been searching the c3.js reference but couldn't find any setting that I can make the values appear in the bars. It's cool to have tooltips but it's easier in my situation to display values directly in the bar columns...

Sulamith answered 26/6, 2016 at 18:10 Comment(2)
Refer to following example:- c3js.org/samples/data_label.htmlMize
Nice. Is there any way to put the label in the center of the bar? It looks odd in a stacked bar chart... See jsfiddle.net/tom15375/fy3tm98dSulamith
M
-1

You need to override certiain c3.js internal_functions to provide desired x,y corordinate values for the svg element which contains bar values as shown below:-

enter image description here

Mize answered 27/6, 2016 at 10:40 Comment(1)
You don't need to override c3's source. Instead of that you can just add labels: true to data in your c3.generate.Chameleon

© 2022 - 2024 — McMap. All rights reserved.