Skip to content

Commit 112576a

Browse files
committed
Merge branch 'dev' into fix-graph-customdata-for-pointnumbers
2 parents 7e15ce5 + f378199 commit 112576a

File tree

27 files changed

+930
-114
lines changed

27 files changed

+930
-114
lines changed

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
pip install -e .[ci,dev,testing,celery,diskcache] --progress-bar off
5555
pip list | grep dash
5656
npm i
57-
npm run build
57+
npm run build.sequential
5858
python setup.py sdist
5959
mkdir dash-package && cp dist/*.tar.gz dash-package/dash-package.tar.gz
6060
ls -la dash-package
@@ -120,7 +120,7 @@ jobs:
120120
set -eo pipefail
121121
pip install -e . --progress-bar off && pip list | grep dash
122122
npm install npm run initialize
123-
npm run build
123+
npm run build.sequential
124124
npm run lint
125125
- run:
126126
name: 🐍 Python Unit Tests & ☕ JS Unit Tests

CHANGELOG.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,30 @@
22
All notable changes to `dash` will be documented in this file.
33
This project adheres to [Semantic Versioning](https://semver.org/).
44

5+
## [Unreleased]
6+
7+
### Added
8+
- [#1949](https://github.com/plotly/dash/pull/1915) Add built-in MathJax support to both `dcc.Markdown` and `dcc.Graph`. A new boolean prop `mathjax` was added to these two components, defaulting to `False`. Set `mathjax=True` to enable math rendering. This work uses MathJax v3, although `dcc.Graph` and Plotly.js can also be used with MathJax v2.
9+
- In `dcc.Markdown` this has two flavors: inline math is any content between single dollar signs, for example `"$E=mc^2$"`, and "display" math (on its own line, potentially multi-line) is delimited by double dollar signs.
10+
- In `dcc.Graph`, most text fields (graph and axis titles, trace names, scatter and bar text) can use math, and it's enabled with single dollar sign delimiters. A limitation here is that currently a given piece of text can only be one or the other: if math is found, everything outside the delimiters is ignored. See https://plotly.com/python/LaTeX/ for details.
11+
- For an intro to LaTeX math, see https://en.wikibooks.org/wiki/LaTeX/Mathematics.
12+
- Big thanks to [Equinor](https://www.equinor.com/) for sponsoring this development, including the related work in Plotly.js!
13+
14+
### Updated
15+
- [#1949](https://github.com/plotly/dash/pull/1915) Upgrade Plotly.js to v2.11.0 (from v2.9.0)
16+
- [Feature release 2.10.0](https://github.com/plotly/plotly.js/releases/tag/v2.10.0):
17+
- Support for MathJax v3
18+
- `fillpattern` for `scatter` traces with filled area
19+
- [Feature release 2.11.0](https://github.com/plotly/plotly.js/releases/tag/v2.11.0):
20+
- Every trace type can now be rendered in a stricter CSP environment, specifically avoiding `unsafe-eval`. Please note: the `regl`-based traces (`scattergl`, `scatterpolargl`, `parcoords`, and `splom`) are only strict in the `strict` bundle, which is NOT served by default in Dash. To use this bundle with Dash, you must either download it and put it in your `assets/` folder, or include it as an `external_script` from the CDN: https://cdn.plot.ly/plotly-strict-2.11.0.min.js. All other trace types are strict in the normal bundle.
21+
- Patch release [2.10.1](https://github.com/plotly/plotly.js/releases/tag/v2.5.1) containing a bugfix for `mesh3d` traces.
22+
23+
24+
### Fixed
25+
- [#1915](https://github.com/plotly/dash/pull/1915) Fix bug [#1474](https://github.com/plotly/dash/issues/1474) when both dcc.Graph and go.Figure have animation, and when the second animation in Figure is executed, the Frames from the first animation are played instead of the second one.
26+
27+
- [#1953](https://github.com/plotly/dash/pull/1953) Fix bug [#1783](https://github.com/plotly/dash/issues/1783) in which a failed hot reloader blocks the UI with alerts.
28+
529
## [2.2.0] - 2022-02-18
630

731
### Added

components/dash-core-components/.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ lib/
44
lib/bundle.js*
55
coverage/
66
node_modules/
7+
packages/
78
.npm
89
vv/
910
venv/

components/dash-core-components/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ venv/
1919
/build
2020
/dash_core_components
2121
dash_core_components_base/plotly.min.js
22+
dash_core_components_base/mathjax.js
2223
/deps
2324
/inst
2425
/man

components/dash-core-components/CONTRIBUTING.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ you've pulled from upstream otherwise you may be running with an out of date
3131
`bundle.js`. See the instructions for building `bundle.js` in the [Testing
3232
Locally](README.md#testing-locally) section of README.md.
3333

34-
## Updating Plotly.js
34+
## Updating official version of Plotly.js
3535

36-
1. Update the version of `plotly.js` in package.json. Always use an exact version without "^" or "~"
36+
1. Update the version of `plotly.js-dist-min` in package.json. Always use an exact version without "^" or "~"
3737
2. Run `npm install` followed by `npm run build`, the Plotly.js artifact will be copied and bundled over as required
3838
4. Update `CHANGELOG.md` with links to the releases and a description of the changes. The message should state (see the existing `CHANGELOG.md` for examples):
3939
* If you're only bumping the patch level, the heading is "Fixed" and the text starts "Patched plotly.js". Otherwise the heading is "Updated" and the text starts "Upgraded plotly.js"
@@ -42,6 +42,11 @@ Locally](README.md#testing-locally) section of README.md.
4242
* All patch versions included, with links to their release pages and a note that these fix bugs
4343
5. When bumping the dcc version, a plotly.js patch/minor/major constitutes a dcc patch/minor/major respectively as well.
4444

45+
### Using a temporary `plotly.js-dist-min` package (or other dependencies)
46+
47+
> During integrated development of new features or bug fixes in plotly.js and dash, it may be required to install a temporary plotly.js-dist-min package (or other packages) including proposed changes. To do so, please place the `.tgz` file in `packages/` folder then `npm install` the file.
48+
49+
4550
## Financial Contributions
4651

4752
If your company wishes to sponsor development of open source dash components, please [get in touch][].

components/dash-core-components/dash_core_components_base/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
"graph",
4949
"highlight",
5050
"markdown",
51+
"mathjax",
5152
"slider",
5253
"upload",
5354
]

components/dash-core-components/package-lock.json

Lines changed: 33 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components/dash-core-components/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"test": "run-s -c lint test:intg test:pyimport",
2424
"test:intg": "pytest --nopercyfinalize --headless tests/integration",
2525
"test:pyimport": "python -m unittest tests/test_dash_import.py",
26-
"prebuild:js": "cp node_modules/plotly.js-dist-min/plotly.min.js dash_core_components_base/plotly.min.js",
26+
"prebuild:js": "cp node_modules/plotly.js-dist-min/plotly.min.js dash_core_components_base/plotly.min.js && cp node_modules/mathjax/es5/tex-svg.js dash_core_components_base/mathjax.js",
2727
"build:js": "webpack --mode production",
2828
"build:backends": "dash-generate-components ./src/components dash_core_components -p package-info.json && cp dash_core_components_base/** dash_core_components/ && dash-generate-components ./src/components dash_core_components -p package-info.json -k RangeSlider,Slider,Dropdown,RadioItems,Checklist,DatePickerSingle,DatePickerRange,Input,Link --r-prefix 'dcc' --r-suggests 'dash,dashHtmlComponents,jsonlite,plotly' --jl-prefix 'dcc' && black dash_core_components",
2929
"build": "run-s prepublishOnly build:js build:backends",
@@ -46,9 +46,10 @@
4646
"fast-isnumeric": "^1.1.4",
4747
"file-saver": "^2.0.5",
4848
"highlight.js": "^11.4.0",
49+
"mathjax": "^3.2.0",
4950
"moment": "^2.29.1",
5051
"node-polyfill-webpack-plugin": "^1.1.4",
51-
"plotly.js-dist-min": "2.9.0",
52+
"plotly.js-dist-min": "2.11.0",
5253
"prop-types": "^15.7.2",
5354
"ramda": "^0.27.1",
5455
"rc-slider": "^9.7.5",
@@ -60,6 +61,7 @@
6061
"react-resize-detector": "^6.7.6",
6162
"react-select-fast-filter-options": "^0.2.3",
6263
"react-virtualized-select": "^3.1.3",
64+
"remark-math": "^3.0.1",
6365
"uniqid": "^5.4.0"
6466
},
6567
"devDependencies": {
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Folder to place temporary modules e.g. plotly.js-dist-min in .tgz format

components/dash-core-components/src/components/Graph.react.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import PropTypes from 'prop-types';
44
import {asyncDecorator} from '@plotly/dash-component-plugins';
55
import graph from '../utils/LazyLoader/graph';
66
import plotly from '../utils/LazyLoader/plotly';
7+
import lazyLoadMathJax from '../utils/LazyLoader/mathjax';
78
import {
89
privatePropTypes,
910
privateDefaultProps,
@@ -21,6 +22,10 @@ class PlotlyGraph extends Component {
2122
constructor(props) {
2223
super(props);
2324

25+
if (props.mathjax) {
26+
PlotlyGraph._loadMathjax = true;
27+
}
28+
2429
this.state = {
2530
prependData: [],
2631
extendData: [],
@@ -120,7 +125,11 @@ class PlotlyGraph extends Component {
120125
}
121126

122127
const RealPlotlyGraph = asyncDecorator(PlotlyGraph, () =>
123-
Promise.all([plotly(), graph()]).then(([, graph]) => graph)
128+
Promise.all([
129+
graph(),
130+
plotly(),
131+
PlotlyGraph._loadMathjax ? lazyLoadMathJax() : undefined,
132+
]).then(([graph]) => graph)
124133
);
125134

126135
const ControlledPlotlyGraph = memo(props => {
@@ -266,6 +275,11 @@ PlotlyGraph.propTypes = {
266275
*/
267276
className: PropTypes.string,
268277

278+
/**
279+
* If true, loads mathjax v3 (tex-svg) into the page and use it in the graph
280+
*/
281+
mathjax: PropTypes.bool,
282+
269283
/**
270284
* Beta: If true, animate between updates using
271285
* plotly.js's `animate` function
@@ -574,6 +588,7 @@ PlotlyGraph.defaultProps = {
574588
frames: [],
575589
},
576590
responsive: 'auto',
591+
mathjax: false,
577592
animate: false,
578593
animation_options: {
579594
frame: {

0 commit comments

Comments
 (0)