(pos image.Point)
| 113 | } |
| 114 | |
| 115 | func (pt *Plot) WidgetTooltip(pos image.Point) (string, image.Point) { |
| 116 | if pos == image.Pt(-1, -1) { |
| 117 | return "_", image.Point{} |
| 118 | } |
| 119 | if pt.Plot == nil { |
| 120 | return pt.Tooltip, pt.DefaultTooltipPos() |
| 121 | } |
| 122 | wpos := pos.Sub(pt.Geom.ContentBBox.Min) |
| 123 | _, idx, dist, data, _, legend := pt.Plot.ClosestDataToPixel(wpos.X, wpos.Y) |
| 124 | if dist <= 10 { |
| 125 | return fmt.Sprintf("%s[%d]: (%g, %g)", legend, idx, data.X, data.Y), pos |
| 126 | } |
| 127 | return pt.Tooltip, pt.DefaultTooltipPos() |
| 128 | } |
| 129 | |
| 130 | func (pt *Plot) SizeFinal() { |
| 131 | pt.WidgetBase.SizeFinal() |
nothing calls this directly
no test coverage detected