Browse Source

Write configuration doc

pull/242/head
Florian Mounier 9 years ago
parent
commit
61d269d059
  1. 2
      demo/moulinrouge/__init__.py
  2. 14
      demo/moulinrouge/tests.py
  3. 3
      docs/Makefile
  4. 9
      docs/api.rst
  5. 4
      docs/api/modules.rst
  6. 7
      docs/api/pygal.adapters.rst
  7. 7
      docs/api/pygal.colors.rst
  8. 7
      docs/api/pygal.config.rst
  9. 7
      docs/api/pygal.etree.rst
  10. 7
      docs/api/pygal.graph.bar.rst
  11. 7
      docs/api/pygal.graph.base.rst
  12. 7
      docs/api/pygal.graph.box.rst
  13. 7
      docs/api/pygal.graph.dot.rst
  14. 7
      docs/api/pygal.graph.funnel.rst
  15. 7
      docs/api/pygal.graph.gauge.rst
  16. 7
      docs/api/pygal.graph.graph.rst
  17. 7
      docs/api/pygal.graph.histogram.rst
  18. 7
      docs/api/pygal.graph.horizontal.rst
  19. 7
      docs/api/pygal.graph.horizontalbar.rst
  20. 7
      docs/api/pygal.graph.horizontalstackedbar.rst
  21. 7
      docs/api/pygal.graph.line.rst
  22. 7
      docs/api/pygal.graph.map.rst
  23. 7
      docs/api/pygal.graph.pie.rst
  24. 7
      docs/api/pygal.graph.public.rst
  25. 7
      docs/api/pygal.graph.pyramid.rst
  26. 7
      docs/api/pygal.graph.radar.rst
  27. 217
      docs/api/pygal.graph.rst
  28. 7
      docs/api/pygal.graph.stackedbar.rst
  29. 7
      docs/api/pygal.graph.stackedline.rst
  30. 7
      docs/api/pygal.graph.time.rst
  31. 7
      docs/api/pygal.graph.treemap.rst
  32. 7
      docs/api/pygal.graph.verticalpyramid.rst
  33. 7
      docs/api/pygal.graph.xy.rst
  34. 7
      docs/api/pygal.interpolate.rst
  35. 4
      docs/api/pygal.maps.rst
  36. 120
      docs/api/pygal.rst
  37. 7
      docs/api/pygal.serie.rst
  38. 7
      docs/api/pygal.state.rst
  39. 7
      docs/api/pygal.style.rst
  40. 7
      docs/api/pygal.svg.rst
  41. 7
      docs/api/pygal.table.rst
  42. 7
      docs/api/pygal.test.conftest.rst
  43. 208
      docs/api/pygal.test.rst
  44. 7
      docs/api/pygal.test.test_bar.rst
  45. 7
      docs/api/pygal.test.test_box.rst
  46. 7
      docs/api/pygal.test.test_colors.rst
  47. 7
      docs/api/pygal.test.test_config.rst
  48. 7
      docs/api/pygal.test.test_date.rst
  49. 7
      docs/api/pygal.test.test_donut.rst
  50. 7
      docs/api/pygal.test.test_graph.rst
  51. 7
      docs/api/pygal.test.test_histogram.rst
  52. 7
      docs/api/pygal.test.test_interpolate.rst
  53. 7
      docs/api/pygal.test.test_line.rst
  54. 7
      docs/api/pygal.test.test_maps.rst
  55. 7
      docs/api/pygal.test.test_pie.rst
  56. 7
      docs/api/pygal.test.test_serie_config.rst
  57. 7
      docs/api/pygal.test.test_sparktext.rst
  58. 7
      docs/api/pygal.test.test_stacked.rst
  59. 7
      docs/api/pygal.test.test_style.rst
  60. 7
      docs/api/pygal.test.test_table.rst
  61. 7
      docs/api/pygal.test.test_util.rst
  62. 7
      docs/api/pygal.test.test_view.rst
  63. 7
      docs/api/pygal.test.test_xml_filters.rst
  64. 7
      docs/api/pygal.test.utils.rst
  65. 7
      docs/api/pygal.util.rst
  66. 7
      docs/api/pygal.view.rst
  67. 3
      docs/changelog.rst
  68. 614
      docs/documentation/basic_customizations.rst
  69. 109
      docs/documentation/configuration/axis.rst
  70. 90
      docs/documentation/configuration/chart.rst
  71. 98
      docs/documentation/configuration/data.rst
  72. 50
      docs/documentation/configuration/interpolations.rst
  73. 254
      docs/documentation/configuration/label.rst
  74. 99
      docs/documentation/configuration/legend.rst
  75. 35
      docs/documentation/configuration/misc.rst
  76. 124
      docs/documentation/configuration/rendering.rst
  77. 29
      docs/documentation/configuration/serie.rst
  78. 98
      docs/documentation/configuration/sizing.rst
  79. 166
      docs/documentation/configuration/specific_options.rst
  80. 46
      docs/documentation/configuration/title.rst
  81. 22
      docs/documentation/configuration/tooltip.rst
  82. 4
      docs/documentation/configuration/value.rst
  83. 4
      docs/documentation/custom_styles.rst
  84. 7
      docs/documentation/index.rst
  85. 114
      docs/documentation/other_customizations.rst
  86. 38
      docs/documentation/types/box.rst
  87. 3
      docs/documentation/types/maps/pygal_maps_ch.rst
  88. 2
      docs/documentation/types/maps/pygal_maps_fr.rst
  89. 14
      docs/documentation/types/pie.rst
  90. 2
      docs/index.rst
  91. 13
      pygal/config.py
  92. 5
      pygal/css/graph.css
  93. 3
      pygal/graph/bar.py
  94. 4
      pygal/graph/base.py
  95. 14
      pygal/graph/box.py
  96. 3
      pygal/graph/funnel.py
  97. 34
      pygal/graph/gauge.py
  98. 6
      pygal/graph/histogram.py
  99. 3
      pygal/graph/line.py
  100. 2
      pygal/graph/radar.py
  101. Some files were not shown because too many files have changed in this diff Show More

2
demo/moulinrouge/__init__.py

@ -50,7 +50,7 @@ def create_app():
def before_request():
if request.args.get('etree'):
etree.to_etree()
else:
elif request.args.get('lxml'):
etree.to_lxml()
def _random(data, order):

14
demo/moulinrouge/tests.py

@ -163,6 +163,14 @@ def get_test_routes(app):
gauge.add('No', [99, -99])
return gauge.render_response()
@app.route('/test/gauge/log')
def test_gauge_log():
gauge = Gauge(logarithmic=True)
gauge.add('Need l', [200.3, 500.12])
gauge.add('Need z', [10, 1000.5])
return gauge.render_response()
@app.route('/test/pyramid')
def test_pyramid():
pyramid = Pyramid()
@ -713,4 +721,10 @@ def get_test_routes(app):
line.x_label_rotation = 45
return line.render_response()
@app.route('/test/order_min')
def test_order_min():
line = Line(order_min=-32)
line.add('_', [1, 32, 12, .4, .009])
return line.render_response()
return list(sorted(filter(lambda x: x.startswith('test'), locals())))

3
docs/Makefile

@ -50,6 +50,7 @@ help:
clean:
rm -rf $(BUILDDIR)/*
rm -rf api/*
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@ -192,7 +193,7 @@ pseudoxml:
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
rst:
sphinx-apidoc -f -o api ../pygal
sphinx-apidoc -f -e -M -H API -o api ../pygal
auto:
sphinx-autobuild . _build/html

9
docs/api.rst

@ -1,9 +0,0 @@
===
API
===
.. toctree::
:maxdepth: 2
api/modules

4
docs/api/modules.rst

@ -1,5 +1,5 @@
pygal
=====
API
===
.. toctree::
:maxdepth: 4

7
docs/api/pygal.adapters.rst

@ -0,0 +1,7 @@
pygal.adapters module
=====================
.. automodule:: pygal.adapters
:members:
:undoc-members:
:show-inheritance:

7
docs/api/pygal.colors.rst

@ -0,0 +1,7 @@
pygal.colors module
===================
.. automodule:: pygal.colors
:members:
:undoc-members:
:show-inheritance:

7
docs/api/pygal.config.rst

@ -0,0 +1,7 @@
pygal.config module
===================
.. automodule:: pygal.config
:members:
:undoc-members:
:show-inheritance:

7
docs/api/pygal.etree.rst

@ -0,0 +1,7 @@
pygal.etree module
==================
.. automodule:: pygal.etree
:members:
:undoc-members:
:show-inheritance:

7
docs/api/pygal.graph.bar.rst

@ -0,0 +1,7 @@
pygal.graph.bar module
======================
.. automodule:: pygal.graph.bar
:members:
:undoc-members:
:show-inheritance:

7
docs/api/pygal.graph.base.rst

@ -0,0 +1,7 @@
pygal.graph.base module
=======================
.. automodule:: pygal.graph.base
:members:
:undoc-members:
:show-inheritance:

7
docs/api/pygal.graph.box.rst

@ -0,0 +1,7 @@
pygal.graph.box module
======================
.. automodule:: pygal.graph.box
:members:
:undoc-members:
:show-inheritance:

7
docs/api/pygal.graph.dot.rst

@ -0,0 +1,7 @@
pygal.graph.dot module
======================
.. automodule:: pygal.graph.dot
:members:
:undoc-members:
:show-inheritance:

7
docs/api/pygal.graph.funnel.rst

@ -0,0 +1,7 @@
pygal.graph.funnel module
=========================
.. automodule:: pygal.graph.funnel
:members:
:undoc-members:
:show-inheritance:

7
docs/api/pygal.graph.gauge.rst

@ -0,0 +1,7 @@
pygal.graph.gauge module
========================
.. automodule:: pygal.graph.gauge
:members:
:undoc-members:
:show-inheritance:

7
docs/api/pygal.graph.graph.rst

@ -0,0 +1,7 @@
pygal.graph.graph module
========================
.. automodule:: pygal.graph.graph
:members:
:undoc-members:
:show-inheritance:

7
docs/api/pygal.graph.histogram.rst

@ -0,0 +1,7 @@
pygal.graph.histogram module
============================
.. automodule:: pygal.graph.histogram
:members:
:undoc-members:
:show-inheritance:

7
docs/api/pygal.graph.horizontal.rst

@ -0,0 +1,7 @@
pygal.graph.horizontal module
=============================
.. automodule:: pygal.graph.horizontal
:members:
:undoc-members:
:show-inheritance:

7
docs/api/pygal.graph.horizontalbar.rst

@ -0,0 +1,7 @@
pygal.graph.horizontalbar module
================================
.. automodule:: pygal.graph.horizontalbar
:members:
:undoc-members:
:show-inheritance:

7
docs/api/pygal.graph.horizontalstackedbar.rst

@ -0,0 +1,7 @@
pygal.graph.horizontalstackedbar module
=======================================
.. automodule:: pygal.graph.horizontalstackedbar
:members:
:undoc-members:
:show-inheritance:

7
docs/api/pygal.graph.line.rst

@ -0,0 +1,7 @@
pygal.graph.line module
=======================
.. automodule:: pygal.graph.line
:members:
:undoc-members:
:show-inheritance:

7
docs/api/pygal.graph.map.rst

@ -0,0 +1,7 @@
pygal.graph.map module
======================
.. automodule:: pygal.graph.map
:members:
:undoc-members:
:show-inheritance:

7
docs/api/pygal.graph.pie.rst

@ -0,0 +1,7 @@
pygal.graph.pie module
======================
.. automodule:: pygal.graph.pie
:members:
:undoc-members:
:show-inheritance:

7
docs/api/pygal.graph.public.rst

@ -0,0 +1,7 @@
pygal.graph.public module
=========================
.. automodule:: pygal.graph.public
:members:
:undoc-members:
:show-inheritance:

7
docs/api/pygal.graph.pyramid.rst

@ -0,0 +1,7 @@
pygal.graph.pyramid module
==========================
.. automodule:: pygal.graph.pyramid
:members:
:undoc-members:
:show-inheritance:

7
docs/api/pygal.graph.radar.rst

@ -0,0 +1,7 @@
pygal.graph.radar module
========================
.. automodule:: pygal.graph.radar
:members:
:undoc-members:
:show-inheritance:

217
docs/api/pygal.graph.rst

@ -1,198 +1,37 @@
pygal.graph package
===================
Submodules
----------
pygal.graph.bar module
----------------------
.. automodule:: pygal.graph.bar
:members:
:undoc-members:
:show-inheritance:
pygal.graph.base module
-----------------------
.. automodule:: pygal.graph.base
:members:
:undoc-members:
:show-inheritance:
pygal.graph.box module
----------------------
.. automodule:: pygal.graph.box
:members:
:undoc-members:
:show-inheritance:
pygal.graph.dot module
----------------------
.. automodule:: pygal.graph.dot
:members:
:undoc-members:
:show-inheritance:
pygal.graph.funnel module
-------------------------
.. automodule:: pygal.graph.funnel
:members:
:undoc-members:
:show-inheritance:
pygal.graph.gauge module
------------------------
.. automodule:: pygal.graph.gauge
:members:
:undoc-members:
:show-inheritance:
pygal.graph.graph module
------------------------
.. automodule:: pygal.graph.graph
:members:
:undoc-members:
:show-inheritance:
pygal.graph.histogram module
----------------------------
.. automodule:: pygal.graph.histogram
:members:
:undoc-members:
:show-inheritance:
pygal.graph.horizontal module
-----------------------------
.. automodule:: pygal.graph.horizontal
:members:
:undoc-members:
:show-inheritance:
pygal.graph.horizontalbar module
--------------------------------
.. automodule:: pygal.graph.horizontalbar
:members:
:undoc-members:
:show-inheritance:
pygal.graph.horizontalstackedbar module
---------------------------------------
.. automodule:: pygal.graph.horizontalstackedbar
:members:
:undoc-members:
:show-inheritance:
pygal.graph.line module
-----------------------
.. automodule:: pygal.graph.line
:members:
:undoc-members:
:show-inheritance:
pygal.graph.map module
----------------------
.. automodule:: pygal.graph.map
:members:
:undoc-members:
:show-inheritance:
pygal.graph.pie module
----------------------
.. automodule:: pygal.graph.pie
:members:
:undoc-members:
:show-inheritance:
pygal.graph.public module
-------------------------
.. automodule:: pygal.graph.public
:members:
:undoc-members:
:show-inheritance:
pygal.graph.pyramid module
--------------------------
.. automodule:: pygal.graph.pyramid
:members:
:undoc-members:
:show-inheritance:
pygal.graph.radar module
------------------------
.. automodule:: pygal.graph.radar
:members:
:undoc-members:
:show-inheritance:
pygal.graph.stackedbar module
-----------------------------
.. automodule:: pygal.graph.stackedbar
:members:
:undoc-members:
:show-inheritance:
pygal.graph.stackedline module
------------------------------
.. automodule:: pygal.graph.stackedline
:members:
:undoc-members:
:show-inheritance:
pygal.graph.time module
-----------------------
.. automodule:: pygal.graph.time
:members:
:undoc-members:
:show-inheritance:
pygal.graph.treemap module
--------------------------
.. automodule:: pygal.graph.treemap
:members:
:undoc-members:
:show-inheritance:
pygal.graph.verticalpyramid module
----------------------------------
.. automodule:: pygal.graph.verticalpyramid
:members:
:undoc-members:
:show-inheritance:
pygal.graph.xy module
---------------------
.. automodule:: pygal.graph.xy
.. automodule:: pygal.graph
:members:
:undoc-members:
:show-inheritance:
Submodules
----------
Module contents
---------------
.. toctree::
pygal.graph.bar
pygal.graph.base
pygal.graph.box
pygal.graph.dot
pygal.graph.funnel
pygal.graph.gauge
pygal.graph.graph
pygal.graph.histogram
pygal.graph.horizontal
pygal.graph.horizontalbar
pygal.graph.horizontalstackedbar
pygal.graph.line
pygal.graph.map
pygal.graph.pie
pygal.graph.public
pygal.graph.pyramid
pygal.graph.radar
pygal.graph.stackedbar
pygal.graph.stackedline
pygal.graph.time
pygal.graph.treemap
pygal.graph.verticalpyramid
pygal.graph.xy
.. automodule:: pygal.graph
:members:
:undoc-members:
:show-inheritance:

7
docs/api/pygal.graph.stackedbar.rst

@ -0,0 +1,7 @@
pygal.graph.stackedbar module
=============================
.. automodule:: pygal.graph.stackedbar
:members:
:undoc-members:
:show-inheritance:

7
docs/api/pygal.graph.stackedline.rst

@ -0,0 +1,7 @@
pygal.graph.stackedline module
==============================
.. automodule:: pygal.graph.stackedline
:members:
:undoc-members:
:show-inheritance:

7
docs/api/pygal.graph.time.rst

@ -0,0 +1,7 @@
pygal.graph.time module
=======================
.. automodule:: pygal.graph.time
:members:
:undoc-members:
:show-inheritance:

7
docs/api/pygal.graph.treemap.rst

@ -0,0 +1,7 @@
pygal.graph.treemap module
==========================
.. automodule:: pygal.graph.treemap
:members:
:undoc-members:
:show-inheritance:

7
docs/api/pygal.graph.verticalpyramid.rst

@ -0,0 +1,7 @@
pygal.graph.verticalpyramid module
==================================
.. automodule:: pygal.graph.verticalpyramid
:members:
:undoc-members:
:show-inheritance:

7
docs/api/pygal.graph.xy.rst

@ -0,0 +1,7 @@
pygal.graph.xy module
=====================
.. automodule:: pygal.graph.xy
:members:
:undoc-members:
:show-inheritance:

7
docs/api/pygal.interpolate.rst

@ -0,0 +1,7 @@
pygal.interpolate module
========================
.. automodule:: pygal.interpolate
:members:
:undoc-members:
:show-inheritance:

4
docs/api/pygal.maps.rst

@ -1,10 +1,8 @@
pygal.maps package
==================
Module contents
---------------
.. automodule:: pygal.maps
:members:
:undoc-members:
:show-inheritance:

120
docs/api/pygal.rst

@ -1,6 +1,11 @@
pygal package
=============
.. automodule:: pygal
:members:
:undoc-members:
:show-inheritance:
Subpackages
-----------
@ -13,107 +18,18 @@ Subpackages
Submodules
----------
pygal.adapters module
---------------------
.. automodule:: pygal.adapters
:members:
:undoc-members:
:show-inheritance:
pygal.colors module
-------------------
.. automodule:: pygal.colors
:members:
:undoc-members:
:show-inheritance:
pygal.config module
-------------------
.. automodule:: pygal.config
:members:
:undoc-members:
:show-inheritance:
pygal.etree module
------------------
.. automodule:: pygal.etree
:members:
:undoc-members:
:show-inheritance:
pygal.interpolate module
------------------------
.. automodule:: pygal.interpolate
:members:
:undoc-members:
:show-inheritance:
pygal.serie module
------------------
.. automodule:: pygal.serie
:members:
:undoc-members:
:show-inheritance:
pygal.state module
------------------
.. automodule:: pygal.state
:members:
:undoc-members:
:show-inheritance:
pygal.style module
------------------
.. automodule:: pygal.style
:members:
:undoc-members:
:show-inheritance:
pygal.svg module
----------------
.. automodule:: pygal.svg
:members:
:undoc-members:
:show-inheritance:
pygal.table module
------------------
.. automodule:: pygal.table
:members:
:undoc-members:
:show-inheritance:
pygal.util module
-----------------
.. automodule:: pygal.util
:members:
:undoc-members:
:show-inheritance:
pygal.view module
-----------------
.. automodule:: pygal.view
:members:
:undoc-members:
:show-inheritance:
.. toctree::
Module contents
---------------
pygal.adapters
pygal.colors
pygal.config
pygal.etree
pygal.interpolate
pygal.serie
pygal.state
pygal.style
pygal.svg
pygal.table
pygal.util
pygal.view
.. automodule:: pygal
:members:
:undoc-members:
:show-inheritance:

7
docs/api/pygal.serie.rst

@ -0,0 +1,7 @@
pygal.serie module
==================
.. automodule:: pygal.serie
:members:
:undoc-members:
:show-inheritance:

7
docs/api/pygal.state.rst

@ -0,0 +1,7 @@
pygal.state module
==================
.. automodule:: pygal.state
:members:
:undoc-members:
:show-inheritance:

7
docs/api/pygal.style.rst

@ -0,0 +1,7 @@
pygal.style module
==================
.. automodule:: pygal.style
:members:
:undoc-members:
:show-inheritance:

7
docs/api/pygal.svg.rst

@ -0,0 +1,7 @@
pygal.svg module
================
.. automodule:: pygal.svg
:members:
:undoc-members:
:show-inheritance:

7
docs/api/pygal.table.rst

@ -0,0 +1,7 @@
pygal.table module
==================
.. automodule:: pygal.table
:members:
:undoc-members:
:show-inheritance:

7
docs/api/pygal.test.conftest.rst

@ -0,0 +1,7 @@
pygal.test.conftest module
==========================
.. automodule:: pygal.test.conftest
:members:
:undoc-members:
:show-inheritance:

208
docs/api/pygal.test.rst

@ -1,190 +1,36 @@
pygal.test package
==================
Submodules
----------
pygal.test.conftest module
--------------------------
.. automodule:: pygal.test.conftest
:members:
:undoc-members:
:show-inheritance:
pygal.test.test_bar module
--------------------------
.. automodule:: pygal.test.test_bar
:members:
:undoc-members:
:show-inheritance:
pygal.test.test_box module
--------------------------
.. automodule:: pygal.test.test_box
:members:
:undoc-members:
:show-inheritance:
pygal.test.test_colors module
-----------------------------
.. automodule:: pygal.test.test_colors
:members:
:undoc-members:
:show-inheritance:
pygal.test.test_config module
-----------------------------
.. automodule:: pygal.test.test_config
:members:
:undoc-members:
:show-inheritance:
pygal.test.test_date module
---------------------------
.. automodule:: pygal.test.test_date
:members:
:undoc-members:
:show-inheritance:
pygal.test.test_donut module
----------------------------
.. automodule:: pygal.test.test_donut
:members:
:undoc-members:
:show-inheritance:
pygal.test.test_graph module
----------------------------
.. automodule:: pygal.test.test_graph
:members:
:undoc-members:
:show-inheritance:
pygal.test.test_histogram module
--------------------------------
.. automodule:: pygal.test.test_histogram
:members:
:undoc-members:
:show-inheritance:
pygal.test.test_interpolate module
----------------------------------
.. automodule:: pygal.test.test_interpolate
:members:
:undoc-members:
:show-inheritance:
pygal.test.test_line module
---------------------------
.. automodule:: pygal.test.test_line
:members:
:undoc-members:
:show-inheritance:
pygal.test.test_maps module
---------------------------
.. automodule:: pygal.test.test_maps
:members:
:undoc-members:
:show-inheritance:
pygal.test.test_pie module
--------------------------
.. automodule:: pygal.test.test_pie
:members:
:undoc-members:
:show-inheritance:
pygal.test.test_serie_config module
-----------------------------------
.. automodule:: pygal.test.test_serie_config
:members:
:undoc-members:
:show-inheritance:
pygal.test.test_sparktext module
--------------------------------
.. automodule:: pygal.test.test_sparktext
:members:
:undoc-members:
:show-inheritance:
pygal.test.test_stacked module
------------------------------
.. automodule:: pygal.test.test_stacked
:members:
:undoc-members:
:show-inheritance:
pygal.test.test_style module
----------------------------
.. automodule:: pygal.test.test_style
:members:
:undoc-members:
:show-inheritance:
pygal.test.test_table module
----------------------------
.. automodule:: pygal.test.test_table
:members:
:undoc-members:
:show-inheritance:
pygal.test.test_util module
---------------------------
.. automodule:: pygal.test.test_util
:members:
:undoc-members:
:show-inheritance:
pygal.test.test_view module
---------------------------
.. automodule:: pygal.test.test_view
:members:
:undoc-members:
:show-inheritance:
pygal.test.test_xml_filters module
----------------------------------
.. automodule:: pygal.test.test_xml_filters
:members:
:undoc-members:
:show-inheritance:
pygal.test.utils module
-----------------------
.. automodule:: pygal.test.utils
.. automodule:: pygal.test
:members:
:undoc-members:
:show-inheritance:
Submodules
----------
Module contents
---------------
.. toctree::
pygal.test.conftest
pygal.test.test_bar
pygal.test.test_box
pygal.test.test_colors
pygal.test.test_config
pygal.test.test_date
pygal.test.test_donut
pygal.test.test_graph
pygal.test.test_histogram
pygal.test.test_interpolate
pygal.test.test_line
pygal.test.test_maps
pygal.test.test_pie
pygal.test.test_serie_config
pygal.test.test_sparktext
pygal.test.test_stacked
pygal.test.test_style
pygal.test.test_table
pygal.test.test_util
pygal.test.test_view
pygal.test.test_xml_filters
pygal.test.utils
.. automodule:: pygal.test
:members:
:undoc-members:
:show-inheritance:

7
docs/api/pygal.test.test_bar.rst

@ -0,0 +1,7 @@
pygal.test.test_bar module
==========================
.. automodule:: pygal.test.test_bar
:members:
:undoc-members:
:show-inheritance:

7
docs/api/pygal.test.test_box.rst

@ -0,0 +1,7 @@
pygal.test.test_box module
==========================
.. automodule:: pygal.test.test_box
:members:
:undoc-members:
:show-inheritance:

7
docs/api/pygal.test.test_colors.rst

@ -0,0 +1,7 @@
pygal.test.test_colors module
=============================
.. automodule:: pygal.test.test_colors
:members:
:undoc-members:
:show-inheritance:

7
docs/api/pygal.test.test_config.rst

@ -0,0 +1,7 @@
pygal.test.test_config module
=============================
.. automodule:: pygal.test.test_config
:members:
:undoc-members:
:show-inheritance:

7
docs/api/pygal.test.test_date.rst

@ -0,0 +1,7 @@
pygal.test.test_date module
===========================
.. automodule:: pygal.test.test_date
:members:
:undoc-members:
:show-inheritance:

7
docs/api/pygal.test.test_donut.rst

@ -0,0 +1,7 @@
pygal.test.test_donut module
============================
.. automodule:: pygal.test.test_donut
:members:
:undoc-members:
:show-inheritance:

7
docs/api/pygal.test.test_graph.rst

@ -0,0 +1,7 @@
pygal.test.test_graph module
============================
.. automodule:: pygal.test.test_graph
:members:
:undoc-members:
:show-inheritance:

7
docs/api/pygal.test.test_histogram.rst

@ -0,0 +1,7 @@
pygal.test.test_histogram module
================================
.. automodule:: pygal.test.test_histogram
:members:
:undoc-members:
:show-inheritance:

7
docs/api/pygal.test.test_interpolate.rst

@ -0,0 +1,7 @@
pygal.test.test_interpolate module
==================================
.. automodule:: pygal.test.test_interpolate
:members:
:undoc-members:
:show-inheritance:

7
docs/api/pygal.test.test_line.rst

@ -0,0 +1,7 @@
pygal.test.test_line module
===========================
.. automodule:: pygal.test.test_line
:members:
:undoc-members:
:show-inheritance:

7
docs/api/pygal.test.test_maps.rst

@ -0,0 +1,7 @@
pygal.test.test_maps module
===========================
.. automodule:: pygal.test.test_maps
:members:
:undoc-members:
:show-inheritance:

7
docs/api/pygal.test.test_pie.rst

@ -0,0 +1,7 @@
pygal.test.test_pie module
==========================
.. automodule:: pygal.test.test_pie
:members:
:undoc-members:
:show-inheritance:

7
docs/api/pygal.test.test_serie_config.rst

@ -0,0 +1,7 @@
pygal.test.test_serie_config module
===================================
.. automodule:: pygal.test.test_serie_config
:members:
:undoc-members:
:show-inheritance:

7
docs/api/pygal.test.test_sparktext.rst

@ -0,0 +1,7 @@
pygal.test.test_sparktext module
================================
.. automodule:: pygal.test.test_sparktext
:members:
:undoc-members:
:show-inheritance:

7
docs/api/pygal.test.test_stacked.rst

@ -0,0 +1,7 @@
pygal.test.test_stacked module
==============================
.. automodule:: pygal.test.test_stacked
:members:
:undoc-members:
:show-inheritance:

7
docs/api/pygal.test.test_style.rst

@ -0,0 +1,7 @@
pygal.test.test_style module
============================
.. automodule:: pygal.test.test_style
:members:
:undoc-members:
:show-inheritance:

7
docs/api/pygal.test.test_table.rst

@ -0,0 +1,7 @@
pygal.test.test_table module
============================
.. automodule:: pygal.test.test_table
:members:
:undoc-members:
:show-inheritance:

7
docs/api/pygal.test.test_util.rst

@ -0,0 +1,7 @@
pygal.test.test_util module
===========================
.. automodule:: pygal.test.test_util
:members:
:undoc-members:
:show-inheritance:

7
docs/api/pygal.test.test_view.rst

@ -0,0 +1,7 @@
pygal.test.test_view module
===========================
.. automodule:: pygal.test.test_view
:members:
:undoc-members:
:show-inheritance:

7
docs/api/pygal.test.test_xml_filters.rst

@ -0,0 +1,7 @@
pygal.test.test_xml_filters module
==================================
.. automodule:: pygal.test.test_xml_filters
:members:
:undoc-members:
:show-inheritance:

7
docs/api/pygal.test.utils.rst

@ -0,0 +1,7 @@
pygal.test.utils module
=======================
.. automodule:: pygal.test.utils
:members:
:undoc-members:
:show-inheritance:

7
docs/api/pygal.util.rst

@ -0,0 +1,7 @@
pygal.util module
=================
.. automodule:: pygal.util
:members:
:undoc-members:
:show-inheritance:

7
docs/api/pygal.view.rst

@ -0,0 +1,7 @@
pygal.view module
=================
.. automodule:: pygal.view
:members:
:undoc-members:
:show-inheritance:

3
docs/changelog.rst

@ -21,6 +21,9 @@ Changelog
* Fix x_labels and y_labels behaviour for xy like
* Improve gauge a bit
* Finally allow call chains on add
* Transform min_scale and max_scale as options
* mode option has been renamed to a less generic name: box_mode
* fix stack_from_top for stacked lines
1.7.0
=====

614
docs/documentation/basic_customizations.rst

@ -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', [])

109
docs/documentation/configuration/axis.rst

@ -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])

90
docs/documentation/configuration/chart.rst

@ -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

98
docs/documentation/configuration/data.rst

@ -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', [])

50
docs/documentation/interpolations.rst → docs/documentation/configuration/interpolations.rst

@ -1,21 +1,21 @@
Interpolations
==============
Without interpolation:
----------------------
``interpolate``
pygal allow you to interpolate most of line charts. Take this chart for instance:
.. pygal-code::
chart = pygal.Line()
chart.add('line', [1, 5, 17, 12, 5, 10])
With cubic interpolation:
-------------------------
``interpolate``
interpolate
-----------
cubic
~~~~~
You can set the cubic interpolation:
.. pygal-code::
@ -23,10 +23,8 @@ With cubic interpolation:
chart.add('line', [1, 5, 17, 12, 5, 10])
With quadratic interpolation:
-----------------------------
``interpolate``
quadratic
~~~~~~~~~
.. pygal-code::
@ -34,10 +32,8 @@ With quadratic interpolation:
chart.add('line', [1, 5, 17, 12, 5, 10])
With lagrange interpolation:
----------------------------
``interpolate``
lagrange
~~~~~~~~
.. pygal-code::
@ -45,10 +41,8 @@ With lagrange interpolation:
chart.add('line', [1, 5, 17, 12, 5, 10])
With trigonometric interpolation:
---------------------------------
``interpolate``
trigonometric
~~~~~~~~~~~~~
.. pygal-code::
@ -56,10 +50,8 @@ With trigonometric interpolation:
chart.add('line', [1, 5, 17, 12, 5, 10])
With hermite interpolation:
---------------------------
``interpolate``
hermite
~~~~~~~
.. pygal-code::
@ -67,8 +59,10 @@ With hermite interpolation:
chart.add('line', [1, 5, 17, 12, 5, 10])
For hermite you can also pass additionnal parameters to configure tangent behaviour:
interpolation_parameters
------------------------
For hermite you can also pass additionnal parameters to configure tangent behaviour:
.. pygal-code::
@ -90,12 +84,10 @@ For hermite you can also pass additionnal parameters to configure tangent behavi
For more information see the `wikipedia article <http://en.wikipedia.org/wiki/Cubic_Hermite_spline#Finite_difference>`_
Interpolation precision
interpolation_precision
-----------------------
``interpolation_precision``
You can change the resolution of the interpolation with the help of `interpolation_precision`:
You can change the resolution of the interpolation with the help of ``interpolation_precision``:
.. pygal-code::

254
docs/documentation/configuration/label.rst

@ -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])

99
docs/documentation/configuration/legend.rst

@ -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])

35
docs/documentation/configuration/misc.rst

@ -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.

124
docs/documentation/configuration/rendering.rst

@ -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/>`_

29
docs/documentation/configuration/serie.rst

@ -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)

98
docs/documentation/configuration/sizing.rst

@ -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])

166
docs/documentation/configuration/specific_options.rst

@ -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.

46
docs/documentation/configuration/title.rst

@ -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])

22
docs/documentation/configuration/tooltip.rst

@ -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])

4
docs/documentation/metadata.rst → docs/documentation/configuration/value.rst

@ -1,5 +1,5 @@
Metadata
========
Value configuration
===================
Labels

4
docs/documentation/custom_styles.rst

@ -7,7 +7,7 @@ pygal provides 2 ways to customize styles:
Using Style class
-----------------
You can instantiate the `Style` class with some customizations for quick styling:
You can instantiate the ``Style`` class with some customizations for quick styling:
.. pygal-code::
@ -40,7 +40,7 @@ It supports local file names and external stylesheet too, just append your URI i
(See the `default css <https://github.com/Kozea/pygal/blob/master/pygal/css/>`_)
NB: Now the css rules are prefixed by an unique id, to prevent collisions when including several svg dirctly into a web page. You can disable it with the `no_prefix` option.
NB: Now the css rules are prefixed by an unique id, to prevent collisions when including several svg directly into a web page. You can disable it with the ``no_prefix`` option.
.. pygal-code::

7
docs/documentation/index.rst

@ -7,9 +7,8 @@ Documentation
first_steps
types/index
styles
basic_customizations
interpolations
configuration/chart
configuration/serie
configuration/value
sparks
metadata
other_customizations
web

114
docs/documentation/other_customizations.rst

@ -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.

38
docs/documentation/types/box.rst

@ -14,3 +14,41 @@ Here's some whiskers:
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])
and variations:
.. 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])
.. 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])
.. 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])
.. 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])

3
docs/documentation/types/maps/pygal_maps_ch.rst

@ -1,5 +1,6 @@
Swiss map
~~~~~~~~~
---------
Installing
~~~~~~~~~~

2
docs/documentation/types/maps/pygal_maps_fr.rst

@ -1,5 +1,5 @@
French map
~~~~~~~~~~
----------
Installing
~~~~~~~~~~

14
docs/documentation/types/pie.rst

@ -60,3 +60,17 @@ or a ring:
pie_chart.add('Chrome', 36.3)
pie_chart.add('Safari', 4.5)
pie_chart.add('Opera', 2.3)
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)

2
docs/index.rst

@ -53,7 +53,7 @@ Index
installing
contributing
changelog
api
api/modules
* :ref:`genindex`
* :ref:`modindex`

13
pygal/config.py

@ -341,14 +341,23 @@ class Config(CommonConfig):
"ie: For hermite interpolation, you can set the cardinal tension with"
"{'type': 'cardinal', 'c': .5}", int)
mode = Key(
box_mode = Key(
'extremes', str, "Value", "Sets the mode to be used. "
"(Currently only supported on box plot)",
"May be %s" % ' or '.join([
"1.5IQR", "extremes", "tukey", "stdev", "pstdev"]))
order_min = Key(
None, int, "Value", "Minimum order of scale, defaults to None")
None, int, "Value",
"Minimum order of scale, defaults to None")
min_scale = Key(
5, int, "Value",
"Minimum number of scale graduation for auto scaling")
max_scale = Key(
20, int, "Value",
"Maximum number of scale graduation for auto scaling")
range = Key(
None, list, "Value", "Explicitly specify min and max of values",

5
pygal/css/graph.css

@ -53,11 +53,6 @@
text-anchor: start;
}
{{ id }}.axis.y .logarithmic text:not(.major) ,
{{ id }}.axis.y2 .logarithmic text:not(.major) {
font-size: 50%;
}
{{ id }}.axis .guide.line {
stroke-dasharray: 4,4;
}

3
pygal/graph/bar.py

@ -100,7 +100,8 @@ class Bar(Graph):
self._points(x_pos)
y_pos = compute_scale(
self._box.ymin, self._box.ymax, self.logarithmic, self.order_min
self._box.ymin, self._box.ymax, self.logarithmic, self.order_min,
self.min_scale, self.max_scale
) if not self.y_labels else list(map(float, self.y_labels))
self._x_labels = self.x_labels and list(zip(self.x_labels, [

4
pygal/graph/base.py

@ -99,8 +99,8 @@ class BaseGraph(object):
self.y_labels = list(map(adapter, self.y_labels))
x_adapter = reduce(
compose, self._x_adapters) if getattr(
self, '_x_adapters', None) else None
compose, self._x_adapters) if not self.strict and getattr(
self, '_x_adapters', None) else ident
if x_adapter and self.x_labels:
self.x_labels = list(map(x_adapter, self.x_labels))

14
pygal/graph/box.py

@ -48,13 +48,13 @@ class Box(Graph):
def format_maybe_quartile(x):
if is_list_like(x):
if self.mode == "extremes":
if self.box_mode == "extremes":
return 'Min: %s Q1: %s Q2: %s Q3: %s Max: %s' \
% tuple(map(sup, x[1:6]))
elif self.mode in ["tukey", "stdev", "pstdev"]:
elif self.box_mode in ["tukey", "stdev", "pstdev"]:
return 'Min: %s Lower Whisker: %s Q1: %s Q2: %s Q3: %s '\
'Upper Whisker: %s Max: %s' % tuple(map(sup, x))
elif self.mode == '1.5IQR':
elif self.box_mode == '1.5IQR':
# 1.5IQR mode
return 'Q1: %s Q2: %s Q3: %s' % tuple(map(sup, x[2:5]))
else:
@ -68,7 +68,7 @@ class Box(Graph):
"""
for serie in self.series:
serie.values, serie.outliers = \
self._box_points(serie.values, self.mode)
self._box_points(serie.values, self.box_mode)
if self._min:
self._box.ymin = min(self._min, self.zero)
@ -82,7 +82,8 @@ class Box(Graph):
self._points(x_pos)
y_pos = compute_scale(
self._box.ymin, self._box.ymax, self.logarithmic, self.order_min
self._box.ymin, self._box.ymax, self.logarithmic, self.order_min,
self.min_scale, self.max_scale
) if not self.y_labels else list(map(float, self.y_labels))
self._x_labels = self.x_labels and list(zip(self.x_labels, [
@ -182,7 +183,6 @@ class Box(Graph):
r=3,
class_='subtle-fill reactive tooltip-trigger'), metadata)
return (left_edge + width / 2, self.view.y(
sum(quartiles) / len(quartiles)))
@ -220,7 +220,7 @@ class Box(Graph):
return seq[n // 2]
def mean(seq):
return sum(seq) /len(seq)
return sum(seq) / len(seq)
def stdev(seq):
m = mean(seq)

3
pygal/graph/funnel.py

@ -84,7 +84,8 @@ class Funnel(Graph):
self._box.ymax = val_max
y_pos = compute_scale(
self._box.ymin, self._box.ymax, self.logarithmic, self.order_min
self._box.ymin, self._box.ymax, self.logarithmic, self.order_min,
self.min_scale, self.max_scale
) if not self.y_labels else list(map(float, self.y_labels))
self._x_labels = list(

34
pygal/graph/gauge.py

@ -59,9 +59,18 @@ class Gauge(Graph):
metadata)
tolerance = 1.15
theta = min(
max(self._min * tolerance, theta), self._max * tolerance)
if theta < self._min:
theta = self._min * tolerance
if theta > self._max:
theta = self._max * tolerance
w = (self._box._tmax - self._box._tmin + self.view.aperture) / 4
if self.logarithmic:
w = min(w, self._min - self._min * 10 ** -10)
alter(
self.svg.node(
gauges, 'path', d='M %s L %s A %s 1 0 1 %s Z' % (
@ -77,10 +86,10 @@ class Gauge(Graph):
self._tooltip_data(gauges, value, x, y)
self._static_value(serie_node, value, x, y)
def _x_axis(self, draw_axes=True):
axis = self.svg.node(self.nodes['plot'], class_="axis x gauge")
def _y_axis(self, draw_axes=True):
axis = self.svg.node(self.nodes['plot'], class_="axis y x gauge")
for i, (label, theta) in enumerate(self._x_labels):
for i, (label, theta) in enumerate(self._y_labels):
guides = self.svg.node(axis, class_='guides')
self.svg.line(
@ -92,7 +101,7 @@ class Gauge(Graph):
guides, [self.view((0, theta)), self.view((.95, theta))],
close=True,
class_='guide line %s' % (
'major' if i in (0, len(self._x_labels) - 1)
'major' if i in (0, len(self._y_labels) - 1)
else ''))
x, y = self.view((.9, theta))
@ -102,8 +111,8 @@ class Gauge(Graph):
y=y
).text = label
def _y_axis(self, draw_axes=True):
axis = self.svg.node(self.nodes['plot'], class_="axis y gauge")
def _x_axis(self, draw_axes=True):
axis = self.svg.node(self.nodes['plot'], class_="axis x gauge")
x, y = self.view((0, 0))
self.svg.node(axis, 'circle', cx=x, cy=y, r=4)
@ -118,11 +127,12 @@ class Gauge(Graph):
0, 1,
self.min_,
self.max_)
x_pos = compute_scale(
self.min_, self.max_, self.logarithmic, self.order_min
) if not self.x_labels else list(map(float, self.x_labels))
y_pos = compute_scale(
self.min_, self.max_, self.logarithmic, self.order_min,
self.min_scale, self.max_scale
) if not self.y_labels else list(map(float, self.y_labels))
self._x_labels = list(zip(map(self._format, x_pos), x_pos))
self._y_labels = list(zip(map(self._format, y_pos), y_pos))
def _plot(self):
for serie in self.series:

6
pygal/graph/histogram.py

@ -127,10 +127,12 @@ class Histogram(Graph):
self._box.ymin, self._box.ymax = ymin, ymax
x_pos = compute_scale(
self._box.xmin, self._box.xmax, self.logarithmic, self.order_min
self._box.xmin, self._box.xmax, self.logarithmic, self.order_min,
self.min_scale, self.max_scale
) if not self.x_labels else list(map(float, self.x_labels))
y_pos = compute_scale(
self._box.ymin, self._box.ymax, self.logarithmic, self.order_min
self._box.ymin, self._box.ymax, self.logarithmic, self.order_min,
self.min_scale, self.max_scale
) if not self.y_labels else list(map(float, self.y_labels))
self._x_labels = list(zip(map(self._format, x_pos), x_pos))

3
pygal/graph/line.py

@ -164,7 +164,8 @@ class Line(Graph):
self._box.ymax = max(self._box.ymax, max(self.y_labels))
y_pos = compute_scale(
self._box.ymin, self._box.ymax, self.logarithmic, self.order_min
self._box.ymin, self._box.ymax, self.logarithmic, self.order_min,
self.min_scale, self.max_scale
) if not self.y_labels else list(map(float, self.y_labels))
self._y_labels = list(zip(map(self._format, y_pos), y_pos))

2
pygal/graph/radar.py

@ -181,7 +181,7 @@ class Radar(Line):
y_pos = compute_scale(
self._rmin, self._rmax, self.logarithmic, self.order_min,
max_scale=8
self.min_scale, self.max_scale
) if not self.y_labels else list(map(int, self.y_labels))
self._x_labels = self.x_labels and list(zip(self.x_labels, x_pos))

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save