axesDetails determines the details about the X and Y axes.
(cvs *canvas.Canvas)
| 152 | |
| 153 | // axesDetails determines the details about the X and Y axes. |
| 154 | func (hp *HeatMap) axesDetails(cvs *canvas.Canvas) (*axes.XDetails, *axes.YDetails, error) { |
| 155 | yd, err := axes.NewYDetails(hp.yLabels) |
| 156 | if err != nil { |
| 157 | return nil, nil, err |
| 158 | } |
| 159 | xOriginY := len(hp.values) - 1 |
| 160 | if xOriginY < 0 { |
| 161 | xOriginY = 0 |
| 162 | } |
| 163 | xOriginX := yd.Width - 1 |
| 164 | if yd.Width == 0 { |
| 165 | xOriginX = -1 |
| 166 | } |
| 167 | xd, err := axes.NewXDetails(cvs.Area(), image.Point{X: xOriginX, Y: xOriginY}, hp.xLabels, hp.opts.cellWidth) |
| 168 | if err != nil { |
| 169 | return nil, nil, err |
| 170 | } |
| 171 | return xd, yd, nil |
| 172 | } |
| 173 | |
| 174 | // Draw draws cells, X labels and Y labels as HeatMap. |
| 175 | // Implements widgetapi.Widget.Draw. |
no test coverage detected