-
-
Notifications
You must be signed in to change notification settings - Fork 145
Added MathJax CDN to enable Latex #194
base: dev
Are you sure you want to change the base?
Changes from 5 commits
b353d86
0f1f0a5
bae5768
a97912a
a99b7fe
cfd7d44
c6c6ba2
2590b0c
958f825
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -496,3 +496,27 @@ def update_graph(n_clicks): | |
button.click() | ||
time.sleep(2) | ||
self.snapshot('candlestick - 2 click') | ||
|
||
def test_latex(self): | ||
app = dash.Dash(__name__) | ||
app.layout = html.Div([ | ||
|
||
html.Label('Graph'), | ||
dcc.Graph( | ||
id='graph', | ||
figure={ | ||
'data': [{ | ||
'x': [1, 2, 3, 4, 5], | ||
'y': [1, 3, 5, 9, 13] | ||
}], | ||
'layout': { | ||
'title': 'Graph of \(y = \frac{x^2 - 2}{4}\)' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah I see, this isn't actually valid in plotly.js. Text needs to be all latex or none latex. Let's use this example from the docs: https://plot.ly/python/LaTeX/
|
||
} | ||
} | ||
), | ||
]) | ||
self.startServer(app=app) | ||
|
||
graph = self.wait_for_element_by_css_selector('#graph') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here's an idea - let's "wait for" the actual graph to be rendered rather than just the container. Let's update this CSS selector to be: |
||
time.sleep(2) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In case this was a timing issue, let's try bumping this up to 4 |
||
self.snapshot('latex rendering in graph') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this should be
mathjax-2.7.4.min.js
- it should match https://github.com/plotly/dash-core-components/pull/194/files#diff-97c91a104c431d0c365565d3ac03ac13R12We should also rename the file
dash_core_components/mathjax-2.7.4.js
todash_core_components/mathjax-2.7.4.min.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or vice-versa, everything could be labeled
mathjax-2.7.4.js
rather thanmathjax-2.7.4.min.js
. I don't really have a preference, but they do need to all have the same name 😄There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uh my bad. I'll change it in MANIFEST.in