Chart.js icon indicating copy to clipboard operation
Chart.js copied to clipboard

question horizontalbar and bar charts

Open Zulfia73 opened this issue 9 years ago • 4 comments

I want displayed value on item. In bar charts, in datasets item i find object of name _meta. and it have x and y position. okey.

  1. why horizontal didn't have this object?
  2. how i can value to place in center value? image

Zulfia73 avatar Jan 27 '17 14:01 Zulfia73

are you following this sample https://github.com/chartjs/Chart.js/blob/master/samples/combo-bar-line.html ?

etimberg avatar Jan 27 '17 14:01 etimberg

image @etimberg , I want that

Zulfia73 avatar Jan 27 '17 14:01 Zulfia73

Ok, so to achieve that you need to modify the position https://github.com/chartjs/Chart.js/blob/master/samples/data_labelling.html#L98 to be in the center of the bar. You can look at the implementation of tooltipPosition and work from there to create something that returns the Y value in the middle of the bar. https://github.com/chartjs/Chart.js/blob/master/src/elements/element.rectangle.js#L199-L205

etimberg avatar Jan 29 '17 14:01 etimberg

Closing as answered

etimberg avatar Feb 12 '17 18:02 etimberg