pygal.config module

Config module holding all options and their default values.

class pygal.config.BaseConfig(**kwargs)[source]

Bases: pygal.config.ConfigBase

This class holds the common method for configs.

A config object can be instanciated with keyword arguments and updated on call with keyword arguments.

copy()[source]

Copy this config object into another

to_dict()[source]

Export a JSON serializable dictionary of the config

class pygal.config.CommonConfig(**kwargs)[source]

Bases: pygal.config.BaseConfig

Class holding options used in both chart and serie configuration

allow_interruptions = Type: bool      Default: False      Break lines on None values
dots_size = Type: float      Default: 2.5      Radius of the dots
fill = Type: bool      Default: False      Fill areas under lines
formatter = Type: function      Default: None      A function to convert raw value to strings for this chart or serie Default to value_formatter in most charts, it depends on dual charts.(Can be overriden by value with the formatter metadata.)
inner_radius = Type: float      Default: 0      Piechart inner radius (donut), must be <.9
rounded_bars = Type: int      Default: None      Set this to the desired radius in px (for Bar-like charts)
show_dots = Type: bool      Default: True      Set to false to remove dots
show_only_major_dots = Type: bool      Default: False      Set to true to show only major dots according to their majored label
stroke = Type: bool      Default: True      Line dots (set it to false to get a scatter plot)
stroke_style = Type: dict      Default: None      Stroke style of serie element. This is a dict which can contain a 'width', 'linejoin', 'linecap', 'dasharray' and 'dashoffset'
class pygal.config.Config(**kwargs)[source]

Bases: pygal.config.CommonConfig

Class holding config values

box_mode = Type: str      Default: 'extremes'      Sets the mode to be used. (Currently only supported on box plot) May be 1.5IQR or extremes or tukey or stdev or pstdev
classes = Type: list      Default: ('pygal-chart',)      Classes of the root svg node <class 'str'>
css = Type: list of str      Default: ('file://style.css', 'file://graph.css')      List of css file It can be any uri from file:///tmp/style.css to //domain/style.css
defs = Type: list of str      Default: []      Extraneous defs to be inserted in svg Useful for adding gradients / patterns…
disable_xml_declaration = Type: bool      Default: False      Don't write xml declaration and return str instead of string useful for writing output directly in html
dynamic_print_values = Type: bool      Default: False      Show values only on hover
explicit_size = Type: bool      Default: False      Write width and height attributes
force_uri_protocol = Type: str      Default: 'https'      Default uri protocol Default protocol for external files. Can be set to None to use a // uri
half_pie = Type: bool      Default: False      Create a half-pie chart
height = Type: int      Default: 600      Graph height
include_x_axis = Type: bool      Default: False      Always include x axis
inner_radius = Type: float      Default: 0      Piechart inner radius (donut), must be <.9
interpolate = Type: str      Default: None      Interpolation May be trigonometric or lagrange or cubic or hermite or quadratic
interpolation_parameters = Type: dict of int      Default: {}      Various parameters for parametric interpolations ie: For hermite interpolation, you can set the cardinal tension with{'type': 'cardinal', 'c': .5}
interpolation_precision = Type: int      Default: 250      Number of interpolated points between two values
inverse_y_axis = Type: bool      Default: False      Inverse Y axis direction
js = Type: list of str      Default: ('//kozea.github.io/pygal.js/2.0.x/pygal-tooltips.min.js',)      List of js file It can be any uri from file:///tmp/ext.js to //domain/ext.js
legend_at_bottom = Type: bool      Default: False      Set to true to position legend at bottom
legend_at_bottom_columns = Type: int      Default: None      Set to true to position legend at bottom
legend_box_size = Type: int      Default: 12      Size of legend boxes
logarithmic = Type: bool      Default: False      Display values in logarithmic scale
margin = Type: int      Default: 20      Margin around chart
margin_bottom = Type: int      Default: None      Margin around bottom of chart
margin_left = Type: int      Default: None      Margin around left of chart
margin_right = Type: int      Default: None      Margin around right of chart
margin_top = Type: int      Default: None      Margin around top of chart
max_scale = Type: int      Default: 16      Maximum number of scale graduation for auto scaling
min_scale = Type: int      Default: 4      Minimum number of scale graduation for auto scaling
missing_value_fill_truncation = Type: str      Default: 'x'      Filled series with missing x and/or y values at the end of a series are closed at the first value with a missing 'x' (default), 'y' or 'either'
no_data_text = Type: str      Default: 'No data'      Text to display when no data is given
no_prefix = Type: bool      Default: False      Don't prefix css
order_min = Type: int      Default: None      Minimum order of scale, defaults to None
pretty_print = Type: bool      Default: False      Pretty print the svg
print_labels = Type: bool      Default: False      Display value labels
print_values = Type: bool      Default: False      Display values as text over plot
print_values_position = Type: str      Default: 'center'      Customize position of `print_values`. (For bars: `top`, `center` or `bottom`)
print_zeroes = Type: bool      Default: True      Display zero values as well
range = Type: list of int      Default: None      Explicitly specify min and max of values (ie: (0, 100))
rounded_bars = Type: int      Default: None      Set this to the desired radius in px
secondary_range = Type: list of int      Default: None      Explicitly specify min and max of secondary values (ie: (0, 100))
show_legend = Type: bool      Default: True      Set to false to remove legend
show_minor_x_labels = Type: bool      Default: True      Set to false to hide x-labels not marked major
show_minor_y_labels = Type: bool      Default: True      Set to false to hide y-labels not marked major
show_x_guides = Type: bool      Default: False      Set to true to always show x guide lines
show_x_labels = Type: bool      Default: True      Set to false to hide x-labels
show_y_guides = Type: bool      Default: True      Set to false to hide y guide lines
show_y_labels = Type: bool      Default: True      Set to false to hide y-labels
spacing = Type: int      Default: 10      Space between titles/legend/axes
stack_from_top = Type: bool      Default: False      Stack from top to zero, this makes the stacked data match the legend order
strict = Type: bool      Default: False      If True don't try to adapt / filter wrong values
style = Type: Style      Default: <pygal.style.RotateStyle object at 0x7f694d3ff198>      Style holding values injected in css
title = Type: str      Default: None      Graph title. Leave it to None to disable title.
tooltip_border_radius = Type: int      Default: 0      Tooltip border radius
tooltip_fancy_mode = Type: bool      Default: True      Fancy tooltips Print legend, x label in tooltip and use serie color for value.
truncate_label = Type: int      Default: None      Label string length truncation threshold None = auto, Negative for none
truncate_legend = Type: int      Default: None      Legend string length truncation threshold None = auto, Negative for none
value_formatter = Type: function      Default: <pygal.formatters.Default object at 0x7f694d402ba8>      A function to convert ordinate numeric value to strings
width = Type: int      Default: 800      Graph width
x_label_rotation = Type: int      Default: 0      Specify x labels rotation angles in degrees
x_labels = Type: list of str      Default: None      X labels, must have same len than data. Leave it to None to disable x labels display.
x_labels_major = Type: list of str      Default: None      X labels that will be marked major.
x_labels_major_count = Type: int      Default: None      Mark n evenly distributed labels as major.
x_labels_major_every = Type: int      Default: None      Mark every n-th x label as major.
x_title = Type: str      Default: None      Graph X-Axis title. Leave it to None to disable X-Axis title.
x_value_formatter = Type: function      Default: <pygal.formatters.Default object at 0x7f694d402ba8>      A function to convert abscissa numeric value to strings (used in XY and Date charts)
xrange = Type: list of int      Default: None      Explicitly specify min and max of x values (used in XY and Date charts) (ie: (0, 100))
y_label_rotation = Type: int      Default: 0      Specify y labels rotation angles in degrees
y_labels = Type: list of float      Default: None      You can specify explicit y labels Must be a list of numbers
y_labels_major = Type: list of str      Default: None      Y labels that will be marked major. Default: auto
y_labels_major_count = Type: int      Default: None      Mark n evenly distributed y labels as major.
y_labels_major_every = Type: int      Default: None      Mark every n-th y label as major.
y_title = Type: str      Default: None      Graph Y-Axis title. Leave it to None to disable Y-Axis title.
zero = Type: int      Default: 0      Set the ordinate zero value Useful for filling to another base than abscissa
class pygal.config.Key(default_value, type_, category, doc, subdoc='', subtype=None)[source]

Bases: object

Represents a config parameter.

A config parameter has a name, a default value, a type, a category, a documentation, an optional longer documentatation and an optional subtype for list style option.

Most of these informations are used in cabaret to auto generate forms representing these options.

coerce(value)[source]

Cast a string into this key type

is_boolean

Return True if this parameter is a boolean

is_dict

Return True if this parameter is a mapping

is_list

Return True if this parameter is a list

is_numeric

Return True if this parameter is numeric (int or float)

is_string

Return True if this parameter is a string

class pygal.config.MetaConfig[source]

Bases: type

Config metaclass. Used to get the key name and set it on the value.

class pygal.config.SerieConfig(**kwargs)[source]

Bases: pygal.config.CommonConfig

Class holding serie config values

secondary = Type: bool      Default: False      Set it to put the serie in a second axis