rickshaw icon indicating copy to clipboard operation
rickshaw copied to clipboard

Fix x-axis label rendering partially off the side of the chart when it is too long

Open mbooth101 opened this issue 12 years ago • 3 comments
trafficstars

I have found that when an time-axis label doesn't fit between its graticule and the edge of the chart, the label dangles off the side of the chart. Here is an illustration:

Before

This commit enhances the time axis so that it does not render the label if it will not fit on the chart:

After

Note that it removes the label after adding (instead of preventing it from being added) because I have read that you cannot reliably find an element's width before it is added to the DOM.

mbooth101 avatar Mar 11 '13 21:03 mbooth101

So you detect when it's outside of the chart, why not flip it to the other side?

drakonen avatar Oct 02 '14 15:10 drakonen

I don't think I understand this comment. Wouldn't a graticule label be misleading if you rendered it some place other that should be?

mbooth101 avatar Oct 02 '14 15:10 mbooth101

@mbooth101, yes, yes it would, I misread. Sorry!

drakonen avatar Oct 02 '14 15:10 drakonen