plotly.js 2.6.3 → 2.8.1

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 (57) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/README.md +3 -3
  3. package/dist/README.md +26 -26
  4. package/dist/plot-schema.json +1015 -407
  5. package/dist/plotly-basic.js +533 -197
  6. package/dist/plotly-basic.min.js +4 -4
  7. package/dist/plotly-cartesian.js +996 -343
  8. package/dist/plotly-cartesian.min.js +3 -3
  9. package/dist/plotly-finance.js +583 -199
  10. package/dist/plotly-finance.min.js +4 -4
  11. package/dist/plotly-geo-assets.js +2 -2
  12. package/dist/plotly-geo.js +529 -195
  13. package/dist/plotly-geo.min.js +4 -4
  14. package/dist/plotly-gl2d.js +545 -196
  15. package/dist/plotly-gl2d.min.js +2 -2
  16. package/dist/plotly-gl3d.js +529 -195
  17. package/dist/plotly-gl3d.min.js +8 -8
  18. package/dist/plotly-mapbox.js +535 -198
  19. package/dist/plotly-mapbox.min.js +2 -2
  20. package/dist/plotly-strict.js +1220 -564
  21. package/dist/plotly-strict.min.js +3 -3
  22. package/dist/plotly-with-meta.js +1312 -626
  23. package/dist/plotly.js +1274 -618
  24. package/dist/plotly.min.js +10 -10
  25. package/package.json +9 -9
  26. package/src/components/colorbar/attributes.js +29 -20
  27. package/src/components/colorbar/defaults.js +30 -8
  28. package/src/components/colorbar/draw.js +374 -128
  29. package/src/components/drawing/index.js +6 -3
  30. package/src/components/fx/hover.js +5 -2
  31. package/src/components/fx/hoverlabel_defaults.js +4 -2
  32. package/src/components/fx/layout_attributes.js +14 -4
  33. package/src/components/fx/layout_defaults.js +2 -0
  34. package/src/components/legend/attributes.js +7 -0
  35. package/src/components/legend/defaults.js +24 -7
  36. package/src/components/titles/index.js +8 -2
  37. package/src/plot_api/plot_api.js +38 -9
  38. package/src/plots/font_attributes.js +3 -0
  39. package/src/plots/layout_attributes.js +1 -0
  40. package/src/plots/mapbox/mapbox.js +6 -3
  41. package/src/plots/plots.js +7 -15
  42. package/src/traces/bar/plot.js +1 -1
  43. package/src/traces/contour/attributes.js +12 -0
  44. package/src/traces/contour/defaults.js +9 -1
  45. package/src/traces/heatmap/attributes.js +16 -0
  46. package/src/traces/heatmap/defaults.js +2 -0
  47. package/src/traces/heatmap/label_defaults.js +13 -0
  48. package/src/traces/heatmap/plot.js +205 -4
  49. package/src/traces/histogram/attributes.js +40 -0
  50. package/src/traces/histogram/defaults.js +11 -0
  51. package/src/traces/histogram2d/attributes.js +8 -0
  52. package/src/traces/histogram2d/defaults.js +4 -0
  53. package/src/traces/histogram2dcontour/attributes.js +3 -1
  54. package/src/traces/histogram2dcontour/defaults.js +8 -1
  55. package/src/traces/pie/calc.js +3 -1
  56. package/src/version.js +1 -1
  57. package/tasks/test_mock.js +1 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plotly.js",
3
- "version": "2.6.3",
3
+ "version": "2.8.1",
4
4
  "description": "The open source javascript graphing library that powers plotly",
5
5
  "license": "MIT",
6
6
  "main": "./lib/index.js",
@@ -103,7 +103,7 @@
103
103
  "native-promise-only": "^0.8.1",
104
104
  "parse-svg-path": "^0.1.2",
105
105
  "polybooljs": "^1.2.0",
106
- "probe-image-size": "^7.2.1",
106
+ "probe-image-size": "^7.2.2",
107
107
  "regl": "^2.1.0",
108
108
  "regl-error2d": "^2.0.12",
109
109
  "regl-line2d": "^3.1.2",
@@ -125,12 +125,12 @@
125
125
  "browserify-transform-tools": "^1.7.0",
126
126
  "bubleify": "^2.0.0",
127
127
  "canvas": "^2.8.0",
128
- "check-node-version": "^4.1.0",
128
+ "check-node-version": "^4.2.1",
129
129
  "chttps": "^1.0.6",
130
130
  "deep-equal": "^2.0.5",
131
131
  "derequire": "^2.1.1",
132
132
  "ecstatic": "^4.1.4",
133
- "eslint": "^8.1.0",
133
+ "eslint": "^8.4.1",
134
134
  "extra-iterable": "^2.5.22",
135
135
  "falafel": "^2.2.4",
136
136
  "fs-extra": "^10.0.0",
@@ -139,11 +139,11 @@
139
139
  "gzip-size": "^6.0.0",
140
140
  "into-stream": "^6.0.0",
141
141
  "jasmine-core": "^3.5.0",
142
- "jsdom": "^18.0.0",
143
- "karma": "^6.3.6",
142
+ "jsdom": "^19.0.0",
143
+ "karma": "^6.3.9",
144
144
  "karma-browserify": "^8.1.0",
145
145
  "karma-chrome-launcher": "^3.1.0",
146
- "karma-firefox-launcher": "^2.1.1",
146
+ "karma-firefox-launcher": "^2.1.2",
147
147
  "karma-ie-launcher": "^1.0.0",
148
148
  "karma-jasmine": "^3.3.1",
149
149
  "karma-jasmine-spec-tags": "^1.3.0",
@@ -155,14 +155,14 @@
155
155
  "mathjax": "2.7.5",
156
156
  "minify-stream": "^2.1.0",
157
157
  "npm-link-check": "^4.0.0",
158
- "open": "^8.3.0",
158
+ "open": "^8.4.0",
159
159
  "pixelmatch": "^5.2.1",
160
160
  "prepend-file": "^2.0.0",
161
161
  "prettysize": "^2.0.0",
162
162
  "read-last-lines": "^1.8.0",
163
163
  "run-series": "^1.1.9",
164
164
  "sane-topojson": "^4.0.0",
165
- "sass": "^1.42.1",
165
+ "sass": "^1.44.0",
166
166
  "through2": "^4.0.2",
167
167
  "true-case-path": "^2.2.1",
168
168
  "watchify": "^4.0.0"
@@ -7,16 +7,12 @@ var overrideAll = require('../../plot_api/edit_types').overrideAll;
7
7
 
8
8
 
9
9
  module.exports = overrideAll({
10
- // TODO: only right is supported currently
11
- // orient: {
12
- // valType: 'enumerated',
13
- // values: ['left', 'right', 'top', 'bottom'],
14
- // dflt: 'right',
15
- // description: [
16
- // 'Determines which side are the labels on',
17
- // '(so left and right make vertical bars, etc.)'
18
- // ].join(' ')
19
- // },
10
+ orientation: {
11
+ valType: 'enumerated',
12
+ values: ['h', 'v'],
13
+ dflt: 'v',
14
+ description: 'Sets the orientation of the colorbar.'
15
+ },
20
16
  thicknessmode: {
21
17
  valType: 'enumerated',
22
18
  values: ['fraction', 'pixels'],
@@ -61,21 +57,23 @@ module.exports = overrideAll({
61
57
  },
62
58
  x: {
63
59
  valType: 'number',
64
- dflt: 1.02,
65
60
  min: -2,
66
61
  max: 3,
67
62
  description: [
68
- 'Sets the x position of the color bar (in plot fraction).'
63
+ 'Sets the x position of the color bar (in plot fraction).',
64
+ 'Defaults to 1.02 when `orientation` is *v* and',
65
+ '0.5 when `orientation` is *h*.'
69
66
  ].join(' ')
70
67
  },
71
68
  xanchor: {
72
69
  valType: 'enumerated',
73
70
  values: ['left', 'center', 'right'],
74
- dflt: 'left',
75
71
  description: [
76
72
  'Sets this color bar\'s horizontal position anchor.',
77
73
  'This anchor binds the `x` position to the *left*, *center*',
78
- 'or *right* of the color bar.'
74
+ 'or *right* of the color bar.',
75
+ 'Defaults to *left* when `orientation` is *v* and',
76
+ '*center* when `orientation` is *h*.'
79
77
  ].join(' ')
80
78
  },
81
79
  xpad: {
@@ -86,21 +84,23 @@ module.exports = overrideAll({
86
84
  },
87
85
  y: {
88
86
  valType: 'number',
89
- dflt: 0.5,
90
87
  min: -2,
91
88
  max: 3,
92
89
  description: [
93
- 'Sets the y position of the color bar (in plot fraction).'
90
+ 'Sets the y position of the color bar (in plot fraction).',
91
+ 'Defaults to 0.5 when `orientation` is *v* and',
92
+ '1.02 when `orientation` is *h*.'
94
93
  ].join(' ')
95
94
  },
96
95
  yanchor: {
97
96
  valType: 'enumerated',
98
97
  values: ['top', 'middle', 'bottom'],
99
- dflt: 'middle',
100
98
  description: [
101
99
  'Sets this color bar\'s vertical position anchor',
102
100
  'This anchor binds the `y` position to the *top*, *middle*',
103
- 'or *bottom* of the color bar.'
101
+ 'or *bottom* of the color bar.',
102
+ 'Defaults to *middle* when `orientation` is *v* and',
103
+ '*bottom* when `orientation` is *h*.'
104
104
  ].join(' ')
105
105
  },
106
106
  ypad: {
@@ -143,18 +143,26 @@ module.exports = overrideAll({
143
143
  'In other cases the default is *hide past div*.'
144
144
  ].join(' ')
145
145
  }),
146
+
147
+ // ticklabelposition: not used directly, as values depend on orientation
148
+ // left/right options are for x axes, and top/bottom options are for y axes
146
149
  ticklabelposition: {
147
150
  valType: 'enumerated',
148
151
  values: [
149
152
  'outside', 'inside',
150
153
  'outside top', 'inside top',
154
+ 'outside left', 'inside left',
155
+ 'outside right', 'inside right',
151
156
  'outside bottom', 'inside bottom'
152
157
  ],
153
158
  dflt: 'outside',
154
159
  description: [
155
- 'Determines where tick labels are drawn.'
160
+ 'Determines where tick labels are drawn relative to the ticks.',
161
+ 'Left and right options are used when `orientation` is *h*,',
162
+ 'top and bottom when `orientation` is *v*.'
156
163
  ].join(' ')
157
164
  },
165
+
158
166
  ticklen: axesAttrs.ticklen,
159
167
  tickwidth: axesAttrs.tickwidth,
160
168
  tickcolor: axesAttrs.tickcolor,
@@ -193,10 +201,11 @@ module.exports = overrideAll({
193
201
  side: {
194
202
  valType: 'enumerated',
195
203
  values: ['right', 'top', 'bottom'],
196
- dflt: 'top',
197
204
  description: [
198
205
  'Determines the location of color bar\'s title',
199
206
  'with respect to the color bar.',
207
+ 'Defaults to *top* when `orientation` if *v* and ',
208
+ 'defaults to *right* when `orientation` if *h*.',
200
209
  'Note that the title\'s location used to be set',
201
210
  'by the now deprecated `titleside` attribute.'
202
211
  ].join(' ')
@@ -18,23 +18,30 @@ module.exports = function colorbarDefaults(containerIn, containerOut, layout) {
18
18
  return Lib.coerce(colorbarIn, colorbarOut, attributes, attr, dflt);
19
19
  }
20
20
 
21
+ var margin = layout.margin || {t: 0, b: 0, l: 0, r: 0};
22
+ var w = layout.width - margin.l - margin.r;
23
+ var h = layout.height - margin.t - margin.b;
24
+
25
+ var orientation = coerce('orientation');
26
+ var isVertical = orientation === 'v';
27
+
21
28
  var thicknessmode = coerce('thicknessmode');
22
29
  coerce('thickness', (thicknessmode === 'fraction') ?
23
- 30 / (layout.width - layout.margin.l - layout.margin.r) :
30
+ 30 / (isVertical ? w : h) :
24
31
  30
25
32
  );
26
33
 
27
34
  var lenmode = coerce('lenmode');
28
35
  coerce('len', (lenmode === 'fraction') ?
29
36
  1 :
30
- layout.height - layout.margin.t - layout.margin.b
37
+ isVertical ? h : w
31
38
  );
32
39
 
33
- coerce('x');
34
- coerce('xanchor');
40
+ coerce('x', isVertical ? 1.02 : 0.5);
41
+ coerce('xanchor', isVertical ? 'left' : 'center');
35
42
  coerce('xpad');
36
- coerce('y');
37
- coerce('yanchor');
43
+ coerce('y', isVertical ? 0.5 : 1.02);
44
+ coerce('yanchor', isVertical ? 'middle' : 'bottom');
38
45
  coerce('ypad');
39
46
  Lib.noneOrAll(colorbarIn, colorbarOut, ['x', 'y']);
40
47
 
@@ -44,7 +51,22 @@ module.exports = function colorbarDefaults(containerIn, containerOut, layout) {
44
51
  coerce('borderwidth');
45
52
  coerce('bgcolor');
46
53
 
47
- var ticklabelposition = coerce('ticklabelposition');
54
+ var ticklabelposition = Lib.coerce(colorbarIn, colorbarOut, {
55
+ ticklabelposition: {
56
+ valType: 'enumerated',
57
+ dflt: 'outside',
58
+ values: isVertical ? [
59
+ 'outside', 'inside',
60
+ 'outside top', 'inside top',
61
+ 'outside bottom', 'inside bottom'
62
+ ] : [
63
+ 'outside', 'inside',
64
+ 'outside left', 'inside left',
65
+ 'outside right', 'inside right'
66
+ ]
67
+ }
68
+ }, 'ticklabelposition');
69
+
48
70
  coerce('ticklabeloverflow', ticklabelposition.indexOf('inside') !== -1 ? 'hide past domain' : 'hide past div');
49
71
 
50
72
  handleTickValueDefaults(colorbarIn, colorbarOut, coerce, 'linear');
@@ -66,5 +88,5 @@ module.exports = function colorbarDefaults(containerIn, containerOut, layout) {
66
88
  size: Lib.bigFont(tickFont.size)
67
89
  });
68
90
  Lib.coerceFont(coerce, 'title.font', dfltTitleFont);
69
- coerce('title.side');
91
+ coerce('title.side', isVertical ? 'top' : 'right');
70
92
  };