plotly.js 2.9.0 → 2.11.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 (86) hide show
  1. package/.circleci/config.yml +39 -1
  2. package/.circleci/test.sh +14 -1
  3. package/CHANGELOG.md +24 -1
  4. package/CONTRIBUTING.md +18 -1
  5. package/README.md +12 -4
  6. package/dist/README.md +28 -28
  7. package/dist/plot-schema.json +98 -0
  8. package/dist/plotly-basic.js +174 -83
  9. package/dist/plotly-basic.min.js +3 -3
  10. package/dist/plotly-cartesian.js +174 -83
  11. package/dist/plotly-cartesian.min.js +4 -4
  12. package/dist/plotly-finance.js +174 -83
  13. package/dist/plotly-finance.min.js +3 -3
  14. package/dist/plotly-geo-assets.js +2 -2
  15. package/dist/plotly-geo.js +174 -83
  16. package/dist/plotly-geo.min.js +3 -3
  17. package/dist/plotly-gl2d.js +601 -433
  18. package/dist/plotly-gl2d.min.js +10 -10
  19. package/dist/plotly-gl3d.js +223 -91
  20. package/dist/plotly-gl3d.min.js +8 -8
  21. package/dist/plotly-mapbox.js +174 -83
  22. package/dist/plotly-mapbox.min.js +2 -2
  23. package/dist/plotly-strict.js +40414 -1028
  24. package/dist/plotly-strict.min.js +11 -11
  25. package/dist/plotly-with-meta.js +881 -704
  26. package/dist/plotly.js +848 -675
  27. package/dist/plotly.min.js +4 -4
  28. package/lib/index-strict.js +5 -0
  29. package/package.json +13 -9
  30. package/src/components/drawing/index.js +28 -24
  31. package/src/components/legend/style.js +10 -6
  32. package/src/generated/regl-codegen/0919c57b995304312da30a5af7873a319bfb7b7e22ff6b4fa203ecbd5774ebfc +1462 -0
  33. package/src/generated/regl-codegen/13c0ae156483f2bcbd7ff29404f0abfd8689ff43f41791a6c7469868690a4260 +3391 -0
  34. package/src/generated/regl-codegen/19769c875db736c08a744c0a6aabe28276ed06aa24fdb7c36506a9f4c1f56f13 +3375 -0
  35. package/src/generated/regl-codegen/21cec01aa93887c70e86d7f1bc84d6837da0b1f5c1ff4cadd42ac6eb37f9f316 +2488 -0
  36. package/src/generated/regl-codegen/4df455b48c9de7d9f1de4b9481b505c09613ba7f90d2b4e360e673839566688e +662 -0
  37. package/src/generated/regl-codegen/53f2bf051e4ba66c90f343d29aa8da9e4029454c0d428f8e46e94dfddc97c8c6 +459 -0
  38. package/src/generated/regl-codegen/59568c77bcbe6343ee6109df49ceeb78c8a8a8a81872e88fb077f9a3d6dc0567 +637 -0
  39. package/src/generated/regl-codegen/6c3ff5a68d2906faf59307b58a799389f916ebdd3f7732ce75967575041988fc +2226 -0
  40. package/src/generated/regl-codegen/7c8e7f36e693904898ece5f7f8b49b23c69d98397567c3915a45647209eb7da4 +2052 -0
  41. package/src/generated/regl-codegen/8a43b073e4f3e9c0e499c8ac9c253f2aa1e3d3de2febfccc6526b52295dbf770 +664 -0
  42. package/src/generated/regl-codegen/909861c036d6f1ef40ba2dfcc33ef32489d2fe05fa7b7984d5ff315ddceb17b1 +454 -0
  43. package/src/generated/regl-codegen/c759965c8d66b2b356ae7455825df829f2ba7d4e7e903236f8c8d3bc5f45bd44 +2116 -0
  44. package/src/generated/regl-codegen/f9448a214a3e3cd439b767559aa71a4d1ccf5a8f39b8b756973e71acd33ff956 +2755 -0
  45. package/src/generated/regl-codegen/ff8495670417d5d0e4caa9942ad63b4dff0242a390ac1cb807c78ca326d6f3ce +639 -0
  46. package/src/lib/prepare_regl.js +7 -3
  47. package/src/lib/svg_text_utils.js +106 -21
  48. package/src/plot_api/plot_config.js +9 -0
  49. package/src/snapshot/tosvg.js +14 -25
  50. package/src/traces/parcoords/base_index.js +24 -0
  51. package/src/traces/parcoords/index.js +4 -22
  52. package/src/traces/parcoords/plot-strict.js +9 -0
  53. package/src/traces/parcoords/plot.js +5 -2
  54. package/src/traces/parcoords/regl_precompiled.js +12 -0
  55. package/src/traces/parcoords/strict.js +7 -0
  56. package/src/traces/scatter/attributes.js +2 -0
  57. package/src/traces/scatter/defaults.js +2 -0
  58. package/src/traces/scatter/plot.js +4 -4
  59. package/src/traces/scatter/style.js +1 -1
  60. package/src/traces/scattergl/base_index.js +29 -0
  61. package/src/traces/scattergl/index.js +3 -26
  62. package/src/traces/scattergl/plot.js +5 -2
  63. package/src/traces/scattergl/plot_strict.js +9 -0
  64. package/src/traces/scattergl/regl_precompiled.js +24 -0
  65. package/src/traces/scattergl/strict.js +7 -0
  66. package/src/traces/scatterpolargl/base_index.js +29 -0
  67. package/src/traces/scatterpolargl/index.js +3 -26
  68. package/src/traces/scatterpolargl/plot.js +4 -0
  69. package/src/traces/scatterpolargl/plot_strict.js +13 -0
  70. package/src/traces/scatterpolargl/regl_precompiled.js +24 -0
  71. package/src/traces/scatterpolargl/strict.js +7 -0
  72. package/src/traces/splom/base_index.js +36 -0
  73. package/src/traces/splom/base_plot.js +5 -2
  74. package/src/traces/splom/base_plot_strict.js +9 -0
  75. package/src/traces/splom/index.js +3 -33
  76. package/src/traces/splom/regl_precompiled.js +24 -0
  77. package/src/traces/splom/strict.js +7 -0
  78. package/src/version.js +1 -1
  79. package/stackgl_modules/index.js +49 -8
  80. package/stackgl_modules/package-lock.json +10 -10
  81. package/stackgl_modules/package.json +2 -2
  82. package/tasks/bundle.js +18 -0
  83. package/tasks/noci_test.sh +1 -1
  84. package/tasks/partial_bundle.js +26 -23
  85. package/tasks/stats.js +3 -3
  86. package/tasks/util/constants.js +13 -1
@@ -30,8 +30,11 @@ Plotly.register([
30
30
  require('./streamtube'),
31
31
  require('./scattergeo'),
32
32
  require('./choropleth'),
33
+ require('../src/traces/scattergl/strict'),
34
+ require('../src/traces/splom/strict'),
33
35
  require('./pointcloud'),
34
36
  require('./heatmapgl'),
37
+ require('../src/traces/parcoords/strict'),
35
38
  require('./parcats'),
36
39
  require('./scattermapbox'),
37
40
  require('./choroplethmapbox'),
@@ -45,7 +48,9 @@ Plotly.register([
45
48
  require('./ohlc'),
46
49
  require('./candlestick'),
47
50
  require('./scatterpolar'),
51
+ require('../src/traces/scatterpolargl/strict'),
48
52
  require('./barpolar'),
53
+ require('./scattersmith'),
49
54
 
50
55
  // transforms
51
56
  require('./aggregate'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plotly.js",
3
- "version": "2.9.0",
3
+ "version": "2.11.0",
4
4
  "description": "The open source javascript graphing library that powers plotly",
5
5
  "license": "MIT",
6
6
  "main": "./lib/index.js",
@@ -32,13 +32,14 @@
32
32
  "use-draftlogs": "node tasks/use_draftlogs.js",
33
33
  "empty-draftlogs": "node tasks/empty_draftlogs.js",
34
34
  "empty-dist": "node tasks/empty_dist.js",
35
- "build": "npm run empty-dist && npm run preprocess && npm run find-strings && npm run bundle && npm run extra-bundles basic && npm run extra-bundles cartesian && npm run extra-bundles geo && npm run extra-bundles gl2d && npm run extra-bundles gl3d && npm run extra-bundles mapbox && npm run extra-bundles finance && npm run extra-bundles strict && npm run locales && npm run schema dist && npm run stats",
35
+ "build": "npm run empty-dist && npm run preprocess && npm run find-strings && npm run bundle && npm run extra-bundles basic && npm run extra-bundles cartesian && npm run extra-bundles geo && npm run extra-bundles gl2d && npm run extra-bundles gl3d && npm run extra-bundles mapbox && npm run extra-bundles finance && npm run locales && npm run schema dist && npm run stats",
36
+ "regl-codegen": "node devtools/regl_codegen/server.js",
36
37
  "cibuild": "npm run empty-dist && npm run preprocess && node tasks/cibundle.js",
37
38
  "watch": "node tasks/watch.js",
38
39
  "lint": "eslint --version && eslint .",
39
40
  "lint-fix": "eslint . --fix || true",
40
41
  "log-new-func": "eslint --no-ignore --no-eslintrc --no-inline-config --rule '{no-new-func: error}' dist/plotly.js 2>&1 | ./tasks/show_eval_lines.sh",
41
- "no-new-func": "eslint --no-ignore --no-eslintrc --no-inline-config --rule '{no-new-func: error}' $(find dist -type f -iname '*.js' | grep -v plotly-gl2d* | grep -v plotly-with-meta.* | grep -v plotly.js | grep -v plotly.min.js)",
42
+ "no-new-func": "eslint --no-ignore --no-eslintrc --no-inline-config --rule '{no-new-func: error}' $(find dist -type f -iname '*.js' | grep -v plotly-gl2d* | grep -v plotly-with-meta.* | grep -v plotly.js | grep -v plotly.min.js | grep -v plotly-strict.js | grep -v plotly-strict.min.js)",
42
43
  "no-bad-char": "eslint --no-ignore --no-eslintrc --no-inline-config --rule '{no-misleading-character-class: error}' $(find dist -type f -iname '*.js' | grep plotly)",
43
44
  "no-dup-keys": "eslint --no-ignore --no-eslintrc --no-inline-config --rule '{no-dupe-keys: error}' $(find dist -type f -iname '*.js' | grep plotly)",
44
45
  "no-es6-dist": "node tasks/no_es6_dist.js",
@@ -52,6 +53,8 @@
52
53
  "test-requirejs": "node tasks/test_requirejs.js",
53
54
  "test-plain-obj": "node tasks/test_plain_obj.js",
54
55
  "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",
56
+ "mathjax3": "node devtools/test_dashboard/server.js --mathjax3",
57
+ "mathjax3chtml": "node devtools/test_dashboard/server.js --mathjax3chtml",
55
58
  "strict": "node devtools/test_dashboard/server.js --strict",
56
59
  "start": "node devtools/test_dashboard/server.js",
57
60
  "baseline": "node test/image/make_baseline.js",
@@ -104,7 +107,7 @@
104
107
  "parse-svg-path": "^0.1.2",
105
108
  "polybooljs": "^1.2.0",
106
109
  "probe-image-size": "^7.2.3",
107
- "regl": "^2.1.0",
110
+ "regl": "npm:@plotly/regl@^2.1.1",
108
111
  "regl-error2d": "^2.0.12",
109
112
  "regl-line2d": "^3.1.2",
110
113
  "regl-scatter2d": "^3.2.8",
@@ -130,17 +133,17 @@
130
133
  "deep-equal": "^2.0.5",
131
134
  "derequire": "^2.1.1",
132
135
  "ecstatic": "^4.1.4",
133
- "eslint": "^8.8.0",
136
+ "eslint": "^8.10.0",
134
137
  "extra-iterable": "^2.5.22",
135
138
  "falafel": "^2.2.4",
136
- "fs-extra": "^10.0.0",
139
+ "fs-extra": "^10.0.1",
137
140
  "fuse.js": "^6.5.3",
138
141
  "glob": "^7.2.0",
139
142
  "gzip-size": "^6.0.0",
140
143
  "into-stream": "^6.0.0",
141
144
  "jasmine-core": "^3.5.0",
142
145
  "jsdom": "^19.0.0",
143
- "karma": "^6.3.12",
146
+ "karma": "^6.3.17",
144
147
  "karma-browserify": "^8.1.0",
145
148
  "karma-chrome-launcher": "^3.1.0",
146
149
  "karma-firefox-launcher": "^2.1.2",
@@ -152,7 +155,8 @@
152
155
  "karma-viewport": "1.0.2",
153
156
  "lodash": "^4.17.21",
154
157
  "madge": "^5.0.1",
155
- "mathjax": "2.7.5",
158
+ "mathjax-v2": "npm:mathjax@2.7.5",
159
+ "mathjax-v3": "npm:mathjax@^3.2.0",
156
160
  "minify-stream": "^2.1.0",
157
161
  "npm-link-check": "^4.0.0",
158
162
  "open": "^8.4.0",
@@ -162,7 +166,7 @@
162
166
  "read-last-lines": "^1.8.0",
163
167
  "run-series": "^1.1.9",
164
168
  "sane-topojson": "^4.0.0",
165
- "sass": "^1.49.7",
169
+ "sass": "^1.49.9",
166
170
  "through2": "^4.0.2",
167
171
  "true-case-path": "^2.2.1",
168
172
  "watchify": "^4.0.0"
@@ -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) {
@@ -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);