Browse Source

Update doc

pull/36/head
Florian Mounier 13 years ago
parent
commit
97ed7f1560
  1. 23
      pages/chart_types.rst
  2. 1
      pages/documentation.rst
  3. 9
      pages/home.rst
  4. 99
      pages/metadata.rst
  5. 20
      pages/other_customizations.rst
  6. 11
      pages/styles.rst

23
pages/chart_types.rst

@ -179,7 +179,26 @@ Simple Kiviat diagram:
radar_chart = pygal.Radar()
radar_chart.title = 'V8 benchmark results'
radar_chart.x_labels = ['Richards', 'DeltaBlue', 'Crypto', 'RayTrace', 'EarleyBoyer', 'RegExp', 'Splay', 'NavierStokes']
radar_chart.add('Chrome', [4074, 3458, 12942, 3541, 10799, 1863, 657, 5918])
radar_chart.add('Firefox', [3100, 2579, 3638, 2524, 3800, 552, 3675, 9043])
radar_chart.add('Chrome', [6395, 8212, 7520, 7218, 12464, 1660, 2123, 8607])
radar_chart.add('Firefox', [7473, 8099, 11700, 2651, 6361, 1044, 3797, 9450])
radar_chart.add('Opera', [3472, 2933, 4203, 5229, 5810, 1828, 9013, 4669])
radar_chart.add('IE', [43, 41, 59, 79, 144, 136, 34, 102])
Dot charts
------------
Basic
^^^^^
Punch card like chart:
.. pygal-code::
dot_chart = pygal.Dot(x_label_rotation=30)
dot_chart.title = 'V8 benchmark results'
dot_chart.x_labels = ['Richards', 'DeltaBlue', 'Crypto', 'RayTrace', 'EarleyBoyer', 'RegExp', 'Splay', 'NavierStokes']
dot_chart.add('Chrome', [6395, 8212, 7520, 7218, 12464, 1660, 2123, 8607])
dot_chart.add('Firefox', [7473, 8099, 11700, 2651, 6361, 1044, 3797, 9450])
dot_chart.add('Opera', [3472, 2933, 4203, 5229, 5810, 1828, 9013, 4669])
dot_chart.add('IE', [43, 41, 59, 79, 144, 136, 34, 102])

1
pages/documentation.rst

@ -11,6 +11,7 @@ User documentation
- `Styles </styles>`_ - change the style.
- `Basic customizations </basic_customizations>`_ - start to improve your chats.
- `Interpolations </interpolations>`_ - smooth your lines.
- `Metadata </metadata>`_ - enrich your graph.
- `Other customizations </other_customizations>`_ - customize all the things.

9
pages/home.rst

@ -39,6 +39,13 @@ pygal is a dynamic SVG charting library.
chart.add('red', [1, 2, 3, 1, 2])
chart.add('green', [4, 3, 0, 1, 2])
.. pygal:: 300 200
chart = pygal.Dot(style=pygal.style.NeonStyle)
chart.x_labels = 'one', 'two', 'three', 'four', 'five'
chart.add('red', [1, 2, 3, 1, 2])
chart.add('green', [4, 3, 0, 1, 2])
It features various graph types:
@ -52,6 +59,8 @@ It features various graph types:
- `Radar charts </chart_types/#radar-charts>`_
- `Dot charts </chart_types/#dot-charts>`_
Python/Css styling with some packaged themes (`default </styles/#default>`_,
`light </styles/#light>`_,

99
pages/metadata.rst

@ -0,0 +1,99 @@
===============
Documentation
===============
Metadata
========
.. contents::
Labels
------
You can add per value metadata like labels, by specifying a dictionary instead of a value:
.. pygal-code::
chart = pygal.Bar()
chart.add('Red', {'value': 2, 'label': 'This is red'})
chart.add('Green', {'value': 4, 'label': 'This is green'})
chart.add('Yellow', 7)
chart.add('Blue', {'value': 5})
chart.add('Violet', {'value': 3, 'label': 'This is violet'})
Links
-----
Basic
^^^^^
You can also add hyper links:
.. pygal-code::
chart = pygal.Bar()
chart.add('Red', {
'value': 2,
'label': 'This is red',
'xlink': 'http://en.wikipedia.org/wiki/Red'})
chart.add('Green', {
'value': 4,
'label': 'This is green',
'xlink': 'http://en.wikipedia.org/wiki/Green'})
chart.add('Yellow', 7)
chart.add('Blue', {
'value': 5,
'xlink': 'http://en.wikipedia.org/wiki/Blue'})
chart.add('Violet', {
'value': 3,
'label': 'This is violet',
'xlink': 'http://en.wikipedia.org/wiki/Violet_(color)'})
Advanced
^^^^^^^^
You can specify a dictionary to xlink with all links attributes:
.. pygal-code::
chart = pygal.Bar()
chart.add('Red', {
'value': 2,
'label': 'This is red',
'xlink': {'href': 'http://en.wikipedia.org/wiki/Red'}})
chart.add('Green', {
'value': 4,
'label': 'This is green',
'xlink': {
'href': 'http://en.wikipedia.org/wiki/Green',
'target': '_top'}
})
chart.add('Yellow', 7)
chart.add('Blue', {
'value': 5,
'xlink': {
'href': 'http://en.wikipedia.org/wiki/Blue',
'target': '_blank'}
})
chart.add('Violet', {
'value': 3,
'label': 'This is violet',
'xlink': {
'href': 'http://en.wikipedia.org/wiki/Violet_(color)',
'target': '_self'}
})

20
pages/other_customizations.rst

@ -78,26 +78,6 @@ It can be disabled by setting `print_values` to `False`.
``print_zeroes`` can be enabled to display static values even if equal to zero.
Tooltip animation
-----------------
``animation_steps``
.. caution::
Experimental (might be slow acconding to particular conditions)
If you want some smoothing in tooltip display you can set animation_steps to a number.
The greater the number the slowest but detailed the animation:
.. pygal-code::
chart = pygal.Line(animation_steps=20)
values = [1, 3, 43, 123, 1231, 23192]
chart.x_labels = map(str, values)
chart.add('log example', values)
Disable xml declaration
-----------------------

11
pages/styles.rst

@ -129,8 +129,11 @@ You can instantiate the `Style` class with some customizations for quick styling
Using a custom css
^^^^^^^^^^^^^^^^^^
You can also specify a file containing a custom css for more customization.
(See the `default css <https://github.com/Kozea/pygal/blob/master/pygal/css/graph.css>`_)
You can also specify a file containing a custom css for more customization. The css option is an array containing included css by default (except from ``base.css`` which is always included).
It supports local file names and external stylesheet too, just append your URI in the list.
(See the `default css <https://github.com/Kozea/pygal/blob/master/pygal/css/>`_)
.. pygal-code::
@ -184,7 +187,9 @@ You can also specify a file containing a custom css for more customization.
custom_css_file = '/tmp/pygal_custom_style.css'
with open(custom_css_file, 'w') as f:
f.write(custom_css)
chart = pygal.StackedLine(fill=True, interpolate='cubic', base_css=custom_css_file)
config = pygal.Config(fill=True, interpolate='cubic')
config.css.append(custom_css_file)
chart = pygal.StackedLine(config)
chart.add('A', [1, 3, 5, 16, 13, 3, 7])
chart.add('B', [5, 2, 3, 2, 5, 7, 17])
chart.add('C', [6, 10, 9, 7, 3, 1, 0])

Loading…
Cancel
Save