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

Display the version of plotly.js when hovering over the modebar #6077

Merged
merged 5 commits into from
Jan 13, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions draftlogs/6077_change.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Display the version of plotly.js when hovering over the modebar [[#6077](https://github.com/plotly/plotly.js/pull/6077)]
8 changes: 7 additions & 1 deletion src/components/modebar/modebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ var isNumeric = require('fast-isnumeric');

var Lib = require('../../lib');
var Icons = require('../../fonts/ploticon');
var version = require('../../version').version;

var Parser = new DOMParser();

/**
Expand Down Expand Up @@ -283,6 +285,10 @@ proto.hasButtons = function(buttons) {
return true;
};

function jsVersion(str) {
return str.replace('Plotly', 'Plotly.js') + ' (v' + version + ')';
alexcjohnson marked this conversation as resolved.
Show resolved Hide resolved
}

/**
* @return {HTMLDivElement} The logo image wrapped in a group
*/
Expand All @@ -292,7 +298,7 @@ proto.getLogo = function() {

a.href = 'https://plotly.com/';
a.target = '_blank';
a.setAttribute('data-title', Lib._(this.graphInfo, 'Produced with Plotly'));
a.setAttribute('data-title', jsVersion(Lib._(this.graphInfo, 'Produced with Plotly')));
alexcjohnson marked this conversation as resolved.
Show resolved Hide resolved
a.className = 'modebar-btn plotlyjsicon modebar-btn--logo';

a.appendChild(this.createIcon(Icons.newplotlylogo));
Expand Down