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

Display label horizontally in x-axis

Open tiaozi0912 opened this issue 11 years ago • 4 comments

http://i.stack.imgur.com/7iT0a.png

Drawing a line chart with ChartJS 1.0.1 as above. As it shows, the label in the x-axis is not horizontal although there are enough space. How can I make it horizontal?

A side question, noticed the y label, there are 1-2px clipped. How to fix that?

tiaozi0912 avatar Jan 19 '15 23:01 tiaozi0912

  1. This is because space for label is calculated from distance between two x value. IMO it's good

dany28 avatar Jan 21 '15 01:01 dany28

ad 2. Suggested fix (chart.core.js): line 1543 original:

if (firstRotated + this.fontSize / 2 > this.yLabelWidth + 8){

fix

if (firstRotated + this.fontSize / 2 > this.yLabelWidth + 10){

dany28 avatar Jan 21 '15 01:01 dany28

@dany28 Can you submit a pr?

jakesylvestre avatar Jan 25 '15 00:01 jakesylvestre

@tiaozi0912 Huzzah! The first alpha of Chart.js 2.0 has landed and should fix this issue. Check out the release and try it out! We've got a lot of momentum right now, so please help us test so we can launch 2.0 Gold by the end of the month. https://github.com/nnnick/Chart.js/releases/tag/v2.0-alpha

I'm closing this issue for now, but if you have implementation questions or find bugs, please create a jsfiddle and post the link here and we'll reopen this issue and get it fixed.

derekperkins avatar Jun 04 '15 05:06 derekperkins