Commit 29200a1
Render hover labels through MathJax when the whole label is one tex expression
Fixes #559. Hover labels unconditionally set data-notex, which blocks
convertToTspans from ever handing them to MathJax, so a hover string
like "$\alpha$" rendered as literal source instead of the typeset
symbol. Axis titles and annotations already support this; hover never
did because convertToTspans drops any text outside the $...$
delimiters, and most hover strings mix formatted values with literal
text, so blanket-enabling it would silently lose content.
This only lifts the restriction when the whole label is one tex
expression (isPureTex), which convertToTspans can render without
dropping anything, and applies it to every hover label surface: the
main per-point label, the secondary trace-name label, the shared axis
label, and the "unified hover" legend-based label.
Enabling this exposes a second, previously moot problem: MathJax
typesets asynchronously, so the label's box is sized from a
degenerate placeholder measurement before the real content exists.
hover.js now runs its existing (idempotent) sizing and overlap-
avoidance pass a second time once typesetting finishes, and
svg_text_utils gains repositionMathGroup to move the already-rendered
math group to match, since convertToTspans only positions it once, at
typeset time.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>1 parent f618df5 commit 29200a1
5 files changed
Lines changed: 582 additions & 236 deletions
File tree
- draftlogs
- src
- components
- fx
- legend
- lib
- test/jasmine/bundle_tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
0 commit comments