Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultCandleWidthFactor = 3
DefaultCandleWidthFactor is the default width of the candle relative to the DefaultLineStyle.Width.
var DefaultTickWidth = vg.Points(2)
DefaultTickWidth is the default width of the open and close ticks.
Functions ¶
This section is empty.
Types ¶
type Candlesticks ¶
type Candlesticks struct { TOHLCVs // ColorUp is the color of sticks where C >= O ColorUp color.Color // ColorDown is the color of sticks where C < O ColorDown color.Color // LineStyle is the style used to draw the sticks. draw.LineStyle // CandleWidth is the width of a candlestick CandleWidth vg.Length // FixedLineColor determines if a fixed line color can be used for up and down bars. // When set to true then the color of LineStyle is used to draw the sticks and // the borders of the candle. If set to false then ColorUp or ColorDown are used to // draw the sticks and the borders of the candle. Thus a candle's fill color is also // used for the borders and sticks. FixedLineColor bool }
Candlesticks implements the Plotter interface, drawing a bar plot of time, open, high, low, close tuples.
func NewCandlesticks ¶
func NewCandlesticks(TOHLCV TOHLCVer) (*Candlesticks, error)
NewCandlesticks creates as new candlestick plotter for the given data.
func (*Candlesticks) DataRange ¶
func (sticks *Candlesticks) DataRange() (xMin, xMax, yMin, yMax float64)
DataRange implements the DataRange method of the plot.DataRanger interface.
func (*Candlesticks) GlyphBoxes ¶
func (sticks *Candlesticks) GlyphBoxes(plt *plot.Plot) []plot.GlyphBox
GlyphBoxes implements the GlyphBoxes method of the plot.GlyphBoxer interface. We just return 2 glyph boxes at xmin, ymin and xmax, ymax Important is that they provide space for the left part of the first candle's body and for the right part of the last candle's body
type OHLCBars ¶
type OHLCBars struct { TOHLCVs // ColorUp is the color of bars where C >= O ColorUp color.Color // ColorDown is the color of bars where C < O ColorDown color.Color // LineStyle is the style used to draw the bars. draw.LineStyle // CapWidth is the width of the caps drawn at the top // of each error bar. TickWidth vg.Length }
OHLCBars implements the Plotter interface, drawing a bar plot of time, open, high, low, close tuples.
func NewOHLCBars ¶
NewBars creates as new bar plotter for the given data.
func (*OHLCBars) DataRange ¶
DataRange implements the DataRange method of the plot.DataRanger interface.
func (*OHLCBars) GlyphBoxes ¶
GlyphBoxes implements the GlyphBoxes method of the plot.GlyphBoxer interface. We just return 2 glyph boxes at xmin, ymin and xmax, ymax Important is that they provide space for the first open tick and the last close tick
type TOHLCVer ¶
type TOHLCVer interface { // Len returns the number of time, open, high, low, close, volume tuples. Len() int // TOHLCV returns an time, open, high, low, close, volume tuple. TOHLCV(int) (float64, float64, float64, float64, float64, float64) }
TOHLCV wraps the Len and TOHLCV methods.
type TOHLCVs ¶
type TOHLCVs []struct{ T, O, H, L, C, V float64 }
TOHLCVs implements the TOHLCVer interface using a slice.
type VBars ¶
type VBars struct { TOHLCVs // ColorUp is the color of bars where C >= O ColorUp color.Color // ColorDown is the color of bars where C < O ColorDown color.Color // LineStyle is the style used to draw the bars. draw.LineStyle }
VBars implements the Plotter interface, drawing a volume bar plot.
func (*VBars) DataRange ¶
DataRange implements the DataRange method of the plot.DataRanger interface.
func (*VBars) GlyphBoxes ¶
GlyphBoxes implements the GlyphBoxes method of the plot.GlyphBoxer interface. We just return 2 glyph boxes at xmin, ymin and xmax, ymax Important is that they provide space for the left part of the first candle's body and for the right part of the last candle's body