pygal icon indicating copy to clipboard operation
pygal copied to clipboard

X_labels_major displays corrupted values with rotation of 0

Open ch359 opened this issue 9 years ago • 0 comments

With the code below, the major axis labels display perfectly when x_label_rotation > 0. When set to zero (or the arg is removed entirely), the major x labels truncate with a symbol, even though there is loads of whitespace.

The workaround is to use truncate_label = 6, but I gather from the images in the pygal docs that the truncate should take effect by showing '...' rather than the symbols in the screenshot and additionally that they should only be truncated when they are 'long labels'.

I'm very limited in my python and/or programming knowledge, so apologies if it's something I'm doing wrong and it's not a bug. I'm using pygal 2.4.0 installed through pip3 and python3.6.2.

#!/usr/local/bin/python3
import pygal

graph = pygal.Line(x_labels_major_every=5, show_minor_x_labels=False, x_label_rotation=0)
graph.x_labels = [201510, 201511, 201512, 201601, 201602, 201603, 201604, 201605, 201606, 201607, 201608, 201609, 201610, 201611, 201612, 201701, 201702, 201703, 201704, 201705, 201706, 201707]
graph.x_labels_major = [201510, 201511, 201512, 201601, 201602, 201603, 201604, 201605, 201606, 201607, 201608, 201609, 201610, 201611, 201612, 201701, 201702, 201703, 201704, 201705, 201706, 201707]
graph.add('Data', [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22])
graph.render_in_browser()

With rotation = 0: image Rotation = 1 image

ch359 avatar Aug 23 '17 11:08 ch359