Skip to content

Commit 801fb47

Browse files
committed
fix and test annotations with mathjax
1 parent 52271e9 commit 801fb47

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

src/components/annotations/draw.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ function drawRaw(gd, options, index, subplotId, xa, ya) {
237237
// at the end, even if their position changes
238238
annText.selectAll('tspan.line').attr({y: 0, x: 0});
239239

240-
var mathjaxGroup = annTextGroupInner.select('.annotation-math-group');
240+
var mathjaxGroup = annTextGroupInner.select('.annotation-text-math-group');
241241
var hasMathjax = !mathjaxGroup.empty();
242242
var anntextBB = Drawing.bBox(
243243
(hasMathjax ? mathjaxGroup : annText).node());

test/image/baselines/annotations.png

3.41 KB
Loading

test/image/mocks/annotations.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
{"text":"no arrow<br>page auto BC","showarrow":false,"xref":"paper","yref":"paper","x":0.5,"y":0.25},
2727
{"text":"default"},
2828
{"text":"no arrow","x":5,"y":4,"showarrow":false},
29-
{"text":"border","showarrow":false,"bordercolor":"rgb(148, 103, 189)","x":4,"y":3},
29+
{"text":"$x+y+z+q$","showarrow":false,"bordercolor":"rgb(148, 103, 189)","x":4,"y":3},
3030
{"text":"border width","showarrow":false,"bordercolor":"rgb(0, 0, 255)","borderwidth":3,"x":5,"y":3},
3131
{"text":"background","showarrow":false,"bgcolor":"rgb(255, 127, 14)","x":4,"y":2},
3232
{"text":"padding","showarrow":false,"bordercolor":"rgb(0, 0, 0)","borderpad":3,"x":5,"y":2},
@@ -54,6 +54,10 @@
5454
"text": "angle, arrow TR<br>box+standoff", "x": 2, "y": 2, "ax": -20, "ay": -20,
5555
"xanchor": "right", "yanchor": "top", "standoff": 5, "textangle": 45, "bordercolor": "#444"
5656
},
57+
{
58+
"text": "$\\sqrt{42 \\pm \\Omega^2}$", "bordercolor": "#0c0", "x": 1, "y": 2,
59+
"ax": 0, "ay": -20, "yanchor": "bottom", "textangle": -30
60+
},
5761
{"text": "off-plot, do not show!", "x": 5.1, "y": 3.5, "showarrow": false},
5862
{"text": "off-plot 2", "x": 3, "y": 5.1, "showarrow": true, "ax": 0, "ay": 100}
5963
]

0 commit comments

Comments
 (0)