go-perf: github.com/aclements/go-perf/scale Index | Files

package scale

import "github.com/aclements/go-perf/scale"

Index

Package Files

interface.go linear.go log.go output.go power.go util.go

type Interface Uses

type Interface interface {
    Of(x float64) float64
    Ticks(n int) (major, minor []float64)
}

A scale satisfies Interface if it maps from some input range to an output interval [0, 1].

type Linear Uses

type Linear struct {
    // contains filtered or unexported fields
}

func NewLinear Uses

func NewLinear(input []float64) Linear

NewLinear returns a new linear scale.

func (Linear) Of Uses

func (s Linear) Of(x float64) float64

func (Linear) Ticks Uses

func (s Linear) Ticks(n int) (major, minor []float64)

type Log Uses

type Log struct {
    // contains filtered or unexported fields
}

func NewLog Uses

func NewLog(input []float64, base float64) *Log

NewLog returns a new logarithmic scale.

base has no effect on the scaling. It is only used for computing tick marks.

func (*Log) Nice Uses

func (s *Log) Nice(n int)

Nice expands the domain of s to "nice" values of the scale, which will translate into major tick marks.

n is the maximum number of major ticks. n must be >= 2.

func (*Log) Of Uses

func (s *Log) Of(x float64) float64

func (*Log) Ticks Uses

func (s *Log) Ticks(n int) (major, minor []float64)

type OutputScale Uses

type OutputScale struct {
    // contains filtered or unexported fields
}

func NewOutputScale Uses

func NewOutputScale(min, max float64) OutputScale

func (*OutputScale) Clamp Uses

func (s *OutputScale) Clamp()

func (*OutputScale) Crop Uses

func (s *OutputScale) Crop()

func (OutputScale) Of Uses

func (s OutputScale) Of(x float64) (float64, bool)

func (*OutputScale) Unclamp Uses

func (s *OutputScale) Unclamp()

type Power Uses

type Power struct {
    // contains filtered or unexported fields
}

func NewPower Uses

func NewPower(input []float64, exp float64) Power

NewPower returns a new power scale.

func (Power) Of Uses

func (s Power) Of(x float64) float64

func (Power) Ticks Uses

func (s Power) Ticks(n int) (major, minor []float64)

Package scale imports 1 packages (graph) and is imported by 1 packages. Updated 2016-07-22. Refresh now. Tools for package owners.