plotter

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BarChart

type BarChart struct {
	plotter.Values

	// Width is the width of the bars.
	Width float64

	// Color is the fill color of the bars.
	Color color.Color

	// LineStyle is the style of the outline of the bars.
	draw.LineStyle

	// Offset is added to the X location of each bar.
	// When the Offset is zero, the bars are drawn
	// centered at their X location.
	Offset vg.Length

	// XMin is the X location of the first bar.  XMin
	// can be changed to move groups of bars
	// down the X axis in order to make grouped
	// bar charts.
	XMin float64

	// Horizontal dictates whether the bars should be in the vertical
	// (default) or horizontal direction. If Horizontal is true, all
	// X locations and distances referred to here will actually be Y
	// locations and distances.
	Horizontal bool
	// contains filtered or unexported fields
}

A BarChart presents grouped data with rectangular bars with lengths proportional to the data values.

Modification of gonum.org/v1/plot/plotter.BarChart to allow for column width specification in data coordinates.

func NewBarChart

func NewBarChart(vs plotter.Valuer, width float64) (*BarChart, error)

NewBarChart returns a new bar chart with a single bar for each value. The bars heights correspond to the values and their x locations correspond to the index of their value in the Valuer.

func (*BarChart) BarHeight

func (b *BarChart) BarHeight(i int) float64

BarHeight returns the maximum y value of the ith bar, taking into account any bars upon which it is stacked.

func (*BarChart) DataRange

func (b *BarChart) DataRange() (xmin, xmax, ymin, ymax float64)

DataRange implements the plot.DataRanger interface.

func (*BarChart) GlyphBoxes

func (b *BarChart) GlyphBoxes(plt *plot.Plot) []plot.GlyphBox

GlyphBoxes implements the GlyphBoxer interface.

func (*BarChart) Plot

func (b *BarChart) Plot(c draw.Canvas, plt *plot.Plot)

Plot implements the plot.Plotter interface.

func (*BarChart) StackOn

func (b *BarChart) StackOn(on *BarChart)

StackOn stacks a bar chart on top of another, and sets the XMin and Offset to that of the chart upon which it is being stacked.

func (*BarChart) Thumbnail

func (b *BarChart) Thumbnail(c *draw.Canvas)

Thumbnail fulfills the plot.Thumbnailer interface.

type GridBoundaries

type GridBoundaries struct {
	plotter.GridXYZ
	draw.LineStyle
}

func NewGridBoundaries

func NewGridBoundaries(grid plotter.GridXYZ) (*GridBoundaries, error)

func (*GridBoundaries) DataRange

func (h *GridBoundaries) DataRange() (xMin, xMax, yMin, yMax float64)

DataRange implements the DataRange method of the plot.DataRanger interface.

func (*GridBoundaries) GlyphBoxes

func (h *GridBoundaries) GlyphBoxes(plt *plot.Plot) []plot.GlyphBox

GlyphBoxes implements the GlyphBoxes method of the plot.GlyphBoxer interface.

func (*GridBoundaries) Plot

func (h *GridBoundaries) Plot(c draw.Canvas, plt *plot.Plot)

type Legend

type Legend struct {
	TextStyle      text.Style
	Padding        vg.Length
	Top, Left      bool
	YPosition      float64
	XOffs, YOffs   vg.Length
	ThumbnailWidth vg.Length
	Columns        int
	// contains filtered or unexported fields
}

func NewLegend

func NewLegend() Legend

func (*Legend) Add

func (l *Legend) Add(name string, thumbs ...plot.Thumbnailer)

func (*Legend) AdjustColumns

func (l *Legend) AdjustColumns(maxWidth font.Length)

func (*Legend) Draw

func (l *Legend) Draw(c draw.Canvas)

func (*Legend) Rectangle

func (l *Legend) Rectangle(c draw.Canvas) vg.Rectangle

Jump to

Keyboard shortcuts

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