Skip to content

Latest commit

 

History

History
87 lines (58 loc) · 1.89 KB

legend.rst

File metadata and controls

87 lines (58 loc) · 1.89 KB

Legend

show_legend

You can remove legend by setting this to False

chart = pygal.Line(show_legend=False) chart.add('Serie 1', [1, 2, 3]) chart.add('Serie 2', [4, 2, 0]) chart.add('Serie 3', [1, -1, 1]) chart.add('Serie 4', [3, 1, 5])

legend_at_bottom

You can put legend at bottom by setting legend_at_bottom to True:

chart = pygal.Line(legend_at_bottom=True) chart.add('Serie 1', [1, 2, 3]) chart.add('Serie 2', [4, 2, 0]) chart.add('Serie 3', [1, -1, 1]) chart.add('Serie 4', [3, 1, 5])

legend_at_bottom_columns

Force the number of legend columns when set at bottom

chart = pygal.Line(legend_at_bottom=True, legend_at_bottom_columns=4) chart.add('Serie 1', [1, 2, 3]) chart.add('Serie 2', [4, 2, 0]) chart.add('Serie 3', [1, -1, 1]) chart.add('Serie 4', [3, 1, 5])

legend_box_size

chart = pygal.Line(legend_box_size=18) chart.add('Serie 1', [1, 2, 3]) chart.add('Serie 2', [4, 2, 0]) chart.add('Serie 3', [1, -1, 1]) chart.add('Serie 4', [3, 1, 5])

truncate_legend

By default long legends are automatically truncated at reasonable length to fit in the graph.

You can override that by setting truncation lenght with truncate_legend.

chart = pygal.Line(truncate_legend=17) chart.x_labels = [ 'This is the first point !', 'This is the second point !', 'This is the third point !', 'This is the fourth point !'] chart.add('line', [0, .0002, .0005, .00035])

or disable it by setting this to -1

chart = pygal.Line(truncate_legend=-1) chart.x_labels = [ 'This is the first point !', 'This is the second point !', 'This is the third point !', 'This is the fourth point !'] chart.add('line', [0, .0002, .0005, .00035])