CopyXYs returns an XYs that is a copy of the x and y values from an XYer, or an error if one of the data points contains a NaN or Infinity.
(data XYer)
| 137 | // an XYer, or an error if one of the data points contains a NaN or |
| 138 | // Infinity. |
| 139 | func CopyXYs(data XYer) (XYs, error) { |
| 140 | cpy := make(XYs, data.Len()) |
| 141 | for i := range cpy { |
| 142 | cpy[i].X, cpy[i].Y = data.XY(i) |
| 143 | if err := CheckFloats(cpy[i].X, cpy[i].Y); err != nil { |
| 144 | return nil, err |
| 145 | } |
| 146 | } |
| 147 | return cpy, nil |
| 148 | } |
| 149 | |
| 150 | func (xys XYs) Len() int { |
| 151 | return len(xys) |
no test coverage detected