needpie

New in version 0.5.0.

needpie adds a pie-chart to your documentation:

.. needpie:: My pie chart

   type == 'req'
   type == 'spec'
   10
../_images/need_pie_76ebe.png

The argument of the needpie will be used as title for the pie.

Each content line gets interpreted either as static float/int value or as a Filter string. The amount of found needs by the filter string is then used as value.

needpie supports also own defined filters with the help of Python code through Filter function.

Options

Example with all options used:

../_images/need_pie_1bc0e.png
.. needpie:: Requirement status
   :labels: Open, In progress, Closed
   :legend:
   :shadow:
   :explode: 0, 0.3, 0
   :colors: #ffcc00, #444444, limegreen
   :text_color: crimson
   :style: dark_background

   type == 'req' and status == 'open'
   type == 'req' and status == 'in progress'
   type == 'req' and status == 'closed'

labels

Use :labels: to set labels for each value.

:labels: must get a comma separated string and the amount of labels must match the amount of values/lines from content.

../_images/need_pie_dbfaf.png
.. needpie:: Requirement status
   :labels: Open, In progress, Closed

   type == 'req' and status == 'open'
   type == 'req' and status == 'in progress'
   type == 'req' and status == 'closed'

legend

If :legend: is given, a legend will be placed to the right side of the pie chart.

:legend: is a flag and does not support any values.

../_images/need_pie_2c3ed.png
.. needpie:: Requirement status
   :labels: Open, In progress, Closed
   :legend:

   type == 'req' and status == 'open'
   type == 'req' and status == 'in progress'
   type == 'req' and status == 'closed'

explode

:explode: takes a comma-separated list of floats and defines how much space a specific pie-part shall be moved of from center.

The amount of values for :explode: must match the amount of values / content lines.

Useful values for :explode: are between 0 and 0.3

../_images/need_pie_132a2.png
.. needpie:: Requirement status
   :explode: 0,0.2,0

   type == 'req' and status == 'open'
   type == 'req' and status == 'in progress'
   type == 'req' and status == 'closed'

shadow

:shadow: activates a shadow in the pie chart. It does not support any further values.

../_images/need_pie_873ef.png
.. needpie:: Requirement status
   :explode: 0,0.2,0
   :shadow:

   type == 'req' and status == 'open'
   type == 'req' and status == 'in progress'
   type == 'req' and status == 'closed'

colors

:color: takes a comma separated list of color names and uses them for the pie pieces.

See Matplotlib documentation of supported colors for a complete list of color names.

But beside names also hex-values like #ffcc00 are supported.

../_images/need_pie_88777.png
.. needpie:: Requirement status
   :colors: lightcoral, gold, #555555

   type == 'req' and status == 'open'
   type == 'req' and status == 'in progress'
   type == 'req' and status == 'closed'

text_color

:text_color: defines the color for text inside the pie pieces and the labels. The legend and title color are not changed.

../_images/need_pie_47238.png
.. needpie:: Requirement status
   :text_color: w

   type == 'req' and status == 'open'
   type == 'req' and status == 'in progress'
   type == 'req' and status == 'closed'

style

:style: activates a complete style (colors, font, sizes) for a pie chart. It takes a string, which must match the supported Matplotlib style names.

Useful styles are for example:

  • default

  • classic

  • Solarize_Light2

  • dark_background

  • grayscale

../_images/need_pie_df9e6.png
.. needpie:: Requirement status
   :style: Solarize_Light2

   type == 'req' and status == 'open'
   type == 'req' and status == 'in progress'
   type == 'req' and status == 'closed'