Rendering¶
stroke¶
On line graphs you can disable line stroking:
chart = pygal.Line(stroke=False)
chart.add('line', [.0002, .0005, .00035])
chart.render()
fill¶
And enable line filling:
chart = pygal.Line(fill=True)
chart.add('line', [.0002, .0005, .00035])
chart.render()
zero¶
To fill to an other reference than zero:
chart = pygal.Line(fill=True, zero=.0004)
chart.add('line', [.0002, .0005, .00035])
chart.render()
show_dots¶
You can remove dots by setting show_dots
at False`
chart = pygal.Line(show_dots=False)
chart.add('line', [.0002, .0005, .00035])
chart.render()
show_only_major_dots¶
You can remove minor x-labelled dots by setting show_only_major_dots
at True
chart = pygal.Line(show_only_major_dots=True)
chart.add('line', range(12))
chart.x_labels = map(str, range(12))
chart.x_labels_major = ['2', '4', '8', '11']
chart.render()
dots_size¶
You can change the dot size
chart = pygal.Line(dots_size=5)
chart.add('line', [.0002, .0005, .00035])
chart.render()
stroke_style¶
It is possible to set a default style for lines with the stroke_style
dictionary.
chart = pygal.Line(stroke_style={'width': 5, 'dasharray': '3, 6', 'linecap': 'round', 'linejoin': 'round'})
chart.add('line', [.0002, .0005, .00035])
chart.render()
show_x_guides¶
You can force the display of x guides
chart = pygal.Line(show_x_guides=True)
chart.x_labels = ['alpha', 'beta', 'gamma']
chart.add('line', [.0002, .0005, .00035])
chart.render()
show_y_guides¶
Or disable y guides:
chart = pygal.Line(show_y_guides=False)
chart.x_labels = ['alpha', 'beta', 'gamma']
chart.add('line', [.0002, .0005, .00035])
chart.render()
style¶
see styles
You can add or replace css/js files in pygal using the css and js array options. These lists contain absolute filenames and/or external URI. (Relative filenames are relative to pygal internal files)
css¶
Default:
css = ['file://style.css', 'file://graph.css']
Css can also specified inline by prepending inline: to the css:
css = ['inline:.rect { fill: blue; }']
force_uri_protocol¶
In case of rendering the svg as a data uri, it is mandatory to specify a protocol.
It can be set to http or https and will be used for ‘//domain/’ like uri.
It is used along with render_data_uri
.