updateData regenerates the lines for the current data
()
| 665 | |
| 666 | // updateData regenerates the lines for the current data |
| 667 | func (lg *Graph) updateData() { |
| 668 | |
| 669 | lines := 1 |
| 670 | if lg.chart.scaleX != nil { |
| 671 | lines = lg.chart.scaleX.lines |
| 672 | } |
| 673 | step := 1.0 / (float32(lines) * lg.chart.countStepX) |
| 674 | |
| 675 | positions := math32.NewArrayF32(0, 0) |
| 676 | rangeY := lg.chart.maxY - lg.chart.minY |
| 677 | for i := 0; i < len(lg.data); i++ { |
| 678 | px := float32(i) * step |
| 679 | vy := lg.data[i] |
| 680 | py := -1 + ((vy - lg.chart.minY) / rangeY) |
| 681 | positions.Append(px, py, 0) |
| 682 | } |
| 683 | lg.vbo.SetBuffer(positions) |
| 684 | lg.SetChanged(true) |
| 685 | } |
| 686 | |
| 687 | // recalc recalculates the position and width of the this panel |
| 688 | func (lg *Graph) recalc() { |
no test coverage detected