Skip to content

Commit 5fd2b80

Browse files
authored
Merge pull request #3513 from plotly/ternary-aaxis-title-mathjax-fix
Fix mathjax placement in ternary aaxis titles
2 parents e3af586 + c7878b3 commit 5fd2b80

File tree

3 files changed

+58
-1
lines changed

3 files changed

+58
-1
lines changed

src/lib/svg_text_utils.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ exports.convertToTspans = function(_context, gd, _callback) {
134134
else if(svgClass[0] === 'l') {
135135
newSvg.attr({x: _context.attr('x'), y: dy - (newSvgH / 2)});
136136
}
137-
else if(svgClass[0] === 'a') {
137+
else if(svgClass[0] === 'a' && svgClass.indexOf('atitle') !== 0) {
138138
newSvg.attr({x: 0, y: dy});
139139
}
140140
else {
39.2 KB
Loading

test/image/mocks/ternary-mathjax.json

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{
2+
"data": [
3+
{
4+
"type": "scatterternary",
5+
"mode": "markers",
6+
"a": [75],
7+
"b": [25],
8+
"c": [0],
9+
"text": ["point 1"],
10+
"marker": {
11+
"symbol": 100,
12+
"color": "#DB7365",
13+
"size": 14,
14+
"line": {
15+
"width": 2
16+
}
17+
}
18+
}
19+
],
20+
"layout": {
21+
"ternary": {
22+
"sum": 100,
23+
"aaxis": {
24+
"title": {
25+
"text": "$A^2$"
26+
},
27+
"showline": true,
28+
"showgrid": true
29+
},
30+
"baxis": {
31+
"title": {
32+
"text": "$B^2$"
33+
},
34+
"showline": true,
35+
"showgrid": true
36+
},
37+
"caxis": {
38+
"title": {
39+
"text": "$C^2$"
40+
},
41+
"showline": true,
42+
"showgrid": true
43+
}
44+
},
45+
"annotations": [
46+
{
47+
"showarrow": false,
48+
"text": "Simple Ternary Plot with Markers",
49+
"x": 0.5,
50+
"y": 1.3,
51+
"font": {
52+
"size": 15
53+
}
54+
}
55+
]
56+
}
57+
}

0 commit comments

Comments
 (0)