MCPcopy Create free account
hub / github.com/cogentcore/core / CopyValues

Function CopyValues

plot/data.go:98–114  ·  view source on GitHub ↗

CopyValues returns a Values that is a copy of the values from a Valuer, or an error if there are no values, or if one of the copied values is a Infinity. NaN values are skipped in the copying process.

(vs Valuer)

Source from the content-addressed store, hash-verified

96// the copied values is a Infinity.
97// NaN values are skipped in the copying process.
98func CopyValues(vs Valuer) (Values, error) {
99 if vs.Len() == 0 {
100 return nil, ErrNoData
101 }
102 cpy := make(Values, 0, vs.Len())
103 for i := 0; i < vs.Len(); i++ {
104 v := vs.Value(i)
105 if math32.IsNaN(v) {
106 continue
107 }
108 if err := CheckFloats(v); err != nil {
109 return nil, err
110 }
111 cpy = append(cpy, v)
112 }
113 return cpy, nil
114}
115
116//////////////////////////////////////////////////
117// XYer

Callers 1

NewBarChartFunction · 0.92

Calls 4

IsNaNFunction · 0.92
CheckFloatsFunction · 0.85
LenMethod · 0.65
ValueMethod · 0.65

Tested by

no test coverage detected