Browse Source

Tooltip Precision Note

Added note to describe how to use value_formatter field and simple example.
This is a follow up to issue 79: https://github.com/Kozea/pygal/issues/79
pull/111/head
Phil 11 years ago
parent
commit
4b690b4e43
  1. 15
      pages/basic_customizations.rst

15
pages/basic_customizations.rst

@ -480,6 +480,21 @@ Font size
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
----------

Loading…
Cancel
Save