MCPcopy
hub / github.com/mum4k/termdash / axesDetails

Method axesDetails

widgets/heatmap/heatmap.go:154–172  ·  view source on GitHub ↗

axesDetails determines the details about the X and Y axes.

(cvs *canvas.Canvas)

Source from the content-addressed store, hash-verified

152
153// axesDetails determines the details about the X and Y axes.
154func (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.

Callers 1

DrawMethod · 0.95

Calls 3

NewYDetailsFunction · 0.92
NewXDetailsFunction · 0.92
AreaMethod · 0.45

Tested by

no test coverage detected