plotly.js 2.8.2 → 2.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/.circleci/config.yml +39 -1
  2. package/.circleci/env_image.sh +1 -1
  3. package/.circleci/test.sh +14 -1
  4. package/CHANGELOG.md +30 -1
  5. package/CONTRIBUTING.md +1 -1
  6. package/README.md +12 -4
  7. package/dist/README.md +26 -26
  8. package/dist/plot-schema.json +413 -0
  9. package/dist/plotly-basic.js +253 -96
  10. package/dist/plotly-basic.min.js +5 -5
  11. package/dist/plotly-cartesian.js +263 -97
  12. package/dist/plotly-cartesian.min.js +5 -5
  13. package/dist/plotly-finance.js +254 -96
  14. package/dist/plotly-finance.min.js +4 -4
  15. package/dist/plotly-geo-assets.js +3 -3
  16. package/dist/plotly-geo.js +248 -92
  17. package/dist/plotly-geo.min.js +4 -4
  18. package/dist/plotly-gl2d.js +248 -92
  19. package/dist/plotly-gl2d.min.js +7 -7
  20. package/dist/plotly-gl3d.js +249 -92
  21. package/dist/plotly-gl3d.min.js +3 -3
  22. package/dist/plotly-locale-cs.js +1 -1
  23. package/dist/plotly-locale-cy.js +1 -1
  24. package/dist/plotly-locale-de.js +1 -1
  25. package/dist/plotly-locale-es.js +1 -1
  26. package/dist/plotly-locale-fi.js +1 -1
  27. package/dist/plotly-locale-fr.js +1 -1
  28. package/dist/plotly-locale-it.js +1 -1
  29. package/dist/plotly-locale-ja.js +1 -1
  30. package/dist/plotly-locale-ko.js +1 -1
  31. package/dist/plotly-locale-pt-br.js +1 -1
  32. package/dist/plotly-locale-pt-pt.js +1 -1
  33. package/dist/plotly-locale-ru.js +1 -1
  34. package/dist/plotly-locale-sv.js +1 -1
  35. package/dist/plotly-locale-sw.js +1 -1
  36. package/dist/plotly-locale-uk.js +1 -1
  37. package/dist/plotly-locale-zh-cn.js +1 -1
  38. package/dist/plotly-mapbox.js +248 -92
  39. package/dist/plotly-mapbox.min.js +3 -3
  40. package/dist/plotly-strict.js +267 -97
  41. package/dist/plotly-strict.min.js +7 -7
  42. package/dist/plotly-with-meta.js +280 -97
  43. package/dist/plotly.js +268 -97
  44. package/dist/plotly.min.js +11 -11
  45. package/dist/translation-keys.txt +1 -1
  46. package/lib/locales/cs.js +1 -1
  47. package/lib/locales/cy.js +1 -1
  48. package/lib/locales/de.js +1 -1
  49. package/lib/locales/es.js +1 -1
  50. package/lib/locales/fi.js +1 -1
  51. package/lib/locales/fr.js +1 -1
  52. package/lib/locales/it.js +1 -1
  53. package/lib/locales/ja.js +1 -1
  54. package/lib/locales/ko.js +1 -1
  55. package/lib/locales/pt-br.js +1 -1
  56. package/lib/locales/pt-pt.js +1 -1
  57. package/lib/locales/ru.js +1 -1
  58. package/lib/locales/sv.js +1 -1
  59. package/lib/locales/sw.js +1 -1
  60. package/lib/locales/uk.js +1 -1
  61. package/lib/locales/zh-cn.js +1 -1
  62. package/package.json +15 -12
  63. package/src/components/colorbar/attributes.js +1 -0
  64. package/src/components/colorbar/draw.js +1 -0
  65. package/src/components/drawing/index.js +28 -24
  66. package/src/components/legend/draw.js +2 -1
  67. package/src/components/legend/style.js +10 -6
  68. package/src/components/modebar/modebar.js +7 -1
  69. package/src/lib/svg_text_utils.js +106 -21
  70. package/src/plot_api/plot_config.js +9 -0
  71. package/src/plots/cartesian/axes.js +47 -5
  72. package/src/plots/cartesian/layout_attributes.js +14 -0
  73. package/src/plots/cartesian/tick_label_defaults.js +8 -0
  74. package/src/plots/gl3d/layout/axis_defaults.js +1 -0
  75. package/src/plots/polar/layout_attributes.js +1 -0
  76. package/src/plots/smith/layout_defaults.js +1 -0
  77. package/src/plots/ternary/layout_attributes.js +1 -0
  78. package/src/snapshot/tosvg.js +14 -25
  79. package/src/traces/bar/plot.js +5 -4
  80. package/src/traces/carpet/ab_defaults.js +1 -0
  81. package/src/traces/indicator/attributes.js +1 -0
  82. package/src/traces/scatter/attributes.js +2 -0
  83. package/src/traces/scatter/defaults.js +2 -0
  84. package/src/traces/scatter/plot.js +4 -4
  85. package/src/traces/scatter/style.js +1 -1
  86. package/src/version.js +1 -1
  87. package/tasks/noci_test.sh +1 -1
  88. package/.vscode/launch.json +0 -0
@@ -24,7 +24,7 @@ IE only supports svg. Changing format to svg. // components/modebar/but
24
24
  Lasso Select // components/modebar/buttons.js:126
25
25
  Orbital rotation // components/modebar/buttons.js:342
26
26
  Pan // components/modebar/buttons.js:106
27
- Produced with Plotly // components/modebar/modebar.js:295
27
+ Produced with Plotly.js // components/modebar/modebar.js:301
28
28
  Reset // components/modebar/buttons.js:515
29
29
  Reset axes // components/modebar/buttons.js:218
30
30
  Reset camera to default // components/modebar/buttons.js:381
package/lib/locales/cs.js CHANGED
@@ -24,7 +24,7 @@ module.exports = {
24
24
  'Lasso Select': 'Vyběr lasem', // components/modebar/buttons.js:112
25
25
  'Orbital rotation': 'Rotace (orbitální)', // components/modebar/buttons.js:279
26
26
  'Pan': 'Posunovat', // components/modebar/buttons.js:94
27
- 'Produced with Plotly': 'Vytvořeno pomocí Plotly', // components/modebar/modebar.js:256
27
+ 'Produced with Plotly.js': 'Vytvořeno pomocí Plotly.js', // components/modebar/modebar.js:256
28
28
  'Reset': 'Obnovit nastavení', // components/modebar/buttons.js:432
29
29
  'Reset axes': 'Obnovit nastavení os', // components/modebar/buttons.js:148
30
30
  'Reset camera to default': 'Obnovit nastavení kamery na výchozí stav', // components/modebar/buttons.js:314
package/lib/locales/cy.js CHANGED
@@ -24,7 +24,7 @@ module.exports = {
24
24
  'Lasso Select': 'Dewiswch â lasŵ', // components / modebar / buttons.js: 123
25
25
  'Orbital rotation': 'Cylchdroi orbital', // components / modebar / buttons.js: 287
26
26
  'Pan': 'Pan', // components / modebar / buttons.js: 105
27
- 'Produced with Plotly': 'Cynhyrchwyd gyda Plotly', // components / modebar / modebar.js: 272
27
+ 'Produced with Plotly.js': 'Cynhyrchwyd gyda Plotly.js', // components / modebar / modebar.js: 272
28
28
  'Reset': 'Ailosod', // components / modebar / buttons.js: 443
29
29
  'Reset axes': 'Ailosod echelinau', // components / modebar / buttons.js: 159
30
30
  'Reset camera to default': 'Ailosod camera i\'r rhagosodiad', // components / modebar / buttons.js: 325
package/lib/locales/de.js CHANGED
@@ -23,7 +23,7 @@ module.exports = {
23
23
  'Lasso Select': 'Lassoauswahl', // components/modebar/buttons.js:112
24
24
  'Orbital rotation': 'Orbitalrotation', // components/modebar/buttons.js:279
25
25
  'Pan': 'Verschieben', // components/modebar/buttons.js:94
26
- 'Produced with Plotly': 'Erstellt mit Plotly', // components/modebar/modebar.js:256
26
+ 'Produced with Plotly.js': 'Erstellt mit Plotly.js', // components/modebar/modebar.js:256
27
27
  'Reset': 'Zurücksetzen', // components/modebar/buttons.js:432
28
28
  'Reset axes': 'Achsen zurücksetzen', // components/modebar/buttons.js:148
29
29
  'Reset camera to default': 'Kamera auf Standard zurücksetzen', // components/modebar/buttons.js:314
package/lib/locales/es.js CHANGED
@@ -24,7 +24,7 @@ module.exports = {
24
24
  'Lasso Select': 'Seleccionar con lazo', // components/modebar/buttons.js:112
25
25
  'Orbital rotation': 'Rotación esférica', // components/modebar/buttons.js:279
26
26
  'Pan': 'Modo Panorámica', // components/modebar/buttons.js:94
27
- 'Produced with Plotly': 'Hecho con Plotly', // components/modebar/modebar.js:256
27
+ 'Produced with Plotly.js': 'Hecho con Plotly.js', // components/modebar/modebar.js:256
28
28
  'Reset': 'Reiniciar', // components/modebar/buttons.js:431
29
29
  'Reset axes': 'Reiniciar ejes', // components/modebar/buttons.js:148
30
30
  'Reset camera to default': 'Restaurar cámara predeterminada', // components/modebar/buttons.js:313
package/lib/locales/fi.js CHANGED
@@ -24,7 +24,7 @@ module.exports = {
24
24
  'Lasso Select': 'Lassovalinta',
25
25
  'Orbital rotation': 'Orbitaalikierto',
26
26
  'Pan': 'Panorointi',
27
- 'Produced with Plotly': 'Tuotettu Plotlyllä',
27
+ 'Produced with Plotly.js': 'Tuotettu Plotly.jsllä',
28
28
  'Reset': 'Palauta oletusasetukset',
29
29
  'Reset axes': 'Palauta akselien oletusasetukset',
30
30
  'Reset camera to default': 'Palauta kameran oletusasetukset',
package/lib/locales/fr.js CHANGED
@@ -24,7 +24,7 @@ module.exports = {
24
24
  'Lasso Select': 'Sélection lasso',
25
25
  'Orbital rotation': 'Rotation orbitale',
26
26
  'Pan': 'Translation',
27
- 'Produced with Plotly': 'Généré avec Plotly',
27
+ 'Produced with Plotly.js': 'Généré avec Plotly.js',
28
28
  'Reset': 'Réinitialiser',
29
29
  'Reset axes': 'Réinitialiser les axes',
30
30
  'Reset camera to default': 'Régler la caméra à sa valeur défaut',
package/lib/locales/it.js CHANGED
@@ -24,7 +24,7 @@ module.exports = {
24
24
  'Lasso Select': 'Selezione lazo', // components/modebar/buttons.js:112
25
25
  'Orbital rotation': 'Rotazione orbitale', // components/modebar/buttons.js:279
26
26
  'Pan': 'Sposta', // components/modebar/buttons.js:94
27
- 'Produced with Plotly': 'Creato con Plotly', // components/modebar/modebar.js:256
27
+ 'Produced with Plotly.js': 'Creato con Plotly.js', // components/modebar/modebar.js:256
28
28
  'Reset': 'Reset', // components/modebar/buttons.js:432
29
29
  'Reset axes': 'Resetta gli assi', // components/modebar/buttons.js:148
30
30
  'Reset camera to default': 'Reimposta la camera ai valori predefiniti', // components/modebar/buttons.js:314
package/lib/locales/ja.js CHANGED
@@ -23,7 +23,7 @@ module.exports = {
23
23
  'Lasso Select': '投げ縄選択', // components/modebar/buttons.js:112
24
24
  'Orbital rotation': '軌道回転', // components/modebar/buttons.js:279
25
25
  'Pan': '拡大', // components/modebar/buttons.js:94
26
- 'Produced with Plotly': 'Plotlyにより作成', // components/modebar/modebar.js:256
26
+ 'Produced with Plotly.js': 'Plotly.jsにより作成', // components/modebar/modebar.js:256
27
27
  'Reset': 'リセット', // components/modebar/buttons.js:432
28
28
  'Reset axes': '軸をリセット', // components/modebar/buttons.js:148
29
29
  'Reset camera to default': 'カメラをデフォルトに戻す', // components/modebar/buttons.js:314
package/lib/locales/ko.js CHANGED
@@ -24,7 +24,7 @@ module.exports = {
24
24
  'Lasso Select': '올가미 선택',
25
25
  'Orbital rotation': '궤도 수정',
26
26
  'Pan': '이동',
27
- 'Produced with Plotly': 'Plotly 제공',
27
+ 'Produced with Plotly.js': 'Plotly.js 제공',
28
28
  'Reset': '초기화',
29
29
  'Reset axes': '축 초기화',
30
30
  'Reset camera to default': 'camera를 기본값으로 초기화',
@@ -24,7 +24,7 @@ module.exports = {
24
24
  'Lasso Select': 'Seleção de laço',
25
25
  'Orbital rotation': 'Rotação orbital',
26
26
  'Pan': 'Mover',
27
- 'Produced with Plotly': 'Criado com o Plotly',
27
+ 'Produced with Plotly.js': 'Criado com o Plotly.js',
28
28
  'Reset': 'Restaurar',
29
29
  'Reset axes': 'Restaurar eixos',
30
30
  'Reset camera to default': 'Restaurar câmera para padrão',
@@ -24,7 +24,7 @@ module.exports = {
24
24
  'Lasso Select': 'Seleção de laço',
25
25
  'Orbital rotation': 'Rotação orbital',
26
26
  'Pan': 'Mover',
27
- 'Produced with Plotly': 'Criado com Plotly',
27
+ 'Produced with Plotly.js': 'Criado com Plotly.js',
28
28
  'Reset': 'Restaurar',
29
29
  'Reset axes': 'Restaurar eixos',
30
30
  'Reset camera to default': 'Restaurar câmera para padrão',
package/lib/locales/ru.js CHANGED
@@ -24,7 +24,7 @@ module.exports = {
24
24
  'Lasso Select': 'Лассо',
25
25
  'Orbital rotation': 'Орбитальное движение',
26
26
  'Pan': 'Сдвиг',
27
- 'Produced with Plotly': 'Создано с помощью Plotly',
27
+ 'Produced with Plotly.js': 'Создано с помощью Plotly.js',
28
28
  'Reset': 'Сбросить к значениям по умолчанию',
29
29
  'Reset axes': 'Сбросить отображение осей к значениям по умолчанию',
30
30
  'Reset camera to default': 'Сбросить параметры камеры к значениям по умолчанию',
package/lib/locales/sv.js CHANGED
@@ -24,7 +24,7 @@ module.exports = {
24
24
  'Lasso Select': 'Välj lasso', // components/modebar/buttons.js:121
25
25
  'Orbital rotation': 'Orbital rotation', // components/modebar/buttons.js:281
26
26
  'Pan': 'Panorera', // components/modebar/buttons.js:103
27
- 'Produced with Plotly': 'Skapad med Plotly', // components/modebar/modebar.js:304
27
+ 'Produced with Plotly.js': 'Skapad med Plotly.js', // components/modebar/modebar.js:304
28
28
  'Reset': 'Återställ', // components/modebar/buttons.js:433
29
29
  'Reset axes': 'Återställ axlar', // components/modebar/buttons.js:157
30
30
  'Reset camera to default': 'Återställ kamera till standard', // components/modebar/buttons.js:319
package/lib/locales/sw.js CHANGED
@@ -24,7 +24,7 @@ module.exports = {
24
24
  'Lasso Select': 'Kuteua lasso',
25
25
  'Orbital rotation': 'Mzunguko wa mazao',
26
26
  'Pan': 'Tandaza',
27
- 'Produced with Plotly': 'Ilitengenezwa na Plotly',
27
+ 'Produced with Plotly.js': 'Ilitengenezwa na Plotly.js',
28
28
  'Reset': 'Weka upya',
29
29
  'Reset axes': 'Weka upya axes',
30
30
  'Reset camera to default': 'Rudisha kamera kwenye uhifadhi wa default',
package/lib/locales/uk.js CHANGED
@@ -24,7 +24,7 @@ module.exports = {
24
24
  'Lasso Select': 'Ласо',
25
25
  'Orbital rotation': 'Рух по орбіті',
26
26
  'Pan': 'Зсув',
27
- 'Produced with Plotly': 'Створено за допомогою Plotly',
27
+ 'Produced with Plotly.js': 'Створено за допомогою Plotly.js',
28
28
  'Reset': 'Встановити значення за замовчуванням',
29
29
  'Reset axes': 'Встановити осям значення за замовчуванням',
30
30
  'Reset camera to default': 'Встановити камері значення за замовчуванням',
@@ -23,7 +23,7 @@ module.exports = {
23
23
  'Lasso Select': '套索选择', // components/modebar/buttons.js:112
24
24
  'Orbital rotation': '轨道旋转', // components/modebar/buttons.js:279
25
25
  'Pan': '平移',
26
- 'Produced with Plotly': '由Plotly生成', // components/modebar/modebar.js:256
26
+ 'Produced with Plotly.js': '由Plotly.js生成', // components/modebar/modebar.js:256
27
27
  'Reset': '重置', // components/modebar/buttons.js:432
28
28
  'Reset axes': '重置轴', // components/modebar/buttons.js:148
29
29
  'Reset camera to default': '重置镜头视角为默认状态',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plotly.js",
3
- "version": "2.8.2",
3
+ "version": "2.10.0",
4
4
  "description": "The open source javascript graphing library that powers plotly",
5
5
  "license": "MIT",
6
6
  "main": "./lib/index.js",
@@ -52,6 +52,8 @@
52
52
  "test-requirejs": "node tasks/test_requirejs.js",
53
53
  "test-plain-obj": "node tasks/test_plain_obj.js",
54
54
  "test": "npm run test-jasmine -- --nowatch && npm run test-bundle && npm run test-image && npm run test-export && npm run test-syntax && npm run lint",
55
+ "mathjax3": "node devtools/test_dashboard/server.js --mathjax3",
56
+ "mathjax3chtml": "node devtools/test_dashboard/server.js --mathjax3chtml",
55
57
  "strict": "node devtools/test_dashboard/server.js --strict",
56
58
  "start": "node devtools/test_dashboard/server.js",
57
59
  "baseline": "node test/image/make_baseline.js",
@@ -103,7 +105,7 @@
103
105
  "native-promise-only": "^0.8.1",
104
106
  "parse-svg-path": "^0.1.2",
105
107
  "polybooljs": "^1.2.0",
106
- "probe-image-size": "^7.2.2",
108
+ "probe-image-size": "^7.2.3",
107
109
  "regl": "^2.1.0",
108
110
  "regl-error2d": "^2.0.12",
109
111
  "regl-line2d": "^3.1.2",
@@ -124,45 +126,46 @@
124
126
  "browserify": "^17.0.0",
125
127
  "browserify-transform-tools": "^1.7.0",
126
128
  "bubleify": "^2.0.0",
127
- "canvas": "^2.8.0",
129
+ "canvas": "^2.9.0",
128
130
  "check-node-version": "^4.2.1",
129
131
  "chttps": "^1.0.6",
130
132
  "deep-equal": "^2.0.5",
131
133
  "derequire": "^2.1.1",
132
134
  "ecstatic": "^4.1.4",
133
- "eslint": "^8.4.1",
135
+ "eslint": "^8.8.0",
134
136
  "extra-iterable": "^2.5.22",
135
137
  "falafel": "^2.2.4",
136
138
  "fs-extra": "^10.0.0",
137
- "fuse.js": "^6.4.6",
139
+ "fuse.js": "^6.5.3",
138
140
  "glob": "^7.2.0",
139
141
  "gzip-size": "^6.0.0",
140
142
  "into-stream": "^6.0.0",
141
143
  "jasmine-core": "^3.5.0",
142
144
  "jsdom": "^19.0.0",
143
- "karma": "^6.3.9",
145
+ "karma": "^6.3.16",
144
146
  "karma-browserify": "^8.1.0",
145
147
  "karma-chrome-launcher": "^3.1.0",
146
148
  "karma-firefox-launcher": "^2.1.2",
147
149
  "karma-ie-launcher": "^1.0.0",
148
150
  "karma-jasmine": "^3.3.1",
149
151
  "karma-jasmine-spec-tags": "^1.3.0",
150
- "karma-spec-reporter": "0.0.32",
151
- "karma-verbose-reporter": "0.0.6",
152
- "karma-viewport": "^1.0.8",
152
+ "karma-spec-reporter": "^0.0.33",
153
+ "karma-verbose-reporter": "^0.0.8",
154
+ "karma-viewport": "1.0.2",
153
155
  "lodash": "^4.17.21",
154
156
  "madge": "^5.0.1",
155
- "mathjax": "2.7.5",
157
+ "mathjax-v2": "npm:mathjax@2.7.5",
158
+ "mathjax-v3": "npm:mathjax@^3.2.0",
156
159
  "minify-stream": "^2.1.0",
157
160
  "npm-link-check": "^4.0.0",
158
161
  "open": "^8.4.0",
159
162
  "pixelmatch": "^5.2.1",
160
- "prepend-file": "^2.0.0",
163
+ "prepend-file": "^2.0.1",
161
164
  "prettysize": "^2.0.0",
162
165
  "read-last-lines": "^1.8.0",
163
166
  "run-series": "^1.1.9",
164
167
  "sane-topojson": "^4.0.0",
165
- "sass": "^1.44.0",
168
+ "sass": "^1.49.7",
166
169
  "through2": "^4.0.2",
167
170
  "true-case-path": "^2.2.1",
168
171
  "watchify": "^4.0.0"
@@ -166,6 +166,7 @@ module.exports = overrideAll({
166
166
  ticklen: axesAttrs.ticklen,
167
167
  tickwidth: axesAttrs.tickwidth,
168
168
  tickcolor: axesAttrs.tickcolor,
169
+ ticklabelstep: axesAttrs.ticklabelstep,
169
170
  showticklabels: axesAttrs.showticklabels,
170
171
  tickfont: fontAttrs({
171
172
  description: 'Sets the color bar\'s tick label font'
@@ -933,6 +933,7 @@ function mockColorBarAxis(gd, opts, zrange) {
933
933
  showticklabels: opts.showticklabels,
934
934
  ticklabelposition: opts.ticklabelposition,
935
935
  ticklabeloverflow: opts.ticklabeloverflow,
936
+ ticklabelstep: opts.ticklabelstep,
936
937
  tickfont: opts.tickfont,
937
938
  tickangle: opts.tickangle,
938
939
  tickformat: opts.tickformat,
@@ -177,24 +177,42 @@ drawing.dashStyle = function(dash, lineWidth) {
177
177
  return dash;
178
178
  };
179
179
 
180
+ function setFillStyle(sel, trace, gd) {
181
+ var markerPattern = trace.fillpattern;
182
+ var patternShape = markerPattern && drawing.getPatternAttr(markerPattern.shape, 0, '');
183
+ if(patternShape) {
184
+ var patternBGColor = drawing.getPatternAttr(markerPattern.bgcolor, 0, null);
185
+ var patternFGColor = drawing.getPatternAttr(markerPattern.fgcolor, 0, null);
186
+ var patternFGOpacity = markerPattern.fgopacity;
187
+ var patternSize = drawing.getPatternAttr(markerPattern.size, 0, 8);
188
+ var patternSolidity = drawing.getPatternAttr(markerPattern.solidity, 0, 0.3);
189
+ var patternID = trace.uid;
190
+ drawing.pattern(sel, 'point', gd, patternID,
191
+ patternShape, patternSize, patternSolidity,
192
+ undefined, markerPattern.fillmode,
193
+ patternBGColor, patternFGColor, patternFGOpacity
194
+ );
195
+ } else if(trace.fillcolor) {
196
+ sel.call(Color.fill, trace.fillcolor);
197
+ }
198
+ }
199
+
180
200
  // Same as fillGroupStyle, except in this case the selection may be a transition
181
- drawing.singleFillStyle = function(sel) {
201
+ drawing.singleFillStyle = function(sel, gd) {
182
202
  var node = d3.select(sel.node());
183
203
  var data = node.data();
184
- var fillcolor = (((data[0] || [])[0] || {}).trace || {}).fillcolor;
185
- if(fillcolor) {
186
- sel.call(Color.fill, fillcolor);
187
- }
204
+ var trace = ((data[0] || [])[0] || {}).trace || {};
205
+ setFillStyle(sel, trace, gd);
188
206
  };
189
207
 
190
- drawing.fillGroupStyle = function(s) {
208
+ drawing.fillGroupStyle = function(s, gd) {
191
209
  s.style('stroke-width', 0)
192
210
  .each(function(d) {
193
211
  var shape = d3.select(this);
194
212
  // N.B. 'd' won't be a calcdata item when
195
213
  // fill !== 'none' on a segment-less and marker-less trace
196
214
  if(d[0].trace) {
197
- shape.call(Color.fill, d[0].trace.fillcolor);
215
+ setFillStyle(shape, d[0].trace, gd);
198
216
  }
199
217
  });
200
218
  };
@@ -347,12 +365,7 @@ drawing.gradient = function(sel, gd, gradientID, type, colorscale, prop) {
347
365
  sel.style(prop, getFullUrl(fullID, gd))
348
366
  .style(prop + '-opacity', null);
349
367
 
350
- var className2query = function(s) {
351
- return '.' + s.attr('class').replace(/\s/g, '.');
352
- };
353
- var k = className2query(d3.select(sel.node().parentNode)) +
354
- '>' + className2query(sel);
355
- fullLayout._gradientUrlQueryParts[k] = 1;
368
+ sel.classed('gradient_filled', true);
356
369
  };
357
370
 
358
371
  /**
@@ -559,11 +572,6 @@ drawing.pattern = function(sel, calledBy, gd, patternID, shape, size, solidity,
559
572
  .style('fill-opacity', null);
560
573
 
561
574
  sel.classed('pattern_filled', true);
562
- var className2query = function(s) {
563
- return '.' + s.attr('class').replace(/\s/g, '.');
564
- };
565
- var k = className2query(d3.select(sel.node().parentNode)) + '>.pattern_filled';
566
- fullLayout._patternUrlQueryParts[k] = 1;
567
575
  };
568
576
 
569
577
  /*
@@ -579,9 +587,7 @@ drawing.initGradients = function(gd) {
579
587
  var gradientsGroup = Lib.ensureSingle(fullLayout._defs, 'g', 'gradients');
580
588
  gradientsGroup.selectAll('linearGradient,radialGradient').remove();
581
589
 
582
- // initialize stash of query parts filled in Drawing.gradient,
583
- // used to fix URL strings during image exports
584
- fullLayout._gradientUrlQueryParts = {};
590
+ d3.select(gd).selectAll('.gradient_filled').classed('gradient_filled', false);
585
591
  };
586
592
 
587
593
  drawing.initPatterns = function(gd) {
@@ -590,9 +596,7 @@ drawing.initPatterns = function(gd) {
590
596
  var patternsGroup = Lib.ensureSingle(fullLayout._defs, 'g', 'patterns');
591
597
  patternsGroup.selectAll('pattern').remove();
592
598
 
593
- // initialize stash of query parts filled in Drawing.pattern,
594
- // used to fix URL strings during image exports
595
- fullLayout._patternUrlQueryParts = {};
599
+ d3.select(gd).selectAll('.pattern_filled').classed('pattern_filled', false);
596
600
  };
597
601
 
598
602
  drawing.getPatternAttr = function(mp, i, dflt) {
@@ -714,7 +714,6 @@ function computeLegendDimensions(gd, groups, traces, legendObj) {
714
714
  offsetY += h;
715
715
  maxWidthInGroup = Math.max(maxWidthInGroup, textGap + w);
716
716
  });
717
- maxGroupHeightInRow = Math.max(maxGroupHeightInRow, offsetY);
718
717
 
719
718
  var next = maxWidthInGroup + itemGap;
720
719
 
@@ -730,6 +729,8 @@ function computeLegendDimensions(gd, groups, traces, legendObj) {
730
729
  groupOffsetX = 0;
731
730
  groupOffsetY += maxGroupHeightInRow + traceGroupGap;
732
731
  maxGroupHeightInRow = offsetY;
732
+ } else {
733
+ maxGroupHeightInRow = Math.max(maxGroupHeightInRow, offsetY);
733
734
  }
734
735
 
735
736
  Drawing.setTranslate(this, groupOffsetX, groupOffsetY);
@@ -111,12 +111,16 @@ module.exports = function style(s, gd, legend) {
111
111
  var colorscale = cOpts.colorscale;
112
112
  var reversescale = cOpts.reversescale;
113
113
 
114
- var fillGradient = function(s) {
114
+ var fillStyle = function(s) {
115
115
  if(s.size()) {
116
- var gradientID = 'legendfill-' + trace.uid;
117
- Drawing.gradient(s, gd, gradientID,
118
- getGradientDirection(reversescale),
119
- colorscale, 'fill');
116
+ if(showFill) {
117
+ Drawing.fillGroupStyle(s, gd);
118
+ } else {
119
+ var gradientID = 'legendfill-' + trace.uid;
120
+ Drawing.gradient(s, gd, gradientID,
121
+ getGradientDirection(reversescale),
122
+ colorscale, 'fill');
123
+ }
120
124
  }
121
125
  };
122
126
 
@@ -145,7 +149,7 @@ module.exports = function style(s, gd, legend) {
145
149
  fill.enter().append('path').classed('js-fill', true);
146
150
  fill.exit().remove();
147
151
  fill.attr('d', pathStart + 'h' + itemWidth + 'v6h-' + itemWidth + 'z')
148
- .call(showFill ? Drawing.fillGroupStyle : fillGradient);
152
+ .call(fillStyle);
149
153
 
150
154
  if(showLine || showGradientLine) {
151
155
  var lw = boundLineWidth(undefined, trace.line, MAX_LINE_WIDTH, CST_LINE_WIDTH);
@@ -5,6 +5,8 @@ var isNumeric = require('fast-isnumeric');
5
5
 
6
6
  var Lib = require('../../lib');
7
7
  var Icons = require('../../fonts/ploticon');
8
+ var version = require('../../version').version;
9
+
8
10
  var Parser = new DOMParser();
9
11
 
10
12
  /**
@@ -283,6 +285,10 @@ proto.hasButtons = function(buttons) {
283
285
  return true;
284
286
  };
285
287
 
288
+ function jsVersion(str) {
289
+ return str + ' (v' + version + ')';
290
+ }
291
+
286
292
  /**
287
293
  * @return {HTMLDivElement} The logo image wrapped in a group
288
294
  */
@@ -292,7 +298,7 @@ proto.getLogo = function() {
292
298
 
293
299
  a.href = 'https://plotly.com/';
294
300
  a.target = '_blank';
295
- a.setAttribute('data-title', Lib._(this.graphInfo, 'Produced with Plotly'));
301
+ a.setAttribute('data-title', jsVersion(Lib._(this.graphInfo, 'Produced with Plotly.js')));
296
302
  a.className = 'modebar-btn plotlyjsicon modebar-btn--logo';
297
303
 
298
304
  a.appendChild(this.createIcon(Icons.newplotlylogo));
@@ -19,6 +19,7 @@ exports.convertToTspans = function(_context, gd, _callback) {
19
19
  // Until we get tex integrated more fully (so it can be used along with non-tex)
20
20
  // allow some elements to prohibit it by attaching 'data-notex' to the original
21
21
  var tex = (!_context.attr('data-notex')) &&
22
+ gd && gd._context.typesetMath &&
22
23
  (typeof MathJax !== 'undefined') &&
23
24
  str.match(FIND_TEX);
24
25
 
@@ -173,70 +174,154 @@ function cleanEscapesForTex(s) {
173
174
  .replace(GT_MATCH, '\\gt ');
174
175
  }
175
176
 
177
+ var inlineMath = [['$', '$'], ['\\(', '\\)']];
178
+
176
179
  function texToSVG(_texString, _config, _callback) {
180
+ var MathJaxVersion = parseInt(
181
+ (MathJax.version || '').split('.')[0]
182
+ );
183
+
184
+ if(
185
+ MathJaxVersion !== 2 &&
186
+ MathJaxVersion !== 3
187
+ ) {
188
+ Lib.warn('No MathJax version:', MathJax.version);
189
+ return;
190
+ }
191
+
177
192
  var originalRenderer,
178
193
  originalConfig,
179
194
  originalProcessSectionDelay,
180
195
  tmpDiv;
181
196
 
182
- MathJax.Hub.Queue(
183
- function() {
197
+ var setConfig2 = function() {
184
198
  originalConfig = Lib.extendDeepAll({}, MathJax.Hub.config);
185
199
 
186
200
  originalProcessSectionDelay = MathJax.Hub.processSectionDelay;
187
201
  if(MathJax.Hub.processSectionDelay !== undefined) {
188
- // MathJax 2.5+
202
+ // MathJax 2.5+ but not 3+
189
203
  MathJax.Hub.processSectionDelay = 0;
190
204
  }
191
205
 
192
206
  return MathJax.Hub.Config({
193
207
  messageStyle: 'none',
194
208
  tex2jax: {
195
- inlineMath: [['$', '$'], ['\\(', '\\)']]
209
+ inlineMath: inlineMath
196
210
  },
197
211
  displayAlign: 'left',
198
212
  });
199
- },
200
- function() {
201
- // Get original renderer
213
+ };
214
+
215
+ var setConfig3 = function() {
216
+ originalConfig = Lib.extendDeepAll({}, MathJax.config);
217
+
218
+ if(!MathJax.config.tex) {
219
+ MathJax.config.tex = {};
220
+ }
221
+
222
+ MathJax.config.tex.inlineMath = inlineMath;
223
+ };
224
+
225
+ var setRenderer2 = function() {
202
226
  originalRenderer = MathJax.Hub.config.menuSettings.renderer;
203
227
  if(originalRenderer !== 'SVG') {
204
228
  return MathJax.Hub.setRenderer('SVG');
205
229
  }
206
- },
207
- function() {
230
+ };
231
+
232
+ var setRenderer3 = function() {
233
+ originalRenderer = MathJax.config.startup.output;
234
+ if(originalRenderer !== 'svg') {
235
+ MathJax.config.startup.output = 'svg';
236
+ }
237
+ };
238
+
239
+ var initiateMathJax = function() {
208
240
  var randomID = 'math-output-' + Lib.randstr({}, 64);
209
241
  tmpDiv = d3.select('body').append('div')
210
242
  .attr({id: randomID})
211
- .style({visibility: 'hidden', position: 'absolute'})
212
- .style({'font-size': _config.fontSize + 'px'})
243
+ .style({
244
+ visibility: 'hidden',
245
+ position: 'absolute',
246
+ 'font-size': _config.fontSize + 'px'
247
+ })
213
248
  .text(cleanEscapesForTex(_texString));
214
249
 
215
- return MathJax.Hub.Typeset(tmpDiv.node());
216
- },
217
- function() {
218
- var glyphDefs = d3.select('body').select('#MathJax_SVG_glyphs');
250
+ var tmpNode = tmpDiv.node();
251
+
252
+ return MathJaxVersion === 2 ?
253
+ MathJax.Hub.Typeset(tmpNode) :
254
+ MathJax.typeset([tmpNode]);
255
+ };
256
+
257
+ var finalizeMathJax = function() {
258
+ var sel = tmpDiv.select(
259
+ MathJaxVersion === 2 ? '.MathJax_SVG' : '.MathJax'
260
+ );
219
261
 
220
- if(tmpDiv.select('.MathJax_SVG').empty() || !tmpDiv.select('svg').node()) {
262
+ var node = !sel.empty() && tmpDiv.select('svg').node();
263
+ if(!node) {
221
264
  Lib.log('There was an error in the tex syntax.', _texString);
222
265
  _callback();
223
266
  } else {
224
- var svgBBox = tmpDiv.select('svg').node().getBoundingClientRect();
225
- _callback(tmpDiv.select('.MathJax_SVG'), glyphDefs, svgBBox);
267
+ var nodeBBox = node.getBoundingClientRect();
268
+ var glyphDefs;
269
+ if(MathJaxVersion === 2) {
270
+ glyphDefs = d3.select('body').select('#MathJax_SVG_glyphs');
271
+ } else {
272
+ glyphDefs = sel.select('defs');
273
+ }
274
+ _callback(sel, glyphDefs, nodeBBox);
226
275
  }
227
276
 
228
277
  tmpDiv.remove();
278
+ };
229
279
 
280
+ var resetRenderer2 = function() {
230
281
  if(originalRenderer !== 'SVG') {
231
282
  return MathJax.Hub.setRenderer(originalRenderer);
232
283
  }
233
- },
234
- function() {
284
+ };
285
+
286
+ var resetRenderer3 = function() {
287
+ if(originalRenderer !== 'svg') {
288
+ MathJax.config.startup.output = originalRenderer;
289
+ }
290
+ };
291
+
292
+ var resetConfig2 = function() {
235
293
  if(originalProcessSectionDelay !== undefined) {
236
294
  MathJax.Hub.processSectionDelay = originalProcessSectionDelay;
237
295
  }
238
296
  return MathJax.Hub.Config(originalConfig);
239
- });
297
+ };
298
+
299
+ var resetConfig3 = function() {
300
+ MathJax.config = originalConfig;
301
+ };
302
+
303
+ if(MathJaxVersion === 2) {
304
+ MathJax.Hub.Queue(
305
+ setConfig2,
306
+ setRenderer2,
307
+ initiateMathJax,
308
+ finalizeMathJax,
309
+ resetRenderer2,
310
+ resetConfig2
311
+ );
312
+ } else if(MathJaxVersion === 3) {
313
+ setConfig3();
314
+ setRenderer3();
315
+ MathJax.startup.defaultReady();
316
+
317
+ MathJax.startup.promise.then(function() {
318
+ initiateMathJax();
319
+ finalizeMathJax();
320
+
321
+ resetRenderer3();
322
+ resetConfig3();
323
+ });
324
+ }
240
325
  }
241
326
 
242
327
  var TAG_STYLES = {