MCPcopy Index your code
hub / github.com/gonum/plot / NewBarChart

Function NewBarChart

plotter/barchart.go:56–70  ·  view source on GitHub ↗

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.

(vs Valuer, width vg.Length)

Source from the content-addressed store, hash-verified

54// The bars heights correspond to the values and their x locations correspond
55// to the index of their value in the Valuer.
56func NewBarChart(vs Valuer, width vg.Length) (*BarChart, error) {
57 if width <= 0 {
58 return nil, errors.New("plotter: width parameter was not positive")
59 }
60 values, err := CopyValues(vs)
61 if err != nil {
62 return nil, err
63 }
64 return &BarChart{
65 Values: values,
66 Width: width,
67 Color: color.Black,
68 LineStyle: DefaultLineStyle,
69 }, nil
70}
71
72// BarHeight returns the maximum y value of the
73// ith bar, taking into account any bars upon

Callers 3

TestLegendAlignmentFunction · 0.92
ExampleBarChartFunction · 0.92

Calls 1

CopyValuesFunction · 0.85

Tested by 3

TestLegendAlignmentFunction · 0.74
ExampleBarChartFunction · 0.74