DataCanvas returns a new draw.Canvas that is the subset of the given draw area into which the plot data will be drawn.
(da draw.Canvas)
| 180 | // is the subset of the given draw area into which |
| 181 | // the plot data will be drawn. |
| 182 | func (p *Plot) DataCanvas(da draw.Canvas) draw.Canvas { |
| 183 | if p.Title.Text != "" { |
| 184 | rect := p.Title.TextStyle.Rectangle(p.Title.Text) |
| 185 | da.Max.Y -= rect.Size().Y |
| 186 | da.Max.Y -= p.Title.Padding |
| 187 | } |
| 188 | p.X.sanitizeRange() |
| 189 | x := horizontalAxis{p.X} |
| 190 | p.Y.sanitizeRange() |
| 191 | y := verticalAxis{p.Y} |
| 192 | return padY(p, padX(p, draw.Crop(da, y.size(), 0, x.size(), 0))) |
| 193 | } |
| 194 | |
| 195 | // DrawGlyphBoxes draws red outlines around the plot's |
| 196 | // GlyphBoxes. This is intended for debugging. |