Tooltips
Mojo struct 🡭
Tooltips
@memory_only
struct TooltipsWhether each datum gets an SVG <title>, which a browser shows as a hover tooltip. Set for every chart through Theme.tooltips, and for one chart through Plot.tooltips(), which takes precedence.
ON and OFF mean the same thing on every mark. AUTO, the
default, is ON for a plot that would draw at most
Theme.auto_tooltip_limit tooltips (AUTO_TOOLTIP_LIMIT, 1,000,
by default) and OFF above that, so a dense
scatter does not carry thousands of titles nobody can hover
individually. The count is per plot, so each layer of
render_layers() and each panel of a facet grid decides on its own.
Which marks draw tooltips is MarkType.supports_tooltips
(mark.mojo). ON on any other mark raises when the chart renders,
as Theme.show_data_labels does (#676); OFF and AUTO never
raise. The raster and PDF backends draw no tooltips whatever the
setting.
Aliases
AUTO = Tooltips(Int(0)): Tooltips on a plot that would draw at mostTheme.auto_tooltip_limitof them, none above that. The default.ON = Tooltips(Int(1)): A tooltip on every datum, however many there are.OFF = Tooltips(Int(2)): No tooltips.
Implemented traits
AnyType, Copyable, Deinitable, ImplicitlyCopyable, Movable
Methods
__init__
fn def __init__(out self, value: Int)Prefer the AUTO/ON/OFF comptime constants over constructing one directly.
Args:
- value (
Int): 0 for AUTO, 1 for ON, 2 for OFF. - self (
Self)
Returns:
Self
__eq__
fn def __eq__(self, other: Self) -> BoolArgs:
- self (
Self) - other (
Self)
Returns:
Bool
__ne__
fn def __ne__(self, other: Self) -> BoolArgs:
- self (
Self) - other (
Self)
Returns:
Bool
draws
fn def draws(self, count: Int, limit: Int) -> BoolWhether a plot that would draw count tooltips draws them.
Args:
- self (
Self) - count (
Int): How many tooltips this plot would draw. - limit (
Int):AUTO’s limit,Theme.auto_tooltip_limit.
Returns:
Bool: True for ON; False for OFF; for AUTO, whether count
is at most limit.