mirror of https://github.com/Kozea/pygal.git
Florian Mounier
9 years ago
105 changed files with 1818 additions and 1307 deletions
@ -0,0 +1,7 @@
|
||||
pygal.adapters module |
||||
===================== |
||||
|
||||
.. automodule:: pygal.adapters |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -0,0 +1,7 @@
|
||||
pygal.colors module |
||||
=================== |
||||
|
||||
.. automodule:: pygal.colors |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -0,0 +1,7 @@
|
||||
pygal.config module |
||||
=================== |
||||
|
||||
.. automodule:: pygal.config |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -0,0 +1,7 @@
|
||||
pygal.etree module |
||||
================== |
||||
|
||||
.. automodule:: pygal.etree |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -0,0 +1,7 @@
|
||||
pygal.graph.bar module |
||||
====================== |
||||
|
||||
.. automodule:: pygal.graph.bar |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -0,0 +1,7 @@
|
||||
pygal.graph.base module |
||||
======================= |
||||
|
||||
.. automodule:: pygal.graph.base |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -0,0 +1,7 @@
|
||||
pygal.graph.box module |
||||
====================== |
||||
|
||||
.. automodule:: pygal.graph.box |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -0,0 +1,7 @@
|
||||
pygal.graph.dot module |
||||
====================== |
||||
|
||||
.. automodule:: pygal.graph.dot |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -0,0 +1,7 @@
|
||||
pygal.graph.funnel module |
||||
========================= |
||||
|
||||
.. automodule:: pygal.graph.funnel |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -0,0 +1,7 @@
|
||||
pygal.graph.gauge module |
||||
======================== |
||||
|
||||
.. automodule:: pygal.graph.gauge |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -0,0 +1,7 @@
|
||||
pygal.graph.graph module |
||||
======================== |
||||
|
||||
.. automodule:: pygal.graph.graph |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -0,0 +1,7 @@
|
||||
pygal.graph.histogram module |
||||
============================ |
||||
|
||||
.. automodule:: pygal.graph.histogram |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -0,0 +1,7 @@
|
||||
pygal.graph.horizontal module |
||||
============================= |
||||
|
||||
.. automodule:: pygal.graph.horizontal |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -0,0 +1,7 @@
|
||||
pygal.graph.horizontalbar module |
||||
================================ |
||||
|
||||
.. automodule:: pygal.graph.horizontalbar |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -0,0 +1,7 @@
|
||||
pygal.graph.horizontalstackedbar module |
||||
======================================= |
||||
|
||||
.. automodule:: pygal.graph.horizontalstackedbar |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -0,0 +1,7 @@
|
||||
pygal.graph.line module |
||||
======================= |
||||
|
||||
.. automodule:: pygal.graph.line |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -0,0 +1,7 @@
|
||||
pygal.graph.map module |
||||
====================== |
||||
|
||||
.. automodule:: pygal.graph.map |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -0,0 +1,7 @@
|
||||
pygal.graph.pie module |
||||
====================== |
||||
|
||||
.. automodule:: pygal.graph.pie |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -0,0 +1,7 @@
|
||||
pygal.graph.public module |
||||
========================= |
||||
|
||||
.. automodule:: pygal.graph.public |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -0,0 +1,7 @@
|
||||
pygal.graph.pyramid module |
||||
========================== |
||||
|
||||
.. automodule:: pygal.graph.pyramid |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -0,0 +1,7 @@
|
||||
pygal.graph.radar module |
||||
======================== |
||||
|
||||
.. automodule:: pygal.graph.radar |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -0,0 +1,7 @@
|
||||
pygal.graph.stackedbar module |
||||
============================= |
||||
|
||||
.. automodule:: pygal.graph.stackedbar |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -0,0 +1,7 @@
|
||||
pygal.graph.stackedline module |
||||
============================== |
||||
|
||||
.. automodule:: pygal.graph.stackedline |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -0,0 +1,7 @@
|
||||
pygal.graph.time module |
||||
======================= |
||||
|
||||
.. automodule:: pygal.graph.time |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -0,0 +1,7 @@
|
||||
pygal.graph.treemap module |
||||
========================== |
||||
|
||||
.. automodule:: pygal.graph.treemap |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -0,0 +1,7 @@
|
||||
pygal.graph.verticalpyramid module |
||||
================================== |
||||
|
||||
.. automodule:: pygal.graph.verticalpyramid |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -0,0 +1,7 @@
|
||||
pygal.graph.xy module |
||||
===================== |
||||
|
||||
.. automodule:: pygal.graph.xy |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -0,0 +1,7 @@
|
||||
pygal.interpolate module |
||||
======================== |
||||
|
||||
.. automodule:: pygal.interpolate |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -1,10 +1,8 @@
|
||||
pygal.maps package |
||||
================== |
||||
|
||||
Module contents |
||||
--------------- |
||||
|
||||
.. automodule:: pygal.maps |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
||||
|
||||
|
@ -0,0 +1,7 @@
|
||||
pygal.serie module |
||||
================== |
||||
|
||||
.. automodule:: pygal.serie |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -0,0 +1,7 @@
|
||||
pygal.state module |
||||
================== |
||||
|
||||
.. automodule:: pygal.state |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -0,0 +1,7 @@
|
||||
pygal.style module |
||||
================== |
||||
|
||||
.. automodule:: pygal.style |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -0,0 +1,7 @@
|
||||
pygal.svg module |
||||
================ |
||||
|
||||
.. automodule:: pygal.svg |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -0,0 +1,7 @@
|
||||
pygal.table module |
||||
================== |
||||
|
||||
.. automodule:: pygal.table |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -0,0 +1,7 @@
|
||||
pygal.test.conftest module |
||||
========================== |
||||
|
||||
.. automodule:: pygal.test.conftest |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -0,0 +1,7 @@
|
||||
pygal.test.test_bar module |
||||
========================== |
||||
|
||||
.. automodule:: pygal.test.test_bar |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -0,0 +1,7 @@
|
||||
pygal.test.test_box module |
||||
========================== |
||||
|
||||
.. automodule:: pygal.test.test_box |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -0,0 +1,7 @@
|
||||
pygal.test.test_colors module |
||||
============================= |
||||
|
||||
.. automodule:: pygal.test.test_colors |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -0,0 +1,7 @@
|
||||
pygal.test.test_config module |
||||
============================= |
||||
|
||||
.. automodule:: pygal.test.test_config |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -0,0 +1,7 @@
|
||||
pygal.test.test_date module |
||||
=========================== |
||||
|
||||
.. automodule:: pygal.test.test_date |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -0,0 +1,7 @@
|
||||
pygal.test.test_donut module |
||||
============================ |
||||
|
||||
.. automodule:: pygal.test.test_donut |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -0,0 +1,7 @@
|
||||
pygal.test.test_graph module |
||||
============================ |
||||
|
||||
.. automodule:: pygal.test.test_graph |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -0,0 +1,7 @@
|
||||
pygal.test.test_histogram module |
||||
================================ |
||||
|
||||
.. automodule:: pygal.test.test_histogram |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -0,0 +1,7 @@
|
||||
pygal.test.test_interpolate module |
||||
================================== |
||||
|
||||
.. automodule:: pygal.test.test_interpolate |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -0,0 +1,7 @@
|
||||
pygal.test.test_line module |
||||
=========================== |
||||
|
||||
.. automodule:: pygal.test.test_line |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -0,0 +1,7 @@
|
||||
pygal.test.test_maps module |
||||
=========================== |
||||
|
||||
.. automodule:: pygal.test.test_maps |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -0,0 +1,7 @@
|
||||
pygal.test.test_pie module |
||||
========================== |
||||
|
||||
.. automodule:: pygal.test.test_pie |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -0,0 +1,7 @@
|
||||
pygal.test.test_serie_config module |
||||
=================================== |
||||
|
||||
.. automodule:: pygal.test.test_serie_config |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -0,0 +1,7 @@
|
||||
pygal.test.test_sparktext module |
||||
================================ |
||||
|
||||
.. automodule:: pygal.test.test_sparktext |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -0,0 +1,7 @@
|
||||
pygal.test.test_stacked module |
||||
============================== |
||||
|
||||
.. automodule:: pygal.test.test_stacked |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -0,0 +1,7 @@
|
||||
pygal.test.test_style module |
||||
============================ |
||||
|
||||
.. automodule:: pygal.test.test_style |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -0,0 +1,7 @@
|
||||
pygal.test.test_table module |
||||
============================ |
||||
|
||||
.. automodule:: pygal.test.test_table |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -0,0 +1,7 @@
|
||||
pygal.test.test_util module |
||||
=========================== |
||||
|
||||
.. automodule:: pygal.test.test_util |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -0,0 +1,7 @@
|
||||
pygal.test.test_view module |
||||
=========================== |
||||
|
||||
.. automodule:: pygal.test.test_view |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -0,0 +1,7 @@
|
||||
pygal.test.test_xml_filters module |
||||
================================== |
||||
|
||||
.. automodule:: pygal.test.test_xml_filters |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -0,0 +1,7 @@
|
||||
pygal.test.utils module |
||||
======================= |
||||
|
||||
.. automodule:: pygal.test.utils |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -0,0 +1,7 @@
|
||||
pygal.util module |
||||
================= |
||||
|
||||
.. automodule:: pygal.util |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -0,0 +1,7 @@
|
||||
pygal.view module |
||||
================= |
||||
|
||||
.. automodule:: pygal.view |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -1,614 +0,0 @@
|
||||
Basic customizations |
||||
==================== |
||||
|
||||
|
||||
How to customize: |
||||
----------------- |
||||
|
||||
pygal is customized with the help of the `Config` class (see `config.py <https://github.com/Kozea/pygal/blob/master/pygal/config.py>`_). It can be changed in several ways: |
||||
|
||||
.. pygal:: |
||||
|
||||
from pygal import Config |
||||
config = Config() |
||||
config.show_legend = False |
||||
config.human_readable = True |
||||
config.fill = True |
||||
config.x_scale = config.y_scale = 0.25 |
||||
chart = pygal.XY(config) |
||||
from math import cos, sin, pi |
||||
a = 2 * pi / 5. |
||||
chart.add('*', [(cos(i*a+pi/2.), sin(i*a+pi/2.)) for i in (0,2,4,1,3,0)]) |
||||
|
||||
|
||||
By instanciating it |
||||
~~~~~~~~~~~~~~~~~~~ |
||||
|
||||
Just import the `Config` class and instanciate it: |
||||
|
||||
.. code-block:: python |
||||
|
||||
from pygal import Config |
||||
|
||||
config = Config() |
||||
config.show_legend = False |
||||
config.human_readable = True |
||||
config.fill = True |
||||
config.x_scale = .25 |
||||
config.y_scale = .25 |
||||
chart = pygal.XY(config) |
||||
... |
||||
|
||||
By inheriting it |
||||
~~~~~~~~~~~~~~~~ |
||||
|
||||
Import the `Config` class and override it: |
||||
|
||||
.. code-block:: python |
||||
|
||||
from pygal import Config |
||||
|
||||
class StarConfig(Config): |
||||
show_legend = False |
||||
human_readable = True |
||||
fill = True |
||||
x_scale = .25 |
||||
y_scale = .25 |
||||
|
||||
chart = pygal.XY(StarConfig()) |
||||
... |
||||
|
||||
|
||||
Using keyword args |
||||
~~~~~~~~~~~~~~~~~~ |
||||
|
||||
As a shorthand for a one shot config, you can specify all config arguments as keyword args: |
||||
|
||||
.. code-block:: python |
||||
|
||||
chart = pygal.XY(show_legend=False, human_readable=True, fill=True, x_scale=.25, y_scale=.25) |
||||
... |
||||
|
||||
|
||||
Size |
||||
---- |
||||
|
||||
``width, height, explicit_size`` |
||||
|
||||
|
||||
The simplest and usefull customizations is the svg size to render. |
||||
It indicates the desired size of the svg. |
||||
|
||||
|
||||
.. pygal-code:: 200 100 |
||||
|
||||
chart = pygal.Bar(width=200, height=100) |
||||
chart.add('1', 1) |
||||
chart.add('2', 2) |
||||
|
||||
You can also set `explicit_size` to True to add size attributes to the svg tag. |
||||
|
||||
|
||||
Spacing |
||||
------- |
||||
|
||||
``spacing, margin`` |
||||
|
||||
Spacing determines the space between all elements: |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Bar(spacing=50) |
||||
chart.x_labels = u'αβγδ' |
||||
chart.add('line 1', [5, 15, 10, 8]) |
||||
chart.add('line 2', [15, 20, 8, 11]) |
||||
|
||||
|
||||
Margin is the external chart margin: |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Bar(margin=50) |
||||
chart.x_labels = u'αβγδ' |
||||
chart.add('line 1', [5, 15, 10, 8]) |
||||
chart.add('line 2', [15, 20, 8, 11]) |
||||
|
||||
|
||||
|
||||
Scaling |
||||
------- |
||||
|
||||
``include_x_axis`` |
||||
|
||||
Scales are computed automaticaly between the min and the max values. |
||||
|
||||
You may want to always have the absissa in your graph: |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(include_x_axis=True) |
||||
chart.add('line', [.0002, .0005, .00035]) |
||||
|
||||
|
||||
``range`` |
||||
|
||||
You may also want to explicitly set a range, `range` takes a tuple containing min and max: |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(range=(.0001, .001)) |
||||
chart.add('line', [.0002, .0005, .00035]) |
||||
|
||||
|
||||
``order_min`` |
||||
|
||||
Finaly you can tell at which precision pygal should stop scaling (in log10): |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(order_min=-4) |
||||
chart.add('line', [.0002, .0005, .00035]) |
||||
|
||||
|
||||
|
||||
Titles |
||||
------ |
||||
|
||||
Chart title |
||||
~~~~~~~~~~~ |
||||
|
||||
``title`` |
||||
|
||||
You can add a title to the chart by setting the `title` option: |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(title=u'Some points') |
||||
chart.add('line', [.0002, .0005, .00035]) |
||||
|
||||
|
||||
X title |
||||
~~~~~~~ |
||||
|
||||
``x_title`` |
||||
|
||||
You can add a title to the x axis by setting the `x_title` option: |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(title=u'Some points', x_title='X Axis') |
||||
chart.add('line', [.0002, .0005, .00035]) |
||||
|
||||
|
||||
Y title |
||||
~~~~~~~ |
||||
|
||||
``y_title`` |
||||
|
||||
You can add a title to the y axis by setting the `y_title` option: |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(title=u'Some points', y_title='Y Axis') |
||||
chart.add('line', [.0002, .0005, .00035]) |
||||
|
||||
|
||||
Font size |
||||
~~~~~~~~~ |
||||
|
||||
``title_font_size`` |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(title=u'Some points', x_title='X Axis', y_title='Y Axis', |
||||
title_font_size=24) |
||||
chart.add('line', [.0002, .0005, .00035]) |
||||
|
||||
|
||||
Labels |
||||
------ |
||||
|
||||
Add labels |
||||
~~~~~~~~~~ |
||||
|
||||
``x_labels, y_labels`` |
||||
|
||||
You can specify x labels and y labels, depending on the graph type: |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line() |
||||
chart.x_labels = 'Red', 'Blue', 'Green' |
||||
chart.y_labels = .0001, .0003, .0004, .00045, .0005 |
||||
chart.add('line', [.0002, .0005, .00035]) |
||||
|
||||
|
||||
Remove y labels |
||||
~~~~~~~~~~~~~~~ |
||||
|
||||
``show_y_labels`` |
||||
|
||||
Set this to False to deactivate y labels: |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(show_y_labels=False) |
||||
chart.add('line', [.0002, .0005, .00035]) |
||||
|
||||
|
||||
Rotate labels |
||||
~~~~~~~~~~~~~ |
||||
|
||||
``x_label_rotation, y_label_rotation`` |
||||
|
||||
|
||||
Allow label rotation (in degrees) to avoid axis cluttering: |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line() |
||||
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]) |
||||
|
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(x_label_rotation=20) |
||||
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]) |
||||
|
||||
|
||||
Change minor/major labels |
||||
~~~~~~~~~~~~~~~~~~~~~~~~~ |
||||
|
||||
``x_labels_major, x_labels_major_every, x_labels_major_count, show_minor_x_labels, y_labels_major, y_labels_major_every, y_labels_major_count, show_minor_y_labels`` |
||||
|
||||
You can alter major minor behaviour of axes thanks to `Arjen Stolk <https://github.com/simplyarjen>`_ |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(x_label_rotation=20) |
||||
chart.x_labels = [ |
||||
'This is the first point !', |
||||
'This is the second point !', |
||||
'This is the third point !', |
||||
'This is the fourth point !'] |
||||
chart.x_labels_major = ['This is the first point !', 'This is the fourth point !'] |
||||
chart.add('line', [0, .0002, .0005, .00035]) |
||||
|
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(x_label_rotation=20, x_labels_major_every=3) |
||||
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]) |
||||
|
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(x_label_rotation=20, x_labels_major_count=3) |
||||
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]) |
||||
|
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(x_label_rotation=20, show_minor_x_labels=False) |
||||
chart.x_labels = [ |
||||
'This is the first point !', |
||||
'This is the second point !', |
||||
'This is the third point !', |
||||
'This is the fourth point !'] |
||||
chart.x_labels_major = ['This is the first point !', 'This is the fourth point !'] |
||||
chart.add('line', [0, .0002, .0005, .00035]) |
||||
|
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(y_label_rotation=-20) |
||||
chart.y_labels_major = [] |
||||
chart.add('line', [0, .0002, .0005, .00035]) |
||||
|
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line() |
||||
chart.y_labels_major = [.0001, .0004] |
||||
chart.add('line', [0, .0002, .0005, .00035]) |
||||
|
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(y_label_rotation=20, y_labels_major_every=3) |
||||
chart.add('line', [0, .0002, .0005, .00035]) |
||||
|
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(y_labels_major_count=3) |
||||
chart.add('line', [0, .0002, .0005, .00035]) |
||||
|
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(y_labels_major_every=2, show_minor_y_labels=False) |
||||
chart.add('line', [0, .0002, .0005, .00035]) |
||||
|
||||
|
||||
Font size |
||||
~~~~~~~~~ |
||||
|
||||
``label_font_size, major_label_font_size`` |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(x_label_rotation=20, label_font_size=8, major_label_font_size=12) |
||||
chart.x_labels = [ |
||||
'This is the first point !', |
||||
'This is the second point !', |
||||
'This is the third point !', |
||||
'This is the fourth point !'] |
||||
chart.x_labels_major = ['This is the first point !', 'This is the fourth point !'] |
||||
chart.add('line', [0, .0002, .0005, .00035]) |
||||
|
||||
|
||||
Dots |
||||
---- |
||||
|
||||
Removing |
||||
~~~~~~~~ |
||||
|
||||
``show_dots`` |
||||
|
||||
You can remove dots by setting `show_dots` at `False` |
||||
|
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(show_dots=False) |
||||
chart.add('line', [.0002, .0005, .00035]) |
||||
|
||||
|
||||
``show_only_major_dots`` |
||||
|
||||
You can remove minor x-labelled dots by setting `show_only_major_dots` at `True` |
||||
|
||||
.. pygal-code:: |
||||
|
||||
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'] |
||||
|
||||
|
||||
Size |
||||
~~~~ |
||||
|
||||
``dots_size`` |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(dots_size=5) |
||||
chart.add('line', [.0002, .0005, .00035]) |
||||
|
||||
|
||||
Legends |
||||
------- |
||||
|
||||
Removing |
||||
~~~~~~~~ |
||||
|
||||
``show_legend`` |
||||
|
||||
You can remove legend by setting these at `False` |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(show_legend=False) |
||||
chart.add('line', [.0002, .0005, .00035]) |
||||
|
||||
|
||||
Legend at bottom |
||||
~~~~~~~~~~~~~~~~ |
||||
|
||||
``legend_at_bottom`` |
||||
|
||||
You can put legend at bottom by setting `legend_at_bottom` at True: |
||||
|
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(legend_at_bottom=True) |
||||
chart.add('line', [.0002, .0005, .00035]) |
||||
|
||||
|
||||
Legend box size |
||||
~~~~~~~~~~~~~~~ |
||||
|
||||
``legend_box_size`` |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(legend_box_size=18) |
||||
chart.add('line', [.0002, .0005, .00035]) |
||||
|
||||
|
||||
Font size |
||||
~~~~~~~~~ |
||||
|
||||
``legend_font_size`` |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(legend_font_size=20) |
||||
chart.add('line', [.0002, .0005, .00035]) |
||||
|
||||
|
||||
Tooltip |
||||
------- |
||||
|
||||
Rounded corner |
||||
~~~~~~~~~~~~~~ |
||||
|
||||
``tooltip_border_radius`` |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(tooltip_border_radius=10) |
||||
chart.add('line', [.0002, .0005, .00035]) |
||||
|
||||
|
||||
Font size |
||||
~~~~~~~~~ |
||||
|
||||
``tooltip_font_size`` |
||||
|
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(tooltip_font_size=24) |
||||
chart.add('line', [.0002, .0005, .00035]) |
||||
|
||||
Precision |
||||
~~~~~~~~~ |
||||
|
||||
``value_formatter`` |
||||
|
||||
You can specifiy how the values are displayed on the tooltip using a lambda function. |
||||
The code below shows the values to 2 decimal places. |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(range=(0, 5)) |
||||
chart.add('line', [.070106781, 1.414213562, 3.141592654]) |
||||
chart.value_formatter = lambda x: "%.2f" % x |
||||
|
||||
The datey graph shows the tooltip as "x=? y=?", where the x format is the same as the x_label_format, and the y format is specified via the value_formatter. |
||||
|
||||
Two y axes |
||||
---------- |
||||
|
||||
``secondary`` |
||||
|
||||
You can plot your values to 2 separate axes, thanks to `wiktorn <https://github.com/wiktorn>`_ |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(title=u'Some different points') |
||||
chart.add('line', [.0002, .0005, .00035]) |
||||
chart.add('other line', [1000, 2000, 7000], secondary=True) |
||||
|
||||
|
||||
Rendering |
||||
--------- |
||||
|
||||
``fill, stroke, zero`` |
||||
|
||||
You can disable line stroking: |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(stroke=False) |
||||
chart.add('line', [.0002, .0005, .00035]) |
||||
|
||||
And enable line filling: |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(fill=True) |
||||
chart.add('line', [.0002, .0005, .00035]) |
||||
|
||||
To fill to an other reference than zero: |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(fill=True, zero=.0004) |
||||
chart.add('line', [.0002, .0005, .00035]) |
||||
|
||||
|
||||
Font sizes |
||||
---------- |
||||
|
||||
``value_font_size, tooltip_font_size`` |
||||
|
||||
|
||||
Set the various font size |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(label_font_size=34, legend_font_size=8) |
||||
chart.add('line', [0, .0002, .0005, .00035]) |
||||
|
||||
|
||||
Text truncation |
||||
--------------- |
||||
|
||||
``truncate_legend, truncate_label`` |
||||
|
||||
By default long text are automatically truncated at reasonable length which fit in the graph. |
||||
|
||||
You can override that by setting truncation lenght with `truncate_legend` and `truncate_label`. |
||||
|
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(truncate_legend=3, truncate_label=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]) |
||||
|
||||
|
||||
Human readable |
||||
-------------- |
||||
|
||||
``human_readable`` |
||||
|
||||
|
||||
Display values in human readable form: |
||||
|
||||
1 230 000 -> 1.23M |
||||
.00 098 7 -> 987µ |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(human_readable=True, y_scale=.0001) |
||||
chart.add('line', [0, .0002, .0005, .00035]) |
||||
|
||||
|
||||
No data text |
||||
------------ |
||||
|
||||
``no_data_text`` |
||||
|
||||
|
||||
Text to display instead of the graph when no data is supplied: |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line() |
||||
chart.add('line', []) |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(no_data_text='No result found') |
||||
chart.add('line', []) |
||||
|
@ -0,0 +1,109 @@
|
||||
Axis |
||||
==== |
||||
|
||||
|
||||
include_x_axis |
||||
-------------- |
||||
|
||||
Scales are computed automaticaly between the min and the max values. |
||||
|
||||
You may want to always have the absissa in your graph: |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(include_x_axis=True) |
||||
chart.add('line', [.0002, .0005, .00035]) |
||||
|
||||
|
||||
inverse_y_axis |
||||
-------------- |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(inverse_y_axis=True) |
||||
chart.add('line', [.0002, .0005, .00035]) |
||||
|
||||
|
||||
range |
||||
----- |
||||
|
||||
In pygal you can override automatic scaling by setting ``y_labels`` to the values you want, but if you want to change the scaling range and keep auto scaling in it, you can set a ``range`` which is a tuple containing the desired min and max: |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(range=(.0001, .001)) |
||||
chart.add('line', [.0002, .0005, .00035]) |
||||
|
||||
|
||||
xrange |
||||
------ |
||||
|
||||
For xy graph xrange can be used for the x axis. |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.XY(xrange=(10, 30)) |
||||
chart.add('line', [(10, .0002), (15, .0005), (12, .00035)]) |
||||
|
||||
|
||||
secondary_range |
||||
--------------- |
||||
|
||||
For chart with two axis, the ``secondary_range`` defines the range for the secondary axis. |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(secondary_range=(10, 25)) |
||||
chart.add('primary', [.0002, .0005, .00035]) |
||||
chart.add('secondary', [10, 15, 12], secondary=True) |
||||
|
||||
|
||||
logarithmic |
||||
----------- |
||||
|
||||
You can set the scale to be logarithmic: |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(logarithmic=True) |
||||
values = [1, 3, 43, 123, 1231, 23192] |
||||
chart.x_labels = map(str, values) |
||||
chart.add('log example', values) |
||||
|
||||
.. caution:: |
||||
|
||||
Negative values are ignored |
||||
|
||||
|
||||
min_scale |
||||
--------- |
||||
|
||||
You can specify the minimum number of scale graduation to generate with auto scaling if possible. |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(min_scale=12) |
||||
chart.add('line', [1, 10, 100, 50, 25]) |
||||
|
||||
|
||||
max_scale |
||||
--------- |
||||
|
||||
You can specify the maximum number of scale graduation to generate with auto scaling if possible. |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(max_scale=6) |
||||
chart.add('line', [1, 10, 100, 50, 25]) |
||||
|
||||
|
||||
|
||||
order_min |
||||
--------- |
||||
|
||||
You can specify at which precision pygal should stop scaling (in log10) usefull in conjuction of the two previous properties: |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(order_min=1) |
||||
chart.add('line', [1, 10, 100, 50, 25]) |
@ -0,0 +1,90 @@
|
||||
Chart configuration |
||||
=================== |
||||
|
||||
.. pygal:: |
||||
|
||||
from pygal import Config |
||||
config = Config() |
||||
config.show_legend = False |
||||
config.human_readable = True |
||||
config.fill = True |
||||
chart = pygal.XY(config) |
||||
from math import cos, sin, pi |
||||
a = 2 * pi / 5. |
||||
chart.add('*', [(cos(i*a+pi/2.), sin(i*a+pi/2.)) for i in (0,2,4,1,3,0)]) |
||||
|
||||
How |
||||
--- |
||||
|
||||
pygal is customized at chart level with the help of the `Config class </_modules/pygal/config.html#Config>`_). |
||||
|
||||
|
||||
Instance |
||||
~~~~~~~~ |
||||
|
||||
The config class works this way: |
||||
|
||||
.. code-block:: python |
||||
|
||||
from pygal import Config |
||||
|
||||
config = Config() |
||||
config.show_legend = False |
||||
config.human_readable = True |
||||
config.fill = True |
||||
chart = pygal.XY(config) |
||||
... |
||||
|
||||
and you can share the config object between several charts. For one shot chart rendering several shorthand are available: |
||||
|
||||
|
||||
Attribute |
||||
~~~~~~~~~ |
||||
|
||||
Config values are settable on the chart object. |
||||
|
||||
.. code-block:: python |
||||
|
||||
chart = pygal.XY(config) |
||||
chart.show_legend = False |
||||
chart.human_readable = True |
||||
chart.fill = True |
||||
... |
||||
|
||||
|
||||
Keyword args |
||||
~~~~~~~~~~~~ |
||||
|
||||
Config values can be given as keyword args at init: |
||||
|
||||
.. code-block:: python |
||||
|
||||
chart = pygal.XY(show_legend=False, human_readable=True, fill=True) |
||||
|
||||
|
||||
And at render: |
||||
|
||||
.. code-block:: python |
||||
|
||||
chart = pygal.XY() |
||||
chart.render(show_legend=False, human_readable=True, fill=True) |
||||
|
||||
|
||||
Options |
||||
------- |
||||
|
||||
.. toctree:: |
||||
:maxdepth: 2 |
||||
sizing |
||||
title |
||||
label |
||||
legend |
||||
axis |
||||
interpolations |
||||
data |
||||
tooltip |
||||
rendering |
||||
misc |
||||
specific_options |
||||
|
||||
|
@ -0,0 +1,98 @@
|
||||
Data |
||||
==== |
||||
|
||||
value_formatter |
||||
--------------- |
||||
|
||||
You can specifiy how the values are displayed on the tooltip using a lambda function. |
||||
The code below shows the values to 2 decimal places. |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line() |
||||
chart.add('line', [.070106781, 1.414213562, 3.141592654]) |
||||
chart.value_formatter = lambda x: "%.2f" % x |
||||
|
||||
|
||||
x_value_formatter |
||||
----------------- |
||||
|
||||
Same on x axis for xy like charts: |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.XY() |
||||
chart.add('line', [(12, 31), (8, 28), (89, 12)]) |
||||
chart.x_value_formatter = lambda x: '%s%%' % x |
||||
|
||||
print_values |
||||
------------ |
||||
|
||||
When using pygal without javascript for printing for example you can chose to activate this option to print all values as text. |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Bar(js=[], print_values=True) |
||||
chart.add('line', [0, 12, 31, 8, 28, 0]) |
||||
|
||||
|
||||
print_zeroes |
||||
------------ |
||||
|
||||
zero values are hidden by default but you can use this option to print them anyway. |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Bar(js=[], print_values=True, print_zeroes=True) |
||||
chart.add('line', [0, 12, 31, 8, 28, 0]) |
||||
|
||||
|
||||
value_font_size |
||||
--------------- |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Bar(js=[], print_values=True, value_font_size=24) |
||||
chart.add('line', [0, 12, 31, 8, 28, 0]) |
||||
|
||||
|
||||
human_readable |
||||
-------------- |
||||
|
||||
Display values in human readable form: |
||||
|
||||
.. code-block:: c |
||||
|
||||
1 230 000 -> 1.23M |
||||
.00 098 7 -> 987µ |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(human_readable=True) |
||||
chart.add('line', [0, .0002, .0005, .00035]) |
||||
|
||||
|
||||
no_data_text |
||||
------------ |
||||
|
||||
Text to display instead of the graph when no data is supplied: |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line() |
||||
chart.add('line', []) |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(no_data_text='No result found') |
||||
chart.add('line', []) |
||||
|
||||
|
||||
no_data_font_size |
||||
----------------- |
||||
|
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(no_data_font_size=32) |
||||
chart.add('line', []) |
@ -0,0 +1,254 @@
|
||||
Labels |
||||
====== |
||||
|
||||
|
||||
You can specify x labels and y labels, depending on the graph type: |
||||
|
||||
|
||||
x_labels |
||||
-------- |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line() |
||||
chart.x_labels = 'Red', 'Blue', 'Green' |
||||
chart.add('line', [.0002, .0005, .00035]) |
||||
|
||||
|
||||
y_labels |
||||
-------- |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line() |
||||
chart.y_labels = .0001, .0003, .0004, .00045, .0005 |
||||
chart.add('line', [.0002, .0005, .00035]) |
||||
|
||||
|
||||
show_x_labels |
||||
------------- |
||||
|
||||
Set this to False to deactivate x labels: |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(show_x_labels=False) |
||||
chart.x_labels = 'Red', 'Blue', 'Green' |
||||
chart.add('line', [.0002, .0005, .00035]) |
||||
|
||||
show_y_labels |
||||
------------- |
||||
|
||||
Set this to False to deactivate y labels: |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(show_y_labels=False) |
||||
chart.x_labels = 'Red', 'Blue', 'Green' |
||||
chart.add('line', [.0002, .0005, .00035]) |
||||
|
||||
|
||||
|
||||
|
||||
Allow label rotation (in degrees) to avoid axis cluttering: |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line() |
||||
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]) |
||||
|
||||
|
||||
x_label_rotation |
||||
---------------- |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(x_label_rotation=20) |
||||
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]) |
||||
|
||||
|
||||
y_label_rotation |
||||
---------------- |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(y_label_rotation=20) |
||||
chart.add('line', [0, .0002, .0005, .00035]) |
||||
|
||||
|
||||
|
||||
You can alter major minor behaviour of axes thanks to `Arjen Stolk <https://github.com/simplyarjen>`_ |
||||
|
||||
x_labels_major |
||||
-------------- |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(x_label_rotation=20) |
||||
chart.x_labels = [ |
||||
'This is the first point !', |
||||
'This is the second point !', |
||||
'This is the third point !', |
||||
'This is the fourth point !'] |
||||
chart.x_labels_major = ['This is the first point !', 'This is the fourth point !'] |
||||
chart.add('line', [0, .0002, .0005, .00035]) |
||||
|
||||
|
||||
x_labels_major_every |
||||
-------------------- |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(x_label_rotation=20, x_labels_major_every=3) |
||||
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]) |
||||
|
||||
|
||||
x_labels_major_count |
||||
-------------------- |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(x_label_rotation=20, x_labels_major_count=3) |
||||
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]) |
||||
|
||||
|
||||
show_minor_x_labels |
||||
------------------- |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(x_label_rotation=20, show_minor_x_labels=False) |
||||
chart.x_labels = [ |
||||
'This is the first point !', |
||||
'This is the second point !', |
||||
'This is the third point !', |
||||
'This is the fourth point !'] |
||||
chart.x_labels_major = ['This is the first point !', 'This is the fourth point !'] |
||||
chart.add('line', [0, .0002, .0005, .00035]) |
||||
|
||||
|
||||
y_labels_major |
||||
-------------- |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(y_label_rotation=-20) |
||||
chart.y_labels_major = [] |
||||
chart.add('line', [0, .0002, .0005, .00035]) |
||||
|
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line() |
||||
chart.y_labels_major = [.0001, .0004] |
||||
chart.add('line', [0, .0002, .0005, .00035]) |
||||
|
||||
|
||||
y_labels_major_every |
||||
-------------------- |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(y_label_rotation=20, y_labels_major_every=3) |
||||
chart.add('line', [0, .0002, .0005, .00035]) |
||||
|
||||
|
||||
y_labels_major_count |
||||
-------------------- |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(y_labels_major_count=3) |
||||
chart.add('line', [0, .0002, .0005, .00035]) |
||||
|
||||
|
||||
show_minor_y_labels |
||||
------------------- |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(y_labels_major_every=2, show_minor_y_labels=False) |
||||
chart.add('line', [0, .0002, .0005, .00035]) |
||||
|
||||
|
||||
label_font_size |
||||
--------------- |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(x_label_rotation=20, label_font_size=8) |
||||
chart.x_labels = [ |
||||
'This is the first point !', |
||||
'This is the second point !', |
||||
'This is the third point !', |
||||
'This is the fourth point !'] |
||||
chart.x_labels_major = ['This is the first point !', 'This is the fourth point !'] |
||||
chart.add('line', [0, .0002, .0005, .00035]) |
||||
|
||||
|
||||
major_label_font_size |
||||
--------------------- |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(x_label_rotation=20, major_label_font_size=12) |
||||
chart.x_labels = [ |
||||
'This is the first point !', |
||||
'This is the second point !', |
||||
'This is the third point !', |
||||
'This is the fourth point !'] |
||||
chart.x_labels_major = ['This is the first point !', 'This is the fourth point !'] |
||||
chart.add('line', [0, .0002, .0005, .00035]) |
||||
|
||||
|
||||
truncate_label |
||||
-------------- |
||||
|
||||
|
||||
By default long labels are automatically truncated at reasonable length to fit in the graph. |
||||
|
||||
You can override that by setting truncation lenght with ``truncate_label``. |
||||
|
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(truncate_label=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 |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(truncate_label=-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]) |
||||
|
@ -0,0 +1,99 @@
|
||||
Legend |
||||
====== |
||||
|
||||
show_legend |
||||
----------- |
||||
|
||||
You can remove legend by setting this to ``False`` |
||||
|
||||
.. pygal-code:: |
||||
|
||||
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: |
||||
|
||||
.. pygal-code:: |
||||
|
||||
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 |
||||
|
||||
.. pygal-code:: |
||||
|
||||
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 |
||||
--------------- |
||||
|
||||
.. pygal-code:: |
||||
|
||||
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]) |
||||
|
||||
|
||||
legend_font_size |
||||
---------------- |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(legend_font_size=20) |
||||
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``. |
||||
|
||||
|
||||
.. pygal-code:: |
||||
|
||||
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 |
||||
|
||||
.. pygal-code:: |
||||
|
||||
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]) |
||||
|
@ -0,0 +1,35 @@
|
||||
Misc |
||||
==== |
||||
|
||||
pretty_print |
||||
------------ |
||||
|
||||
You can enable pretty print if you want to edit the source by hand (look at this frame source): |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Bar(pretty_print=True) |
||||
chart.add('values', [3, 10, 7, 2, 9, 7]) |
||||
|
||||
|
||||
|
||||
disable_xml_declaration |
||||
----------------------- |
||||
|
||||
When you want to embed directly your SVG in your html, |
||||
this option disables the xml prolog in the output. |
||||
|
||||
Since no encoding is declared, the result will be in unicode instead of bytes. |
||||
|
||||
|
||||
no_prefix |
||||
--------- |
||||
|
||||
Normally pygal set an unique id to the chart and use it to style each chart to avoid collisions when svg are directly embedded in html. This can be a problem if you use external styling overriding the prefixed css. You can set this to True in order to prevent that behaviour. |
||||
|
||||
|
||||
strict |
||||
------ |
||||
|
||||
This activates strict value mode which disable some data adapting and filters. |
||||
This will make a logarithmic chart crash on negative values for example. |
@ -0,0 +1,124 @@
|
||||
Rendering |
||||
========= |
||||
|
||||
stroke |
||||
------ |
||||
|
||||
On line graphs you can disable line stroking: |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(stroke=False) |
||||
chart.add('line', [.0002, .0005, .00035]) |
||||
|
||||
|
||||
fill |
||||
---- |
||||
|
||||
And enable line filling: |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(fill=True) |
||||
chart.add('line', [.0002, .0005, .00035]) |
||||
|
||||
|
||||
zero |
||||
---- |
||||
|
||||
To fill to an other reference than zero: |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(fill=True, zero=.0004) |
||||
chart.add('line', [.0002, .0005, .00035]) |
||||
|
||||
|
||||
show_dots |
||||
--------- |
||||
|
||||
You can remove dots by setting ``show_dots`` at ``False``` |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(show_dots=False) |
||||
chart.add('line', [.0002, .0005, .00035]) |
||||
|
||||
|
||||
show_only_major_dots |
||||
-------------------- |
||||
|
||||
You can remove minor x-labelled dots by setting ``show_only_major_dots`` at ``True`` |
||||
|
||||
.. pygal-code:: |
||||
|
||||
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'] |
||||
|
||||
|
||||
dots_size |
||||
--------- |
||||
|
||||
You can change the dot size |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(dots_size=5) |
||||
chart.add('line', [.0002, .0005, .00035]) |
||||
|
||||
|
||||
show_x_guides |
||||
------------- |
||||
|
||||
You can force the display of x guides |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(show_x_guides=True) |
||||
chart.x_labels = ['alpha', 'beta', 'gamma'] |
||||
chart.add('line', [.0002, .0005, .00035]) |
||||
|
||||
|
||||
show_y_guides |
||||
------------- |
||||
|
||||
Or disable y guides: |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(show_y_guides=False) |
||||
chart.x_labels = ['alpha', 'beta', 'gamma'] |
||||
chart.add('line', [.0002, .0005, .00035]) |
||||
|
||||
|
||||
style |
||||
----- |
||||
|
||||
see `styles <../styles.html>`_ |
||||
|
||||
|
||||
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: |
||||
|
||||
.. code-block:: python |
||||
|
||||
css = ['style.css', 'graph.css'] |
||||
|
||||
js |
||||
-- |
||||
|
||||
.. code-block:: python |
||||
|
||||
js = [ |
||||
'http://kozea.github.io/pygal.js/2.0.x/pygal-tooltips.min.js' |
||||
] |
||||
|
||||
See `pygal.js <https://github.com/Kozea/pygal.js/>`_ |
@ -0,0 +1,29 @@
|
||||
Serie configuration |
||||
=================== |
||||
|
||||
How |
||||
--- |
||||
|
||||
Series are customized using keyword args set in the ``add`` function: |
||||
|
||||
.. code-block:: python |
||||
|
||||
chart = pygal.Line() |
||||
chart.add([1, 2, 3], fill=True) |
||||
chart.add([3, 2, 1], dot=False) |
||||
|
||||
|
||||
Options |
||||
------- |
||||
|
||||
|
||||
secondary |
||||
~~~~~~~~~ |
||||
|
||||
You can plot your values to 2 separate axes, thanks to `wiktorn <https://github.com/wiktorn>`_ |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(title=u'Some different points') |
||||
chart.add('line', [.0002, .0005, .00035]) |
||||
chart.add('other line', [1000, 2000, 7000], secondary=True) |
@ -0,0 +1,98 @@
|
||||
Sizing |
||||
====== |
||||
|
||||
Svg size is configurable with ``width`` and ``height`` parameter. |
||||
|
||||
|
||||
width |
||||
----- |
||||
|
||||
.. pygal-code:: 200 400 |
||||
|
||||
chart = pygal.Bar(width=200) |
||||
chart.add('1', 1) |
||||
chart.add('2', 2) |
||||
|
||||
|
||||
height |
||||
------ |
||||
|
||||
.. pygal-code:: 600 100 |
||||
|
||||
chart = pygal.Bar(height=100) |
||||
chart.add('1', 1) |
||||
chart.add('2', 2) |
||||
|
||||
|
||||
explicit_size |
||||
------------- |
||||
|
||||
Size can be written directly to the svg tag to force display of the requested size using ``explicit_size``. |
||||
|
||||
|
||||
spacing |
||||
------- |
||||
|
||||
Spacing determines the space between all elements: |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Bar(spacing=50) |
||||
chart.x_labels = u'αβγδ' |
||||
chart.add('line 1', [5, 15, 10, 8]) |
||||
chart.add('line 2', [15, 20, 8, 11]) |
||||
|
||||
margin |
||||
------ |
||||
|
||||
Margin is the external chart margin: |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Bar(margin=50) |
||||
chart.x_labels = u'αβγδ' |
||||
chart.add('line 1', [5, 15, 10, 8]) |
||||
chart.add('line 2', [15, 20, 8, 11]) |
||||
|
||||
|
||||
Individual margins can also be specified |
||||
|
||||
margin_top |
||||
---------- |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Bar(margin_top=50) |
||||
chart.x_labels = u'αβγδ' |
||||
chart.add('line 1', [5, 15, 10, 8]) |
||||
chart.add('line 2', [15, 20, 8, 11]) |
||||
|
||||
margin_right |
||||
------------ |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Bar(margin_right=50) |
||||
chart.x_labels = u'αβγδ' |
||||
chart.add('line 1', [5, 15, 10, 8]) |
||||
chart.add('line 2', [15, 20, 8, 11]) |
||||
|
||||
margin_bottom |
||||
------------- |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Bar(margin_bottom=50) |
||||
chart.x_labels = u'αβγδ' |
||||
chart.add('line 1', [5, 15, 10, 8]) |
||||
chart.add('line 2', [15, 20, 8, 11]) |
||||
|
||||
margin_left |
||||
----------- |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Bar(margin_left=50) |
||||
chart.x_labels = u'αβγδ' |
||||
chart.add('line 1', [5, 15, 10, 8]) |
||||
chart.add('line 2', [15, 20, 8, 11]) |
@ -0,0 +1,166 @@
|
||||
Specific options |
||||
================ |
||||
|
||||
These options are specific for certain chart types. |
||||
|
||||
|
||||
|
||||
rounded_bars |
||||
------------ |
||||
|
||||
You can add a round effect to bar diagrams with ``rounded_bars``: |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Bar(rounded_bars=20) |
||||
chart.add('values', [3, 10, 7, 2, 9, 7]) |
||||
|
||||
|
||||
half_pie |
||||
-------- |
||||
|
||||
.. pygal-code:: |
||||
|
||||
pie_chart = pygal.Pie(half_pie=True) |
||||
pie_chart.title = 'Browser usage in February 2012 (in %)' |
||||
pie_chart.add('IE', 19.5) |
||||
pie_chart.add('Firefox', 36.6) |
||||
pie_chart.add('Chrome', 36.3) |
||||
pie_chart.add('Safari', 4.5) |
||||
pie_chart.add('Opera', 2.3) |
||||
|
||||
|
||||
inner_radius |
||||
------------ |
||||
|
||||
Donut like pies |
||||
|
||||
.. pygal-code:: |
||||
|
||||
pie_chart = pygal.Pie(inner_radius=.6) |
||||
pie_chart.title = 'Browser usage in February 2012 (in %)' |
||||
pie_chart.add('IE', 19.5) |
||||
pie_chart.add('Firefox', 36.6) |
||||
pie_chart.add('Chrome', 36.3) |
||||
pie_chart.add('Safari', 4.5) |
||||
pie_chart.add('Opera', 2.3) |
||||
|
||||
|
||||
box_mode |
||||
-------- |
||||
|
||||
box plot has several modes: |
||||
|
||||
extremes |
||||
~~~~~~~~ |
||||
|
||||
.. pygal-code:: |
||||
|
||||
box_plot = pygal.Box(box_mode="extremes") |
||||
box_plot.title = 'V8 benchmark results' |
||||
box_plot.add('Chrome', [6395, 8212, 7520, 7218, 12464, 1660, 2123, 8607]) |
||||
box_plot.add('Firefox', [7473, 8099, 11700, 2651, 6361, 1044, 3797, 9450]) |
||||
box_plot.add('Opera', [3472, 2933, 4203, 5229, 5810, 1828, 9013, 4669]) |
||||
box_plot.add('IE', [43, 41, 59, 79, 144, 136, 34, 102]) |
||||
|
||||
1.5IQR |
||||
~~~~~~ |
||||
|
||||
.. pygal-code:: |
||||
|
||||
box_plot = pygal.Box(box_mode="1.5IQR") |
||||
box_plot.title = 'V8 benchmark results' |
||||
box_plot.add('Chrome', [6395, 8212, 7520, 7218, 12464, 1660, 2123, 8607]) |
||||
box_plot.add('Firefox', [7473, 8099, 11700, 2651, 6361, 1044, 3797, 9450]) |
||||
box_plot.add('Opera', [3472, 2933, 4203, 5229, 5810, 1828, 9013, 4669]) |
||||
box_plot.add('IE', [43, 41, 59, 79, 144, 136, 34, 102]) |
||||
|
||||
tukey |
||||
~~~~~ |
||||
|
||||
.. pygal-code:: |
||||
|
||||
box_plot = pygal.Box(box_mode="tukey") |
||||
box_plot.title = 'V8 benchmark results' |
||||
box_plot.add('Chrome', [6395, 8212, 7520, 7218, 12464, 1660, 2123, 8607]) |
||||
box_plot.add('Firefox', [7473, 8099, 11700, 2651, 6361, 1044, 3797, 9450]) |
||||
box_plot.add('Opera', [3472, 2933, 4203, 5229, 5810, 1828, 9013, 4669]) |
||||
box_plot.add('IE', [43, 41, 59, 79, 144, 136, 34, 102]) |
||||
|
||||
stdev |
||||
~~~~~ |
||||
|
||||
.. pygal-code:: |
||||
|
||||
box_plot = pygal.Box(box_mode="stdev") |
||||
box_plot.title = 'V8 benchmark results' |
||||
box_plot.add('Chrome', [6395, 8212, 7520, 7218, 12464, 1660, 2123, 8607]) |
||||
box_plot.add('Firefox', [7473, 8099, 11700, 2651, 6361, 1044, 3797, 9450]) |
||||
box_plot.add('Opera', [3472, 2933, 4203, 5229, 5810, 1828, 9013, 4669]) |
||||
box_plot.add('IE', [43, 41, 59, 79, 144, 136, 34, 102]) |
||||
|
||||
pstdev |
||||
~~~~~~ |
||||
|
||||
.. pygal-code:: |
||||
|
||||
box_plot = pygal.Box(box_mode="pstdev") |
||||
box_plot.title = 'V8 benchmark results' |
||||
box_plot.add('Chrome', [6395, 8212, 7520, 7218, 12464, 1660, 2123, 8607]) |
||||
box_plot.add('Firefox', [7473, 8099, 11700, 2651, 6361, 1044, 3797, 9450]) |
||||
box_plot.add('Opera', [3472, 2933, 4203, 5229, 5810, 1828, 9013, 4669]) |
||||
box_plot.add('IE', [43, 41, 59, 79, 144, 136, 34, 102]) |
||||
|
||||
|
||||
stack_from_top |
||||
-------------- |
||||
|
||||
You can reverse the stacking order for StackedBar and StackedLine |
||||
|
||||
.. pygal-code:: |
||||
|
||||
line_chart = pygal.StackedLine(fill=True) |
||||
line_chart.title = 'Browser usage evolution (in %)' |
||||
line_chart.x_labels = map(str, range(2002, 2013)) |
||||
line_chart.add('Firefox', [None, None, 0, 16.6, 25, 31, 36.4, 45.5, 46.3, 42.8, 37.1]) |
||||
line_chart.add('Chrome', [None, None, None, None, None, None, 0, 3.9, 10.8, 23.8, 35.3]) |
||||
line_chart.add('IE', [85.8, 84.6, 84.7, 74.5, 66, 58.6, 54.7, 44.8, 36.2, 26.6, 20.1]) |
||||
line_chart.add('Others', [14.2, 15.4, 15.3, 8.9, 9, 10.4, 8.9, 5.8, 6.7, 6.8, 7.5]) |
||||
|
||||
.. pygal-code:: |
||||
|
||||
line_chart = pygal.StackedLine(stack_from_top=True, fill=True) |
||||
line_chart.title = 'Browser usage evolution (in %)' |
||||
line_chart.x_labels = map(str, range(2002, 2013)) |
||||
line_chart.add('Firefox', [None, None, 0, 16.6, 25, 31, 36.4, 45.5, 46.3, 42.8, 37.1]) |
||||
line_chart.add('Chrome', [None, None, None, None, None, None, 0, 3.9, 10.8, 23.8, 35.3]) |
||||
line_chart.add('IE', [85.8, 84.6, 84.7, 74.5, 66, 58.6, 54.7, 44.8, 36.2, 26.6, 20.1]) |
||||
line_chart.add('Others', [14.2, 15.4, 15.3, 8.9, 9, 10.4, 8.9, 5.8, 6.7, 6.8, 7.5]) |
||||
|
||||
|
||||
.. pygal-code:: |
||||
|
||||
line_chart = pygal.StackedBar() |
||||
line_chart.title = 'Browser usage evolution (in %)' |
||||
line_chart.x_labels = map(str, range(2002, 2013)) |
||||
line_chart.add('Firefox', [None, None, 0, 16.6, 25, 31, 36.4, 45.5, 46.3, 42.8, 37.1]) |
||||
line_chart.add('Chrome', [None, None, None, None, None, None, 0, 3.9, 10.8, 23.8, 35.3]) |
||||
line_chart.add('IE', [85.8, 84.6, 84.7, 74.5, 66, 58.6, 54.7, 44.8, 36.2, 26.6, 20.1]) |
||||
line_chart.add('Others', [14.2, 15.4, 15.3, 8.9, 9, 10.4, 8.9, 5.8, 6.7, 6.8, 7.5]) |
||||
|
||||
.. pygal-code:: |
||||
|
||||
line_chart = pygal.StackedBar(stack_from_top=True) |
||||
line_chart.title = 'Browser usage evolution (in %)' |
||||
line_chart.x_labels = map(str, range(2002, 2013)) |
||||
line_chart.add('Firefox', [None, None, 0, 16.6, 25, 31, 36.4, 45.5, 46.3, 42.8, 37.1]) |
||||
line_chart.add('Chrome', [None, None, None, None, None, None, 0, 3.9, 10.8, 23.8, 35.3]) |
||||
line_chart.add('IE', [85.8, 84.6, 84.7, 74.5, 66, 58.6, 54.7, 44.8, 36.2, 26.6, 20.1]) |
||||
line_chart.add('Others', [14.2, 15.4, 15.3, 8.9, 9, 10.4, 8.9, 5.8, 6.7, 6.8, 7.5]) |
||||
|
||||
|
||||
missing_value_fill_truncation |
||||
----------------------------- |
||||
|
||||
Filled series with missing x and/or y values at the end of a series are closed at the first value with a missing. |
||||
'x' is default. |
@ -0,0 +1,46 @@
|
||||
Titles |
||||
====== |
||||
|
||||
|
||||
title |
||||
----- |
||||
|
||||
You can add a title to the chart by setting the ``title`` option: |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(title=u'Some points') |
||||
chart.add('line', [.0002, .0005, .00035]) |
||||
|
||||
|
||||
x_title |
||||
------- |
||||
|
||||
You can add a title to the x axis by setting the ``x_title`` option: |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(title=u'Some points', x_title='X Axis') |
||||
chart.add('line', [.0002, .0005, .00035]) |
||||
|
||||
|
||||
y_title |
||||
------- |
||||
|
||||
|
||||
You can add a title to the y axis by setting the ``y_title`` option: |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(title=u'Some points', y_title='Y Axis') |
||||
chart.add('line', [.0002, .0005, .00035]) |
||||
|
||||
|
||||
title_font_size |
||||
--------------- |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(title=u'Some points', x_title='X Axis', y_title='Y Axis', |
||||
title_font_size=24) |
||||
chart.add('line', [.0002, .0005, .00035]) |
@ -0,0 +1,22 @@
|
||||
Tooltip |
||||
======= |
||||
|
||||
Tooltips are displayed when the pygal javascript is used. |
||||
|
||||
|
||||
tooltip_border_radius |
||||
--------------------- |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(tooltip_border_radius=10) |
||||
chart.add('line', [.0002, .0005, .00035]) |
||||
|
||||
|
||||
tooltip_font_size |
||||
----------------- |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(tooltip_font_size=24) |
||||
chart.add('line', [.0002, .0005, .00035]) |
@ -1,5 +1,5 @@
|
||||
Metadata |
||||
======== |
||||
Value configuration |
||||
=================== |
||||
|
||||
|
||||
Labels |
@ -1,114 +0,0 @@
|
||||
Other customizations |
||||
==================== |
||||
|
||||
|
||||
Logarithmic |
||||
----------- |
||||
|
||||
``logarithmic`` |
||||
|
||||
You can set the scale to be logarithmic: |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(logarithmic=True) |
||||
values = [1, 3, 43, 123, 1231, 23192] |
||||
chart.x_labels = map(str, values) |
||||
chart.add('log example', values) |
||||
|
||||
.. caution:: |
||||
|
||||
Negative values are ignored |
||||
|
||||
|
||||
Custom css and js |
||||
----------------- |
||||
|
||||
``css, js`` |
||||
|
||||
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) |
||||
|
||||
Default: |
||||
|
||||
.. code-block:: python |
||||
|
||||
css = ['style.css', 'graph.css'] |
||||
js = [ |
||||
'http://kozea.github.com/pygal.js/latest/pygal-tooltips.js' |
||||
] |
||||
|
||||
|
||||
Legend box size |
||||
--------------- |
||||
|
||||
``legend_box_size`` |
||||
|
||||
You can change the size of the rectangle next to the legend: |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Line(legend_box_size=50) |
||||
values = [1, 3, 43, 123, 1231, 23192] |
||||
chart.x_labels = map(str, values) |
||||
chart.add('log example', values) |
||||
|
||||
|
||||
Rounded bars |
||||
------------ |
||||
|
||||
``rounded_bars`` |
||||
|
||||
You can add a round effect to bar diagrams with `rounded_bars`: |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Bar(rounded_bars=20) |
||||
chart.add('values', [3, 10, 7, 2, 9, 7]) |
||||
|
||||
|
||||
Pretty print |
||||
------------ |
||||
|
||||
``pretty_print`` |
||||
|
||||
You can enable pretty print if you want to edit the source at hand (look at this frame source): |
||||
|
||||
.. pygal-code:: |
||||
|
||||
chart = pygal.Bar(pretty_print=True) |
||||
chart.add('values', [3, 10, 7, 2, 9, 7]) |
||||
|
||||
|
||||
Static options |
||||
-------------- |
||||
|
||||
``print_values, print_zeroes`` |
||||
|
||||
By default, when the graph is viewed using a non javascript compatible |
||||
viewer or as an image, all the values are displayed on the graph. |
||||
|
||||
It can be disabled by setting `print_values` to `False`. |
||||
|
||||
`print_zeroes` can be enabled to display static values even if equal to zero. |
||||
|
||||
|
||||
Disable xml declaration |
||||
----------------------- |
||||
|
||||
``disable_xml_declaration`` |
||||
|
||||
When you want to embed directly your SVG in your html, |
||||
this option disables the xml prolog in the output. |
||||
|
||||
Since no encoding is declared, the result will be in unicode instead of bytes. |
||||
|
||||
|
||||
|
||||
No prefix |
||||
--------- |
||||
|
||||
``no_prefix`` |
||||
|
||||
Normally pygal set an unique id to the chart and use it to style each chart to avoid collisions when svg are directly embedded in html. This can be a problem if you use external styling overriding the prefixed css. You can set this to True in order to prevent that behaviour. |
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue