Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Aug 29, 2025. It is now read-only.

Added MathJax CDN to enable Latex #194

Open
kaushiksk wants to merge 9 commits into plotly:dev
base: dev
Choose a base branch
Loading
from kaushiksk:master
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [0.22.2] - 2018年04月30日
### Fixed
- Previously, dash did not render LateX since the MathJax.js library was not loaded. This has now been fixed.
See https://github.com/plotly/dash-core-components/pull/194.

## [0.22.1] - 2018年04月09日
### Fixed
- Various bugs with the `ohlc` and `candlestick` chart type in the `dcc.Graph`
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ include dash_core_components/plotly-1.35.2.min.js
include dash_core_components/react-virtualized-select@3.1.0.css
include dash_core_components/react-virtualized@9.9.0.css
include dash_core_components/react-dates@12.3.0.css
include dash_core_components/mathjax-2.7.4.js
include README.md
include LICENSE.txt
5 changes: 5 additions & 0 deletions dash_core_components/__init__.py
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
_this_module = _sys.modules[__name__]

_js_dist = [
{
'external_url': 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.4/MathJax.js?config=TeX-MML-AM_CHTML',
'relative_package_path': 'mathjax-2.7.4.js',
Copy link
Member

@chriddyp chriddyp Apr 30, 2018
edited
Loading

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-97c91a104c431d0c365565d3ac03ac13R12

We should also rename the file dash_core_components/mathjax-2.7.4.js to dash_core_components/mathjax-2.7.4.min.js

Copy link
Member

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 than mathjax-2.7.4.min.js. I don't really have a preference, but they do need to all have the same name 😄

Copy link
Author

@kaushiksk kaushiksk May 1, 2018

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

'namespace': 'dash_core_components'
},
{
'external_url': 'https://cdn.plot.ly/plotly-1.35.2.min.js',
'relative_package_path': 'plotly-1.35.2.min.js',
Expand Down
19 changes: 19 additions & 0 deletions dash_core_components/mathjax-2.7.4.js
View file Open in desktop

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dash-core-components",
"version": "0.22.1",
"version": "0.22.2",
"description": "Core component suite for Dash",
"repository": {
"type": "git",
Expand Down
24 changes: 24 additions & 0 deletions test/test_integration.py
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -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': '$sqrt{(n_\\text{c}(t|{T_\\text{early}}))}$'
}
}
),
])
self.startServer(app=app)

graph = self.wait_for_element_by_css_selector('#graph .svg-container')
time.sleep(4)
self.snapshot('latex rendering in graph')

AltStyle によって変換されたページ (->オリジナル) /