diff --git a/docs/documentation/configuration/serie.rst b/docs/documentation/configuration/serie.rst index 6890d7d..8ed3641 100644 --- a/docs/documentation/configuration/serie.rst +++ b/docs/documentation/configuration/serie.rst @@ -4,12 +4,12 @@ Serie configuration How --- -Series are customized using keyword args set in the ``add`` function: +Series are customized using keyword args set in the ``add`` or call function: .. code-block:: python chart = pygal.Line() - chart.add('', [1, 2, 3], fill=True) + chart(1, 2, 3, fill=True) chart.add('', [3, 2, 1], dot=False) diff --git a/docs/documentation/first_steps.rst b/docs/documentation/first_steps.rst index 5962bec..a1d5d4b 100644 --- a/docs/documentation/first_steps.rst +++ b/docs/documentation/first_steps.rst @@ -68,3 +68,11 @@ And finally add a title and some labels: bar_chart.add('Fibonacci', [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55]) bar_chart.add('Padovan', [1, 1, 1, 2, 2, 3, 4, 5, 7, 9, 12]) +The public API is chainable and can be simplified as call arguments, the last chart can be also written: + +.. code-block:: python + + bar_chart = pygal.HorizontalStackedBar( + title="Remarquable sequences", x_labels=map(str, range(11))( + 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, title='Fibonacci')( + 1, 1, 1, 2, 2, 3, 4, 5, 7, 9, 12, title='Padovan') diff --git a/docs/index.rst b/docs/index.rst index f548fbb..34f32e4 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -40,7 +40,7 @@ Simple python charting .. pygal-code:: inline - pygal.Bar().add('1', [1, 3, 3, 7]).add('2', [1, 6, 6, 4]).render() + pygal.Bar()(1, 3, 3, 7)(1, 6, 6, 4).render() Index