plotly.js 2.8.0 → 2.9.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 (77) hide show
  1. package/.circleci/env_image.sh +1 -1
  2. package/CHANGELOG.md +32 -0
  3. package/README.md +3 -3
  4. package/dist/README.md +26 -26
  5. package/dist/plot-schema.json +315 -0
  6. package/dist/plotly-basic.js +84 -12
  7. package/dist/plotly-basic.min.js +5 -5
  8. package/dist/plotly-cartesian.js +101 -17
  9. package/dist/plotly-cartesian.min.js +3 -3
  10. package/dist/plotly-finance.js +88 -14
  11. package/dist/plotly-finance.min.js +3 -3
  12. package/dist/plotly-geo-assets.js +3 -3
  13. package/dist/plotly-geo.js +76 -11
  14. package/dist/plotly-geo.min.js +3 -3
  15. package/dist/plotly-gl2d.js +79 -13
  16. package/dist/plotly-gl2d.min.js +3 -3
  17. package/dist/plotly-gl3d.js +77 -11
  18. package/dist/plotly-gl3d.min.js +9 -9
  19. package/dist/plotly-locale-cs.js +1 -1
  20. package/dist/plotly-locale-cy.js +1 -1
  21. package/dist/plotly-locale-de.js +1 -1
  22. package/dist/plotly-locale-es.js +1 -1
  23. package/dist/plotly-locale-fi.js +1 -1
  24. package/dist/plotly-locale-fr.js +1 -1
  25. package/dist/plotly-locale-it.js +1 -1
  26. package/dist/plotly-locale-ja.js +1 -1
  27. package/dist/plotly-locale-ko.js +1 -1
  28. package/dist/plotly-locale-pt-br.js +1 -1
  29. package/dist/plotly-locale-pt-pt.js +1 -1
  30. package/dist/plotly-locale-ru.js +1 -1
  31. package/dist/plotly-locale-sv.js +1 -1
  32. package/dist/plotly-locale-sw.js +1 -1
  33. package/dist/plotly-locale-uk.js +1 -1
  34. package/dist/plotly-locale-zh-cn.js +1 -1
  35. package/dist/plotly-mapbox.js +76 -11
  36. package/dist/plotly-mapbox.min.js +3 -3
  37. package/dist/plotly-strict.js +105 -17
  38. package/dist/plotly-strict.min.js +3 -3
  39. package/dist/plotly-with-meta.js +114 -17
  40. package/dist/plotly.js +106 -17
  41. package/dist/plotly.min.js +11 -11
  42. package/dist/translation-keys.txt +1 -1
  43. package/lib/locales/cs.js +1 -1
  44. package/lib/locales/cy.js +1 -1
  45. package/lib/locales/de.js +1 -1
  46. package/lib/locales/es.js +1 -1
  47. package/lib/locales/fi.js +1 -1
  48. package/lib/locales/fr.js +1 -1
  49. package/lib/locales/it.js +1 -1
  50. package/lib/locales/ja.js +1 -1
  51. package/lib/locales/ko.js +1 -1
  52. package/lib/locales/pt-br.js +1 -1
  53. package/lib/locales/pt-pt.js +1 -1
  54. package/lib/locales/ru.js +1 -1
  55. package/lib/locales/sv.js +1 -1
  56. package/lib/locales/sw.js +1 -1
  57. package/lib/locales/uk.js +1 -1
  58. package/lib/locales/zh-cn.js +1 -1
  59. package/package.json +11 -11
  60. package/src/components/colorbar/attributes.js +1 -0
  61. package/src/components/colorbar/draw.js +1 -0
  62. package/src/components/legend/draw.js +2 -1
  63. package/src/components/modebar/modebar.js +7 -1
  64. package/src/plots/cartesian/axes.js +47 -5
  65. package/src/plots/cartesian/layout_attributes.js +14 -0
  66. package/src/plots/cartesian/tick_label_defaults.js +8 -0
  67. package/src/plots/gl3d/layout/axis_defaults.js +1 -0
  68. package/src/plots/polar/layout_attributes.js +1 -0
  69. package/src/plots/smith/layout_defaults.js +1 -0
  70. package/src/plots/ternary/layout_attributes.js +1 -0
  71. package/src/traces/bar/plot.js +8 -1
  72. package/src/traces/carpet/ab_defaults.js +1 -0
  73. package/src/traces/heatmap/plot.js +4 -2
  74. package/src/traces/histogram/calc.js +3 -2
  75. package/src/traces/indicator/attributes.js +1 -0
  76. package/src/version.js +1 -1
  77. 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.0",
3
+ "version": "2.9.0",
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.2",
106
+ "probe-image-size": "^7.2.3",
107
107
  "regl": "^2.1.0",
108
108
  "regl-error2d": "^2.0.12",
109
109
  "regl-line2d": "^3.1.2",
@@ -124,32 +124,32 @@
124
124
  "browserify": "^17.0.0",
125
125
  "browserify-transform-tools": "^1.7.0",
126
126
  "bubleify": "^2.0.0",
127
- "canvas": "^2.8.0",
127
+ "canvas": "^2.9.0",
128
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.4.1",
133
+ "eslint": "^8.8.0",
134
134
  "extra-iterable": "^2.5.22",
135
135
  "falafel": "^2.2.4",
136
136
  "fs-extra": "^10.0.0",
137
- "fuse.js": "^6.4.6",
137
+ "fuse.js": "^6.5.3",
138
138
  "glob": "^7.2.0",
139
139
  "gzip-size": "^6.0.0",
140
140
  "into-stream": "^6.0.0",
141
141
  "jasmine-core": "^3.5.0",
142
142
  "jsdom": "^19.0.0",
143
- "karma": "^6.3.9",
143
+ "karma": "^6.3.12",
144
144
  "karma-browserify": "^8.1.0",
145
145
  "karma-chrome-launcher": "^3.1.0",
146
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",
150
- "karma-spec-reporter": "0.0.32",
151
- "karma-verbose-reporter": "0.0.6",
152
- "karma-viewport": "^1.0.8",
150
+ "karma-spec-reporter": "^0.0.33",
151
+ "karma-verbose-reporter": "^0.0.8",
152
+ "karma-viewport": "1.0.2",
153
153
  "lodash": "^4.17.21",
154
154
  "madge": "^5.0.1",
155
155
  "mathjax": "2.7.5",
@@ -157,12 +157,12 @@
157
157
  "npm-link-check": "^4.0.0",
158
158
  "open": "^8.4.0",
159
159
  "pixelmatch": "^5.2.1",
160
- "prepend-file": "^2.0.0",
160
+ "prepend-file": "^2.0.1",
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.44.0",
165
+ "sass": "^1.49.7",
166
166
  "through2": "^4.0.2",
167
167
  "true-case-path": "^2.2.1",
168
168
  "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,
@@ -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);
@@ -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));
@@ -803,7 +803,8 @@ axes.calcTicks = function calcTicks(ax, opts) {
803
803
  var minRange = Math.min(rng[0], rng[1]);
804
804
  var maxRange = Math.max(rng[0], rng[1]);
805
805
 
806
- var isDLog = (ax.type === 'log') && !(isNumeric(ax.dtick) || ax.dtick.charAt(0) === 'L');
806
+ var numDtick = isNumeric(ax.dtick);
807
+ var isDLog = (ax.type === 'log') && !(numDtick || ax.dtick.charAt(0) === 'L');
807
808
  var isPeriod = ax.ticklabelmode === 'period';
808
809
 
809
810
  // find the first tick
@@ -834,13 +835,36 @@ axes.calcTicks = function calcTicks(ax, opts) {
834
835
  x = axes.tickIncrement(x, ax.dtick, !axrev, ax.calendar);
835
836
  }
836
837
 
838
+ var ticklabelstep = ax.ticklabelstep;
839
+
837
840
  var maxTicks = Math.max(1000, ax._length || 0);
838
841
  var tickVals = [];
839
842
  var xPrevious = null;
843
+
844
+ var dTick;
845
+ if(numDtick) {
846
+ dTick = ax.dtick;
847
+ } else {
848
+ if(ax.type === 'date') {
849
+ if(typeof ax.dtick === 'string' && ax.dtick.charAt(0) === 'M') {
850
+ dTick = ONEAVGMONTH * ax.dtick.substring(1);
851
+ }
852
+ } else {
853
+ dTick = ax._roughDTick;
854
+ }
855
+ }
856
+
857
+ var id = Math.round((
858
+ ax.r2l(x) -
859
+ ax.r2l(ax.tick0)
860
+ ) / dTick) - 1;
861
+
840
862
  for(;
841
863
  (axrev) ? (x >= endTick) : (x <= endTick);
842
864
  x = axes.tickIncrement(x, ax.dtick, axrev, ax.calendar)
843
865
  ) {
866
+ id++;
867
+
844
868
  if(ax.rangebreaks) {
845
869
  if(!axrev) {
846
870
  if(x < startTick) continue;
@@ -858,10 +882,16 @@ axes.calcTicks = function calcTicks(ax, opts) {
858
882
  minor = true;
859
883
  }
860
884
 
861
- tickVals.push({
885
+ var obj = {
862
886
  minor: minor,
863
887
  value: x
864
- });
888
+ };
889
+
890
+ if(ticklabelstep > 1 && id % ticklabelstep) {
891
+ obj.skipLabel = true;
892
+ }
893
+
894
+ tickVals.push(obj);
865
895
  }
866
896
 
867
897
  if(isPeriod) positionPeriodTicks(tickVals, ax, ax._definedDelta);
@@ -914,12 +944,20 @@ axes.calcTicks = function calcTicks(ax, opts) {
914
944
  ax._prevDateHead = '';
915
945
  ax._inCalcTicks = true;
916
946
 
947
+ var lastVisibleHead;
948
+ var hideLabel = function(tick) {
949
+ tick.text = ' '; // don't use an empty string here which can confuse automargin (issue 5132)
950
+ ax._prevDateHead = lastVisibleHead;
951
+ };
952
+
917
953
  var ticksOut = [];
918
954
  var t, p;
919
955
  for(i = 0; i < tickVals.length; i++) {
920
956
  var _minor = tickVals[i].minor;
921
957
  var _value = tickVals[i].value;
922
958
 
959
+ lastVisibleHead = ax._prevDateHead;
960
+
923
961
  t = axes.tickText(
924
962
  ax,
925
963
  _value,
@@ -934,11 +972,14 @@ axes.calcTicks = function calcTicks(ax, opts) {
934
972
  if(p > maxRange) t.periodX = maxRange;
935
973
  if(p < minRange) t.periodX = minRange;
936
974
 
937
- t.text = ' '; // don't use an empty string here which can confuse automargin (issue 5132)
938
- ax._prevDateHead = '';
975
+ hideLabel(t);
939
976
  }
940
977
  }
941
978
 
979
+ if(tickVals[i].skipLabel) {
980
+ hideLabel(t);
981
+ }
982
+
942
983
  ticksOut.push(t);
943
984
  }
944
985
 
@@ -2966,6 +3007,7 @@ axes.drawLabels = function(gd, ax, opts) {
2966
3007
  var axId = ax._id;
2967
3008
  var axLetter = axId.charAt(0);
2968
3009
  var cls = opts.cls || axId + 'tick';
3010
+
2969
3011
  var vals = opts.vals;
2970
3012
 
2971
3013
  var labelFns = opts.labelFns;
@@ -412,6 +412,20 @@ module.exports = {
412
412
  'To set ticks every 4 years, set `dtick` to *M48*'
413
413
  ].join(' ')
414
414
  },
415
+ ticklabelstep: {
416
+ valType: 'integer',
417
+ min: 1,
418
+ dflt: 1,
419
+ editType: 'ticks',
420
+ description: [
421
+ 'Sets the spacing between tick labels as compared to the spacing between ticks.',
422
+ 'A value of 1 (default) means each tick gets a label.',
423
+ 'A value of 2 means shows every 2nd label.',
424
+ 'A larger value n means only every nth tick is labeled.',
425
+ '`tick0` determines which labels are shown.',
426
+ 'Not implemented for axes with `type` *log* or *multicategory*, or when `tickmode` is *array*.'
427
+ ].join(' ')
428
+ },
415
429
  tickvals: {
416
430
  valType: 'data_array',
417
431
  editType: 'ticks',
@@ -28,6 +28,14 @@ module.exports = function handleTickLabelDefaults(containerIn, containerOut, coe
28
28
  color: dfltFontColor
29
29
  });
30
30
 
31
+ if(
32
+ !options.noTicklabelstep &&
33
+ axType !== 'multicategory' &&
34
+ axType !== 'log'
35
+ ) {
36
+ coerce('ticklabelstep');
37
+ }
38
+
31
39
  if(!options.noAng) coerce('tickangle');
32
40
 
33
41
  if(axType !== 'category') {
@@ -43,6 +43,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, options) {
43
43
  showGrid: true,
44
44
  noTickson: true,
45
45
  noTicklabelmode: true,
46
+ noTicklabelstep: true,
46
47
  noTicklabelposition: true,
47
48
  noTicklabeloverflow: true,
48
49
  bgColor: options.bgColor,
@@ -32,6 +32,7 @@ var axisTickAttrs = overrideAll({
32
32
  ticklen: axesAttrs.ticklen,
33
33
  tickwidth: axesAttrs.tickwidth,
34
34
  tickcolor: axesAttrs.tickcolor,
35
+ ticklabelstep: axesAttrs.ticklabelstep,
35
36
  showticklabels: axesAttrs.showticklabels,
36
37
  showtickprefix: axesAttrs.showtickprefix,
37
38
  tickprefix: axesAttrs.tickprefix,
@@ -83,6 +83,7 @@ function handleDefaults(contIn, contOut, coerce, opts) {
83
83
  }
84
84
 
85
85
  handleTickLabelDefaults(axIn, axOut, coerceAxis, axOut.type, {
86
+ noTicklabelstep: true,
86
87
  noAng: !isRealAxis,
87
88
  noExp: true,
88
89
  font: {
@@ -25,6 +25,7 @@ var ternaryAxesAttrs = {
25
25
  ticklen: axesAttrs.ticklen,
26
26
  tickwidth: axesAttrs.tickwidth,
27
27
  tickcolor: axesAttrs.tickcolor,
28
+ ticklabelstep: axesAttrs.ticklabelstep,
28
29
  showticklabels: axesAttrs.showticklabels,
29
30
  showtickprefix: axesAttrs.showtickprefix,
30
31
  tickprefix: axesAttrs.tickprefix,
@@ -629,12 +629,14 @@ function calcTexttemplate(fullLayout, cd, index, xa, ya) {
629
629
  var trace = cd[0].trace;
630
630
  var texttemplate = Lib.castOption(trace, index, 'texttemplate');
631
631
  if(!texttemplate) return '';
632
+ var isHistogram = (trace.type === 'histogram');
632
633
  var isWaterfall = (trace.type === 'waterfall');
633
634
  var isFunnel = (trace.type === 'funnel');
635
+ var isHorizontal = trace.orientation === 'h';
634
636
 
635
637
  var pLetter, pAxis;
636
638
  var vLetter, vAxis;
637
- if(trace.orientation === 'h') {
639
+ if(isHorizontal) {
638
640
  pLetter = 'y';
639
641
  pAxis = ya;
640
642
  vLetter = 'x';
@@ -669,6 +671,11 @@ function calcTexttemplate(fullLayout, cd, index, xa, ya) {
669
671
  var pt = {};
670
672
  appendArrayPointValue(pt, trace, cdi.i);
671
673
 
674
+ if(isHistogram || pt.x === undefined) pt.x = isHorizontal ? obj.value : obj.label;
675
+ if(isHistogram || pt.y === undefined) pt.y = isHorizontal ? obj.label : obj.value;
676
+ if(isHistogram || pt.xLabel === undefined) pt.xLabel = isHorizontal ? obj.valueLabel : obj.labelLabel;
677
+ if(isHistogram || pt.yLabel === undefined) pt.yLabel = isHorizontal ? obj.labelLabel : obj.valueLabel;
678
+
672
679
  if(isWaterfall) {
673
680
  obj.delta = +cdi.rawS || cdi.s;
674
681
  obj.deltaLabel = formatNumber(obj.delta);
@@ -30,6 +30,7 @@ function mimickAxisDefaults(traceIn, traceOut, fullLayout, dfltColor) {
30
30
  var axOut = Template.newContainer(traceOut, axName);
31
31
 
32
32
  var defaultOptions = {
33
+ noTicklabelstep: true,
33
34
  tickfont: 'x',
34
35
  id: axLetter + 'axis',
35
36
  letter: axLetter,
@@ -453,6 +453,7 @@ module.exports = function(gd, plotinfo, cdheatmaps, heatmapLayer) {
453
453
  var font = trace.textfont;
454
454
  var fontFamily = font.family;
455
455
  var fontSize = font.size;
456
+ var globalFontSize = gd._fullLayout.font.size;
456
457
 
457
458
  if(!fontSize || fontSize === 'auto') {
458
459
  var minW = Infinity;
@@ -479,7 +480,7 @@ module.exports = function(gd, plotinfo, cdheatmaps, heatmapLayer) {
479
480
  !isFinite(minW) ||
480
481
  !isFinite(minH)
481
482
  ) {
482
- fontSize = 12;
483
+ fontSize = globalFontSize;
483
484
  } else {
484
485
  minW -= xGap;
485
486
  minH -= yGap;
@@ -492,7 +493,8 @@ module.exports = function(gd, plotinfo, cdheatmaps, heatmapLayer) {
492
493
 
493
494
  fontSize = Math.min(
494
495
  Math.floor(minW),
495
- Math.floor(minH)
496
+ Math.floor(minH),
497
+ globalFontSize
496
498
  );
497
499
  }
498
500
  }
@@ -15,8 +15,9 @@ var getBinSpanLabelRound = require('./bin_label_vals');
15
15
  function calc(gd, trace) {
16
16
  var pos = [];
17
17
  var size = [];
18
- var pa = Axes.getFromId(gd, trace.orientation === 'h' ? trace.yaxis : trace.xaxis);
19
- var mainData = trace.orientation === 'h' ? 'y' : 'x';
18
+ var isHorizontal = trace.orientation === 'h';
19
+ var pa = Axes.getFromId(gd, isHorizontal ? trace.yaxis : trace.xaxis);
20
+ var mainData = isHorizontal ? 'y' : 'x';
20
21
  var counterData = {x: 'y', y: 'x'}[mainData];
21
22
  var calendar = trace[mainData + 'calendar'];
22
23
  var cumulativeSpec = trace.cumulative;
@@ -301,6 +301,7 @@ module.exports = {
301
301
  ticklen: axesAttrs.ticklen,
302
302
  tickwidth: axesAttrs.tickwidth,
303
303
  tickcolor: axesAttrs.tickcolor,
304
+ ticklabelstep: axesAttrs.ticklabelstep,
304
305
  showticklabels: axesAttrs.showticklabels,
305
306
  tickfont: fontAttrs({
306
307
  description: 'Sets the color bar\'s tick label font'
package/src/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  'use strict';
2
2
 
3
3
  // package version injected by `npm run preprocess`
4
- exports.version = '2.8.0';
4
+ exports.version = '2.9.0';
File without changes