Browse Source

Add new options doc

pull/36/head
Florian Mounier 13 years ago
parent
commit
f89e709be5
  1. 32
      pages/basic_customizations.rst
  2. 2
      pages/chart_types.rst
  3. 33
      pages/other_customizations.rst
  4. 2
      static/css/style.css

32
pages/basic_customizations.rst

@ -157,6 +157,21 @@ You can remove legend and dots by setting these at `False`
chart = pygal.Line(show_dots=False)
chart.add('line', [.0002, .0005, .00035])
Legend at bottom
----------------
``legend_at_bottom``
You can put legend at bottom by setting `legend_at_bottom` at True:
.. pygal-code::
chart = pygal.Line(legend_at_bottom=True)
chart.add('line', [.0002, .0005, .00035])
Rendering
---------
@ -220,6 +235,23 @@ Allow label rotation (in degrees) to avoid axis cluttering:
chart.add('line', [0, .0002, .0005, .00035])
Text truncation
---------------
``truncate_legend, truncate_label``
By default long text are automatically truncated at reasonable length which fit in the graph.
You can override that by setting truncation lenght with `truncate_legend` and `truncate_label`.
.. pygal-code::
chart = pygal.Line(truncate_legend=3, truncate_label=17)
chart.x_labels = ['This is the first point !', 'This is the second point !', 'This is the third point !', 'This is the fourth point !']
chart.add('line', [0, .0002, .0005, .00035])
Human readable
--------------

2
pages/chart_types.rst

@ -267,7 +267,7 @@ Population pyramid:
'Males divorced', 'Females divorced']
pyramid_chart = pygal.Pyramid(human_readable=True, legend_at_bottom=True)
pyramid_chart.title = 'England population by age (source: ons.gov.uk)'
pyramid_chart.title = 'England population by age in 2010 (source: ons.gov.uk)'
pyramid_chart.x_labels = map(lambda x: str(x) if not x % 5 else '', range(90))
for type, age in zip(types, ages):
pyramid_chart.add(type, age)

33
pages/other_customizations.rst

@ -31,10 +31,20 @@ You can set the scale to be logarithmic:
Custom css and js
-----------------
``base_css, base_js``
``css, js``
You can specify a css/js file to replace the one by default using `base_css` and `base_js` options.
These options take a filename in parameter.
You can add or replace css/js files in pygal using the `css` and `js` array options.
These lists contain absolute filenames and/or external URI. (Relative filenames are relative to pygal internal files)
Default:
.. code-block::
css = ['style.css', 'graph.css']
js = [
'https://raw.github.com/Kozea/pygal.js/master/svg.jquery.js',
'https://raw.github.com/Kozea/pygal.js/master/pygal-tooltips.js'
]
Legend box size
@ -53,7 +63,7 @@ You can change the size of the rectangle next to the legend:
Rounded bars
---------------
------------
``rounded_bars``
@ -65,6 +75,19 @@ You can add a round effect to bar diagrams with `rounded_bars`:
chart.add('rounded', [3, 10, 7, 2, 9, 7])
Pretty print
------------
``pretty_print``
You can enable pretty print if you want to edit the source at hand (look at this frame source):
.. pygal-code::
chart = pygal.Bar(pretty_print=True)
chart.add('rounded', [3, 10, 7, 2, 9, 7])
Static options
--------------
@ -75,7 +98,7 @@ viewer or as an image, all the values are displayed on the graph.
It can be disabled by setting `print_values` to `False`.
``print_zeroes`` can be enabled to display static values even if equal to zero.
`print_zeroes` can be enabled to display static values even if equal to zero.
Disable xml declaration

2
static/css/style.css

@ -241,7 +241,7 @@ section pre {
padding: 1em;
background-color: #0a0a0a;
border: 1px solid black;
width: 100%;
max-width: 100%;
overflow-x: auto;
}

Loading…
Cancel
Save