API Reference

This is a Gruffy API Reference.

Base Graph Object

Baseオブジェクトはすべてのグラフオブジェクトの基本オブジェクトになります。 通常、グラフ作成をする場合には使用することはありません。新しいグラフオブジェクトを作成したい場合に継承して使用してください。

このオブジェクトはグラフのカラーテーマの設定、データの設定、グラフの描画設定、グラフの描画を行います。

class gruffy.base.Base(target_width=800)[source]

This object is based on all Graph Object. When you create new graph object, override this object:

from gruffy.base import Base

class NewGraph(Base):
    pass
data(name, data_points=[], color=None)[source]

Set up graph dataset

Parameters:
  • name – data name
  • data_points – list of data point
  • colorforce settig color of graph data
display()[source]

wrapper for pgmagick.Image.display()

draw graph, and render graph.

theme_37signals()[source]

Setting up 37 signals like gradient theme.

theme_django()[source]

Setting up Django like theme

theme_greyscale()[source]

Setting up black and white theme

theme_keynote()[source]

Setting up Keynote like gradient theme.

theme_odeo()[source]

A color scheme similar to that used on the popular podcast site.

theme_pastel()[source]

Setting up pastel color theme.

theme_rails_keynote()[source]

A color scheme from the colors used on the 2005 Rails keynote presentation at RubyConf.

title

Title of Graph.

transparent

Transparent flag (or value). False is non-transparent rendering, True is default value transparent, float value is value’s transparent.

write(filename='graph.png')[source]

draw graph and save the graph image.

x_axis_label

setting labels

y_axis_label

setting labels

StackedMixinオブジェクト

データを積み重ねて表示するグラフを作成したい場合は、このオブジェクトを 他のグラフオブジェクトと一緒に継承してください。 このオブジェクトはデータセットの合計値を算出する get_maximum_by_stack() メソッドのみを提供します。

class gruffy.base.StackedMixin[source]

Stacked Graph Mix-in

When you create new stacked graph object, mixed in this object:

from gruffy.base import Base, StackedMixin

class NewStackedGraph(Base, StackedMixin):
    pass
get_maximum_by_stack()[source]

get sum of each stack

Areaグラフオブジェクト

Areaオブジェクトは面グラフを作成するグラフオブジェクトです。

class gruffy.Area(target_width=800)

Area Graph Object

draw()

override to draw() method in Base Class.

Barグラフオブジェクト

棒グラフを作成するためのオブジェクトです。

class gruffy.Bar(target_width=800)

Bar Graph Object

Dotグラフオブジェクト

点グラフを作成するためのオブジェクトです。

class gruffy.Dot(target_width=800)

Dot Graph Object

Lineグラフオブジェクト

折れ線グラフを作成するためのオブジェクトです。

class gruffy.Line(*args)

Line Graph Object

Pieグラフオブジェクト

パイグラフを作成するためのオブジェクトです。

class gruffy.Pie(target_width=800)

Pie Graph Object

draw_label(center_x, center_y, angle, radius, amount)

Labels are drawn around a slightly wider ellipse to give room for labels on the left and right.

sums_for_pie()

collect data values