Browse Source

Update documentation

pull/307/head
Florian Mounier 9 years ago
parent
commit
ebfe90a553
  1. 11
      demo/moulinrouge/tests.py
  2. 2
      docs/api/pygal.graph.rst
  3. 16
      docs/documentation/configuration/serie.rst
  4. 19
      docs/documentation/types/line.rst
  5. 8
      docs/documentation/types/xy.rst

11
demo/moulinrouge/tests.py

@ -1071,6 +1071,17 @@ def get_test_routes(app):
chart.range = (30, 200) chart.range = (30, 200)
return chart.render_response() return chart.render_response()
@app.route('/test/interruptions')
def test_interruptions():
chart = Line(allow_interruptions=True)
chart.add(
'interrupt', [22, 34, 43, 12, None, 12, 55, None, 56],
allow_interruptions=False)
chart.add('not interrupt', [
-a if a else None
for a in (22, 34, 43, 12, None, 12, 55, None, 56)])
return chart.render_response()
return list(sorted(filter( return list(sorted(filter(
lambda x: x.startswith('test') and not x.endswith('_for'), locals())) lambda x: x.startswith('test') and not x.endswith('_for'), locals()))
) + list(sorted(filter( ) + list(sorted(filter(

2
docs/api/pygal.graph.rst

@ -22,7 +22,9 @@ Submodules
pygal.graph.histogram pygal.graph.histogram
pygal.graph.horizontal pygal.graph.horizontal
pygal.graph.horizontalbar pygal.graph.horizontalbar
pygal.graph.horizontalline
pygal.graph.horizontalstackedbar pygal.graph.horizontalstackedbar
pygal.graph.horizontalstackedline
pygal.graph.line pygal.graph.line
pygal.graph.map pygal.graph.map
pygal.graph.pie pygal.graph.pie

16
docs/documentation/configuration/serie.rst

@ -122,3 +122,19 @@ inner_radius
chart = pygal.Pie() chart = pygal.Pie()
for i in range(10): for i in range(10):
chart.add(str(i), i, inner_radius=(10 - i) / 10) chart.add(str(i), i, inner_radius=(10 - i) / 10)
allow_interruptions
~~~~~~~~~~~~~~~~~~~
You can set `allow_interruptions` to True in order to break lines on None values.
.. pygal-code::
interrupted_chart = pygal.Line()
interrupted_chart.add(
'Temperature', [22, 34, 43, 12, None, 12, 55, None, 56],
allow_interruptions=True)
interrupted_chart.add(
'Temperature', [11, 17, 21.5, 6, None, 6, 27.5, None, 28])

19
docs/documentation/types/line.rst

@ -17,19 +17,6 @@ Basic simple line graph:
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]) 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])
Interruptions
^^^^^^^^^^^^^
If you happen to want a break in the middle of a plot, you can pass None values. Additionally,
you will need to specify allow_interruptions=True in the constructor, in order for the behaviour
to be supported correctly
.. pygal-code::
interrupted_chart = pygal.Line(allow_interruptions=True)
interrupted_chart.add('Temperature', [22, 34, 43, 12, None, 12, 55, None, 56])
Stacked Stacked
~~~~~~~ ~~~~~~~
@ -61,3 +48,9 @@ For time related plots, just format your labels or use `one variant of xy charts
datetime(2013, 2, 2), datetime(2013, 2, 2),
datetime(2013, 2, 22)]) datetime(2013, 2, 22)])
date_chart.add("Visits", [300, 412, 823, 672]) date_chart.add("Visits", [300, 412, 823, 672])
None values
~~~~~~~~~~~
None values will be skipped. It is also possible to `break lines <../configuration/serie.html#allow-interruptions>`_.

8
docs/documentation/types/xy.rst

@ -63,9 +63,6 @@ DateTime
Date Date
++++ ++++
If you want to plot date/time-series with breaks inside the plot, pass allow_interruptions=True to
the constructor. See Line on how to do it
.. pygal-code:: .. pygal-code::
from datetime import date from datetime import date
@ -117,3 +114,8 @@ TimeDelta
(timedelta(days=3, microseconds=30), 12), (timedelta(days=3, microseconds=30), 12),
(timedelta(weeks=1), 10), (timedelta(weeks=1), 10),
]) ])
None values
~~~~~~~~~~~
None values will be skipped. It is also possible to `break lines <../configuration/serie.html#allow-interruptions>`_.

Loading…
Cancel
Save