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
website
Phil 11 years ago committed by Florian Mounier
parent
commit
61e4250a4f
  1. 15
      pages/basic_customizations.rst

15
pages/basic_customizations.rst

@ -493,6 +493,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