gui.charting.chart — Provides a gtk.Widget for simple charts

This module contains the Chart class, which is a gtk.Widget that draws simple charts. Most of the actual work is performed by the classes in the gui.charting.axis and gui.charting.graph modules.

A list of the features charts provide and a usage example can be found on the documentation page of the gui.charting package.

The Chart Widget

class gui.charting.chart.Chart
Creates a new instance of this class. Chart is a subclass of gtk.DrawingArea.
Chart.chartArea

A named tuple (x, y, width, height) that indicates the position and size of the area of the widget used to show the actual chart rather than the tick labels, the dimension labels, and the caption. Read-only.

The tuple is automatically updated when captionText, minCaptionLines or the widget’s size allocation change.

Axes

Chart.abscissa
The chart’s Abscissa. Read-only.
Chart.ordinate
The chart’s Ordinate. Read-only.
Chart.secondaryOrdinate
The chart’s SecondaryOrdinate. Read-only. The secondary ordinate is only shown if showSecondaryOrdinate is set to True.
Chart.showSecondaryOrdinate
Determines whether the chart’s secondary ordinate will be shown. May be modified. The default is False.

Graphs

Chart.addGraph(graph)
Adds the given graph to those that are displayed on chart. A chart can have any number of graphs, and a graph can be shown on any number of charts.
Chart.addSecondaryGraph(graph)

Adds the given graph to those that are displayed on chart. The graph will use the dimension of the secondary ordinate. If showSecondaryOrdinate is False, the graph will not be shown.

A chart can have any number of graphs, and a graph can be shown on any number of charts.

Chart.clearGraphs()
Removes all graphs from the chart.

Caption

Chart.captionText
The text of the chart’s caption. Pango Markup Language tags are supported. The caption is only shown if the chart has at least one graph. If the value is None or '', no caption will be shown.
Chart.minCaptionLines

The minimum number of lines worth of space the chart reserves for its caption. If the captions uses fewer lines, it still receives the amount of vertical space that would be used by that number of lines. If a caption uses more lines, it receives as much space as required.

This is useful to give a series of related charts with captions of different lengths an uniform appearance.

Constants

gui.charting.chart.NO_DATA_TEXT
A string that is drawn in the middle of the chart area if there are no graphs to be drawn. Pango Markup Language tags are supported.
gui.charting.chart.BORDER
A named tuple (top, bottom, left, right) of the amount of space left around the actual chart for showing the axes’ tick and dimension labels. bottom does not include the space for the caption.

Table Of Contents

Previous topic

The gui.charting Package

Next topic

gui.charting.axis — Handles the charts’ axes