Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tooltip annotation functionality #7127

Draft
wants to merge 65 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
be6d4df
Init - basic working implementation
kb- May 18, 2024
55c1b31
Implemented style and template handling
kb- May 19, 2024
0e0591e
Added Dash and Python demo
kb- May 19, 2024
fcd8457
Update index.html
kb- May 19, 2024
d69ac85
Update README.md
kb- May 19, 2024
dcb5eec
Update README.md
kb- May 19, 2024
a617412
Added schema and cleanup
kb- May 19, 2024
4eb2801
Made linter happy
kb- May 19, 2024
47f4925
Update README.md
kb- May 19, 2024
4744a1f
locales
kb- May 20, 2024
723276c
Merge branch 'dev-tooltip' of plotly.js:kb-/plotly.js into dev-tooltip
kb- May 20, 2024
11e47c6
Demo
kb- May 20, 2024
653e666
Update various.html
kb- May 20, 2024
2babc9b
Update various.html
kb- May 20, 2024
c84007b
Handle log axis
kb- May 20, 2024
421546e
Update various.html
kb- May 20, 2024
24586ad
Handle log axis
kb- May 20, 2024
df56bf1
Check parameters availability
kb- May 20, 2024
ca55621
Merge branch 'dev-tooltip' of plotly.js:kb-/plotly.js into dev-tooltip
kb- May 20, 2024
8196cd7
Merged src/components/modebar/buttons.js from dev-tooltip-all into de…
kb- May 22, 2024
bade5e8
Merge branch 'master'
kb- Jul 18, 2024
6fd5b10
build
kb- Jul 18, 2024
c422552
Added test mocks
kb- Jul 19, 2024
f3cbc0f
untrack dist
kb- Jul 19, 2024
643479f
Added Jasmine test
kb- Jul 24, 2024
bb296e9
linter fix
kb- Jul 26, 2024
914d88a
Merge branch 'master' into dev-tooltip
kb- Jul 28, 2024
c0ac3ed
cleanup
kb- Jul 28, 2024
5997181
Add histogram2d test mock
kb- Jul 28, 2024
ce61edc
fixed 0 value handling
kb- Jul 28, 2024
d5bfcf1
fixed multi curve histogram handling
kb- Jul 28, 2024
34c5d4a
Handle subplots
kb- Jul 28, 2024
3461a50
make default number format consistent with hover
kb- Jul 28, 2024
0e09adf
Add z to heatmap tooltip default template
kb- Jul 28, 2024
297f208
Fixed subplot handling
kb- Jul 29, 2024
b06d9e7
Fixed test
kb- Jul 29, 2024
9f1d071
generate histogram test click
kb- Aug 2, 2024
baf2d38
Change to assets click function
kb- Aug 3, 2024
96538aa
Added test on log axis plot
kb- Aug 3, 2024
2e94cf7
fixed timing
kb- Aug 3, 2024
4b87290
Test preventing second tooltip on same data point
kb- Aug 3, 2024
0edf63d
Generic default template based on data availability
kb- Aug 3, 2024
6464184
Complete attributes
kb- Aug 4, 2024
de95245
Handle multycategory
kb- Aug 7, 2024
b41160f
Merge branch 'master' into dev-tooltip
kb- Aug 10, 2024
46548c6
fix subplot handling
kb- Aug 21, 2024
0a31a8b
Added default template for category axis
kb- Aug 21, 2024
fc509f7
More test image mocks
kb- Aug 22, 2024
ffd6340
Add violin side to side handling
kb- Aug 22, 2024
022c960
Merge branch 'master' into dev-tooltip
kb- Aug 22, 2024
c1804af
Fixed test click point
kb- Aug 22, 2024
25bc3ac
handle missing axis info
kb- Aug 22, 2024
1cd0960
Added tooltip to hasGL2D
kb- Aug 22, 2024
b042ddf
Added gl2d mocks
kb- Aug 22, 2024
6fa84ce
Schema update
kb- Aug 22, 2024
0fd21bc
Blacklist mock files derived from existing blacklisted files
kb- Aug 22, 2024
5930d29
test_syntax
kb- Aug 24, 2024
28cf945
Merge branch 'master' into dev-tooltip
kb- Aug 24, 2024
273e22c
fixed attributes - plotschema pass
kb- Aug 24, 2024
645c7f6
removed circular reference
kb- Aug 26, 2024
f0d24eb
add baselines (no tooltip displayed)
kb- Aug 26, 2024
a64af96
draftlog
kb- Aug 26, 2024
79c4388
test-mock pass
kb- Aug 26, 2024
13b74a1
Implement heatmap attribute - default tooltiptemplate
kb- Aug 28, 2024
34f8f11
schema
kb- Aug 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions draftlogs/7127_add.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add a tooltip feature that can be activated by a new modebar button. It allows to add an annotation to every clicked point. [[#7127](https://github.com/plotly/plotly.js/pull/7127)]
1 change: 1 addition & 0 deletions lib/locales/cs.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module.exports = {
moduleType: 'locale',
name: 'cs',
dictionary: {
'Add Tooltip to Points': 'Přidat popisek k bodům', // components/modebar/buttons.js:694
'Autoscale': 'Auto rozsah', // components/modebar/buttons.js:139
'Box Select': 'Obdélníkový výběr', // components/modebar/buttons.js:103
'Click to enter Colorscale title': 'Klikněte pro zadání názvu barevné škály', // plots/plots.js:437
Expand Down
1 change: 1 addition & 0 deletions lib/locales/cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module.exports = {
moduleType: 'locale',
name: 'cy',
dictionary: {
'Add Tooltip to Points': 'Ychwanegu awgrymiadau i\'r pwyntiau', // components/modebar/buttons.js:694
'Autoscale': 'Graddfa awtomatig', // components / modebar / buttons.js: 150
'Box Select': 'Dewiswch â blwch', // components / modebar / buttons.js: 114
'Click to enter Colorscale title': 'Cliciwch i nodi teitl Graddfa Liw', // plots / plots.js: 327
Expand Down
1 change: 1 addition & 0 deletions lib/locales/de.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module.exports = {
moduleType: 'locale',
name: 'de',
dictionary: {
'Add Tooltip to Points': 'Tooltip zu Punkten hinzufügen', // components/modebar/buttons.js:694
'Autoscale': 'Automatische Skalierung', // components/modebar/buttons.js:139
'Box Select': 'Rechteckauswahl', // components/modebar/buttons.js:103
'Click to enter Colorscale title': 'Klicken, um den Farbskalatitel einzugeben', // plots/plots.js:437
Expand Down
1 change: 1 addition & 0 deletions lib/locales/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module.exports = {
moduleType: 'locale',
name: 'es',
dictionary: {
'Add Tooltip to Points': 'Agregar tooltip a los puntos', // components/modebar/buttons.js:694
'Autoscale': 'Autoescalar', // components/modebar/buttons.js:139
'Box Select': 'Seleccionar Caja', // components/modebar/buttons.js:103
'Click to enter Colorscale title': 'Introducir el título de la Escala de Color', // plots/plots.js:303
Expand Down
1 change: 1 addition & 0 deletions lib/locales/fi.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module.exports = {
moduleType: 'locale',
name: 'fi',
dictionary: {
'Add Tooltip to Points': 'Lisää tooltip pisteisiin',
'Autoscale': 'Autoskaalaa',
'Box Select': 'Laatikkovalinta',
'Click to enter Colorscale title': 'Klikkaa antaaksesi väriskaalan otsikko',
Expand Down
1 change: 1 addition & 0 deletions lib/locales/fr.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module.exports = {
moduleType: 'locale',
name: 'fr',
dictionary: {
'Add Tooltip to Points': 'Ajouter une info-bulle aux points',
'Autoscale': 'Échelle automatique',
'Box Select': 'Sélection rectangulaire',
'Click to enter Colorscale title': 'Ajouter un titre à l\'échelle de couleurs',
Expand Down
1 change: 1 addition & 0 deletions lib/locales/hr.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module.exports = {
moduleType: 'locale',
name: 'hr',
dictionary: {
'Add Tooltip to Points': 'Dodajte bilješku točkama',
'Autoscale': 'Automatsko skaliranje',
'Box Select': 'Pravokutni odabir',
'Click to enter Colorscale title': 'Kliknite za unos Colorscale naziva',
Expand Down
1 change: 1 addition & 0 deletions lib/locales/it.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module.exports = {
moduleType: 'locale',
name: 'it',
dictionary: {
'Add Tooltip to Points': 'Aggiungi tooltip ai punti', // components/modebar/buttons.js:694
'Autoscale': 'Scala automaticamente', // components/modebar/buttons.js:139
'Box Select': 'Selezione box', // components/modebar/buttons.js:103
'Click to enter Colorscale title': 'Clicca per inserire un titolo alla scala di colori', // plots/plots.js:437
Expand Down
1 change: 1 addition & 0 deletions lib/locales/ja.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module.exports = {
moduleType: 'locale',
name: 'ja',
dictionary: {
'Add Tooltip to Points': 'ポイントにツールチップを追加', // components/modebar/buttons.js:694
'Autoscale': '自動ズーム', // components/modebar/buttons.js:139
'Box Select': '矩形選択', // components/modebar/buttons.js:103
'Click to enter Colorscale title': '色スケールタイトルを入力するにはクリック', // plots/plots.js:437
Expand Down
1 change: 1 addition & 0 deletions lib/locales/ko.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module.exports = {
moduleType: 'locale',
name: 'ko',
dictionary: {
'Add Tooltip to Points': '포인트에 툴팁 추가',
'Autoscale': '자동 크기지정',
'Box Select': '박스 선택',
'Click to enter Colorscale title': 'Colorscale 제목을 지정하려면 클릭하세요',
Expand Down
1 change: 1 addition & 0 deletions lib/locales/nl.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module.exports = {
moduleType: 'locale',
name: 'nl',
dictionary: {
'Add Tooltip to Points': 'Tooltip aan punten toevoegen',
'Autoscale': 'Automatische schaal',
'Click to enter Colorscale title': 'Klik om kleurenschaal titel in te vullen',
'Click to enter Component A title': 'Klik om Component A titel in te vullen',
Expand Down
1 change: 1 addition & 0 deletions lib/locales/no.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module.exports = {
moduleType: 'locale',
name: 'no',
dictionary: {
'Add Tooltip to Points': 'Legg til verktøytips til punkter', // components/modebar/buttons.js:694
'Autoscale': 'Autoskalere', // components/modebar/buttons.js:148
'Box Select': 'Velg rektangel', // components/modebar/buttons.js:112
'Click to enter Colorscale title': 'Klikk for å oppgi tittel på fargeskala', // plots/plots.js:326
Expand Down
1 change: 1 addition & 0 deletions lib/locales/pt-br.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module.exports = {
moduleType: 'locale',
name: 'pt-BR',
dictionary: {
'Add Tooltip to Points': 'Adicionar tooltip aos pontos',
'Autoscale': 'Escala automática',
'Box Select': 'Seleção retangular',
'Click to enter Colorscale title': 'Clique para editar o título da escala de cor',
Expand Down
1 change: 1 addition & 0 deletions lib/locales/pt-pt.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module.exports = {
moduleType: 'locale',
name: 'pt-PT',
dictionary: {
'Add Tooltip to Points': 'Adicionar tooltip aos pontos',
'Autoscale': 'Escala automática',
'Box Select': 'Seleção retangular',
'Click to enter Colorscale title': 'Clique para editar o título da escala de cor',
Expand Down
1 change: 1 addition & 0 deletions lib/locales/ru.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module.exports = {
moduleType: 'locale',
name: 'ru',
dictionary: {
'Add Tooltip to Points': 'Добавить подсказку к точкам',
'Autoscale': 'Автоматическое шкалирование',
'Box Select': 'Выделение прямоугольной области',
'Click to enter Colorscale title': 'Нажмите для ввода названия цветовой шкалы',
Expand Down
1 change: 1 addition & 0 deletions lib/locales/si.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/locales/sk.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module.exports = {
moduleType: 'locale',
name: 'sk',
dictionary: {
'Add Tooltip to Points': 'Pridať tooltip k bodom', // components/modebar/buttons.js:694
'Autoscale': 'Auto rozsah', // components/modebar/buttons.js:139
'Box Select': 'Obdĺžnikový výber', // components/modebar/buttons.js:103
'Click to enter Colorscale title': 'Kliknite pre zadanie názvu farebnej škály', // plots/plots.js:437
Expand Down
1 change: 1 addition & 0 deletions lib/locales/sv.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module.exports = {
moduleType: 'locale',
name: 'sv',
dictionary: {
'Add Tooltip to Points': 'Lägg till verktygstips till punkter', // components/modebar/buttons.js:694
'Autoscale': 'Autoskala', // components/modebar/buttons.js:148
'Box Select': 'Välj rektangel', // components/modebar/buttons.js:112
'Click to enter Colorscale title': 'Klicka för att ange titel på färgskala', // plots/plots.js:326
Expand Down
1 change: 1 addition & 0 deletions lib/locales/sw.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module.exports = {
moduleType: 'locale',
name: 'sw',
dictionary: {
'Add Tooltip to Points': 'Ongeza tooltip kwa pointi',
'Autoscale': 'Kigezo - otomatiki',
'Box Select': 'Teua kisanduku',
'Click to enter Colorscale title': 'Bonyeza kuandika kichwa cha Colorscale',
Expand Down
1 change: 1 addition & 0 deletions lib/locales/uk.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module.exports = {
moduleType: 'locale',
name: 'uk',
dictionary: {
'Add Tooltip to Points': 'Додати підказку до точок',
'Autoscale': 'Автоматичне шкалювання',
'Box Select': 'Виділення прямокутної області',
'Click to enter Colorscale title': 'Натисніть для введення назви шкали кольору',
Expand Down
1 change: 1 addition & 0 deletions lib/locales/zh-cn.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module.exports = {
moduleType: 'locale',
name: 'zh-CN',
dictionary: {
'Add Tooltip to Points': '将工具提示添加到点', // components/modebar/buttons.js:694
'Autoscale': '自动缩放', // components/modebar/buttons.js:139
'Box Select': '矩形框选',
'Click to enter Colorscale title': '点击输入色阶的标题', // plots/plots.js:437
Expand Down
1 change: 1 addition & 0 deletions lib/locales/zh-tw.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module.exports = {
moduleType: 'locale',
name: 'zh-TW',
dictionary: {
'Add Tooltip to Points': '將工具提示添加到點', // components/modebar/buttons.js:694
'Autoscale': '自動縮放', // components/modebar/buttons.js:139
'Box Select': '矩形選擇', // components/modebar/buttons.js:103
'Click to enter Colorscale title': '點擊以輸入色階標題', // plots/plots.js:437
Expand Down
174 changes: 174 additions & 0 deletions src/components/modebar/buttons.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ var Icons = require('../../fonts/ploticon');
var eraseActiveShape = require('../shapes/draw').eraseActiveShape;
var Lib = require('../../lib');
var _ = Lib._;
var lodash = require('lodash'); // Import lodash, not using default _

var modeBarButtons = module.exports = {};

Expand Down Expand Up @@ -671,6 +672,179 @@ modeBarButtons.toggleSpikelines = {
}
};

// Define default template and style
var DEFAULT_TEMPLATES = {
date_x: '%{x|%Y-%m-%d}', // xaxis.type == "date"
date_y: '%{y|%Y-%m-%d}',
multicategory_x: '%{x}', // xaxis.type == "multicategory"
multicategory_y: '%{y}',
category_x: '%{x}', // xaxis.type == "category"
category_y: '%{y}',
x: 'x: %{x:.4~g}',
y: 'y: %{y:.4~g}',
// z: 'z: %{z:.4~g}',
z: 'z: %{z}',
open: 'open: %{open:.2f}',
high: 'high: %{high:.2f}',
low: 'low: %{low:.2f}',
close: 'close: %{close:.2f}'
};

var DEFAULT_STYLE = {
align: 'left',
arrowcolor: 'black',
arrowhead: 3,
arrowsize: 1.8,
arrowwidth: 1,
font: {
color: 'black',
family: 'Arial',
size: 12
},
showarrow: true,
xanchor: 'left'
};

modeBarButtons.tooltip = {
name: 'tooltip',
title: function(gd) { return _(gd, 'Add Tooltip to Points'); },
icon: Icons.tooltip_annotate,
attr: '_tooltipEnabled',
val: 'on',
click: function(gd) {
var fullLayout = gd._fullLayout;
var tooltipEnabled = fullLayout._tooltipEnabled;

fullLayout._tooltipEnabled = tooltipEnabled === 'on' ? 'off' : 'on';

if(fullLayout._tooltipEnabled === 'on') {
gd._tooltipClickHandler = function(data) {
var traceIndex = data.points[0].curveNumber;
var trace = gd.data[traceIndex];
var pts = data.points[0];

// handle missing axis in data.points[0] (in scattercarpet)
if(pts.xaxis === undefined) pts.xaxis = fullLayout.xaxis;
if(pts.yaxis === undefined) pts.yaxis = fullLayout.yaxis;

// Build the default tooltip template dynamically based on available data fields
var defaultTemplateParts = [];
var xAxisType = pts.xaxis.type;
var yAxisType = pts.yaxis.type;
if(pts.x !== undefined) defaultTemplateParts.push(DEFAULT_TEMPLATES.hasOwnProperty(xAxisType + '_x') ? DEFAULT_TEMPLATES[xAxisType + '_x'] : DEFAULT_TEMPLATES.x);
if(pts.y !== undefined) defaultTemplateParts.push(DEFAULT_TEMPLATES.hasOwnProperty(yAxisType + '_y') ? DEFAULT_TEMPLATES[yAxisType + '_y'] : DEFAULT_TEMPLATES.y);
if(pts.z !== undefined) defaultTemplateParts.push(DEFAULT_TEMPLATES.z);
// ohlc
if(pts.open !== undefined) defaultTemplateParts.push(DEFAULT_TEMPLATES.open);
if(pts.high !== undefined) defaultTemplateParts.push(DEFAULT_TEMPLATES.high);
if(pts.low !== undefined) defaultTemplateParts.push(DEFAULT_TEMPLATES.low);
if(pts.close !== undefined) defaultTemplateParts.push(DEFAULT_TEMPLATES.close);
// not consistent:
// box: missing max, upper fence... in data.points[0]

var defaultTemplate = defaultTemplateParts.join('<br>');

var userTemplate = trace.tooltiptemplate || gd._fullData[traceIndex].tooltiptemplate || defaultTemplate; // Use user defined tooltiptemplate, or trace default if availabe
var customStyle = lodash.defaults({}, trace.tooltip, DEFAULT_STYLE); // Merge custom style with default
addTooltip(gd, data, userTemplate, customStyle);
};
gd.on('plotly_click', gd._tooltipClickHandler);
} else {
gd.removeListener('plotly_click', gd._tooltipClickHandler);
}

if(!gd._relayoutHandlerAdded) {
gd._relayoutHandlerAdded = true;
gd.on('plotly_relayout', function(eventData) {
removeEmptyAnnotations(gd, eventData);
});
}
}
};

function clickPointToCoord(gd, data) {
var pts = data.points[0];
var xaxis = pts.xaxis;
var yaxis = pts.yaxis;
var bb = data.event.target.getBoundingClientRect();

// pixel to Cartesian coordinates
var x = xaxis.p2c(data.event.clientX - bb.left);
var y = yaxis.p2c(data.event.clientY - bb.top);

return {x: x, y: y};
}

function addTooltip(gd, data, userTemplate, customStyle) {
var pts = data.points[0];
var fullLayout = gd._fullLayout;

if(pts && pts.xaxis && pts.yaxis && fullLayout) {
// Convert template to text using Plotly hovertemplate formatting method
var text = Lib.hovertemplateString(userTemplate, {}, fullLayout._d3locale, pts, {});

var x = pts.x;
var y = (pts.y !== undefined && pts.y !== null) ? pts.y : pts.high; // fallback value for candlestick etc

// Handle histogram with more than one curve (bars displayed side to side)
// This ensures the tooltip is on the clicked bar and not always on the middle bar
if(pts.fullData && ['histogram', 'box', 'violin'].includes(pts.fullData.type) && fullLayout._dataLength) {
var clickCoord = clickPointToCoord(gd, data);
if(pts.fullData.orientation === 'v') {
x = clickCoord.x;
}
if(pts.fullData.orientation === 'h') {
y = clickCoord.y;
}
}

// Retrieve the proper axis ids for xref and yref
var xAxisName = 'x' + (pts.xaxis._id !== 'x' ? pts.xaxis._id.replace('x', '') : '');
var yAxisName = 'y' + (pts.yaxis._id !== 'y' ? pts.yaxis._id.replace('y', '') : '');

var newAnnotation = {
// Handle log axis https://plotly.com/javascript/text-and-annotations/#annotations-with-log-axes
x: pts.xaxis.type === 'log' ? Math.log10(x) : x,
y: pts.yaxis.type === 'log' ? Math.log10(y) : y,
xref: xAxisName,
yref: yAxisName,
text: text,
showarrow: true,
ax: 5,
ay: -20
};

lodash.defaults(newAnnotation, customStyle);

// Prevent having multiple tooltip annotations on the same point (useful when user wants to annotate nearby points)
// Does not prevent multiple tooltips on histogram (would not be useful on bars)
var existingIndex = fullLayout.annotations.findIndex(function(ann) {
return ann.x === x && ann.y === y && ann.xref === xAxisName && ann.yref === yAxisName;
});

if(existingIndex === -1) {
fullLayout.annotations.push(newAnnotation);
var aObj = { annotations: fullLayout.annotations };
Registry.call('_guiRelayout', gd, aObj);
}
}
}

function removeEmptyAnnotations(gd, eventData) {
for(var key in eventData) {
if(key.includes('annotations[') && key.includes('].text')) {
var index = key.match(/annotations\[(\d+)\]\.text/)[1];
if(eventData[key] === '') {
var updatedAnnotations = gd.layout.annotations || [];
updatedAnnotations.splice(index, 1);
var aObj = { annotations: updatedAnnotations };
Registry.call('_guiRelayout', gd, aObj);
break;
}
}
}
}

function setSpikelineVisibility(gd) {
var fullLayout = gd._fullLayout;
var areSpikesOn = fullLayout._cartesianSpikesEnabled === 'on';
Expand Down
3 changes: 2 additions & 1 deletion src/components/modebar/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ var DRAW_MODES = [
];

var backButtons = [
'tooltip',
'v1hovermode',
'hoverclosest',
'hovercompare',
'togglehover',
'togglespikelines'
'togglespikelines',
].concat(DRAW_MODES);

var foreButtons = [];
Expand Down
Loading