Draw draws cells, X labels and Y labels as HeatMap. Implements widgetapi.Widget.Draw.
(cvs *canvas.Canvas, meta *widgetapi.Meta)
| 174 | // Draw draws cells, X labels and Y labels as HeatMap. |
| 175 | // Implements widgetapi.Widget.Draw. |
| 176 | func (hp *HeatMap) Draw(cvs *canvas.Canvas, meta *widgetapi.Meta) error { |
| 177 | _ = meta |
| 178 | |
| 179 | hp.mu.Lock() |
| 180 | defer hp.mu.Unlock() |
| 181 | |
| 182 | hp.lastWidth = cvs.Area().Dx() |
| 183 | hp.lastCapacity = hp.visibleCapacity(cvs.Area().Size()) |
| 184 | |
| 185 | if len(hp.values) == 0 { |
| 186 | return nil |
| 187 | } |
| 188 | if need := hp.minSize(); need.X > cvs.Area().Dx() || need.Y > cvs.Area().Dy() { |
| 189 | return draw.ResizeNeeded(cvs) |
| 190 | } |
| 191 | |
| 192 | xd, yd, err := hp.axesDetails(cvs) |
| 193 | if err != nil { |
| 194 | return err |
| 195 | } |
| 196 | if err := hp.drawCells(cvs, xd, yd); err != nil { |
| 197 | return err |
| 198 | } |
| 199 | return hp.drawLabels(cvs, xd, yd) |
| 200 | } |
| 201 | |
| 202 | // drawCells draws m*n cells (rectangles) representing the stored values. |
| 203 | // The height of each cell is 1 and the default width is 3. |
nothing calls this directly
no test coverage detected