plotext

package module
v0.0.0-...-e8a3482 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 28, 2018 License: BSD-3-Clause Imports: 5 Imported by: 0

README

plotext

Plot extensions and custom plotters for the github.com/gonum/plot packages.

Custom plotters

The custplotter package contains some custom plotters which can be used to create financial charts with golang using the gonum/plot package.

OHLC bars plotter

The example code in plotext/examples/ohlcbars/main.go shows how a plot containing an OHLC bar chart can be created:

OHLC bars

Candlesticks plotter

The example code in plotext/examples/candlesticks/main.go shows how a plot containing a candlestick chart can be created:

Candlesticks

Volume bars plotter

The example code in plotext/examples/vbars/main.go shows how a plot containing a volume bar chart can be created:

Volume bars

Extensions

Alignment of plots with proportions

The plotext package contains an extended Align function which can be used to align e.g. an OHLC bar cart and a volume bar chart vertically while providing e.g. 2/3 of the available height for the OHLC chart and 1/3 of the height for the volume chart.

Alignment

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UniteAxisRanges

func UniteAxisRanges(axises []*plot.Axis)

UniteAxisRanges sets the range of all axises to the minimum and the maximum of all axises.

Types

type Table

type Table struct {
	// RowHeights specifies the number of rows their and relative heights
	// E. g.: When {2, 1} are used then the first row will get 66.7% and the
	// second row 33.3% of available height.
	RowHeights []float64
	// ColWidths specifies the number of columns and their relative widths
	ColWidths []float64
	// PadTop, PadBottom, PadRight, and PadLeft specify the padding
	// on the corresponding side of the table.
	PadTop, PadBottom, PadRight, PadLeft vg.Length
	// PadX and PadY specify the padding between columns and rows
	// of tiles respectively..
	PadX, PadY vg.Length
}

Table creates a table of subcanvases from a Canvas. In contrast to tiles of gonum.org/v1/plot the columns and rows of a table can have different widths and heights respectively.

func (Table) Align

func (tab Table) Align(plots [][]*plot.Plot, dc draw.Canvas) [][]draw.Canvas

Align returns a two-dimensional row-major array of Canvases which will produce plots with DataCanvases that are neatly aligned. The arguments to the function are a two-dimensional row-major array of plots and the canvas to which the plots are to be drawn.

func (Table) At

func (tab Table) At(c draw.Canvas, x, y int) draw.Canvas

At returns the subcanvas within c that corresponds to the cell at column x, row y, where 0, 0 is the upper, right corner

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL