Skip to content

Commit 75da2fe

Browse files
committed
add spikeline icon
1 parent 2433d4c commit 75da2fe

File tree

4 files changed

+16
-5
lines changed

4 files changed

+16
-5
lines changed

build/ploticon.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,5 +114,11 @@ module.exports = {
114114
'path': 'm0 850l0-143 143 0 0 143-143 0z m286 0l0-143 143 0 0 143-143 0z m285 0l0-143 143 0 0 143-143 0z m286 0l0-143 143 0 0 143-143 0z m-857-286l0-143 143 0 0 143-143 0z m857 0l0-143 143 0 0 143-143 0z m-857-285l0-143 143 0 0 143-143 0z m857 0l0-143 143 0 0 143-143 0z m-857-286l0-143 143 0 0 143-143 0z m286 0l0-143 143 0 0 143-143 0z m285 0l0-143 143 0 0 143-143 0z m286 0l0-143 143 0 0 143-143 0z',
115115
'ascent': 850,
116116
'descent': -150
117+
},
118+
'spikeline': {
119+
'width': 1000,
120+
'path': 'M512 409c0-57-46-104-103-104-57 0-104 47-104 104 0 57 47 103 104 103 57 0 103-46 103-103z m-327-39l92 0 0 92-92 0z m-185 0l92 0 0 92-92 0z m370-186l92 0 0 93-92 0z m0-184l92 0 0 92-92 0z',
121+
'ascent': 850,
122+
'descent': -150
117123
}
118124
};

src/components/modebar/buttons.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ modeBarButtons.resetViews = {
543543
modeBarButtons.toggleSpikelines = {
544544
name: 'toggleSpikelines',
545545
title: 'Toggle Spike Lines',
546-
icon: Icons.home,
546+
icon: Icons.spikeline,
547547
attr: '_cartesianSpikesEnabled',
548548
val: 'on',
549549
click: function(gd) {

src/components/modebar/modebar.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ proto.createButton = function(config) {
149149
button.setAttribute('data-toggle', config.toggle || false);
150150
if(config.toggle) d3.select(button).classed('active', true);
151151

152-
button.appendChild(this.createIcon(config.icon || Icons.question));
152+
button.appendChild(this.createIcon(config.icon || Icons.question, config.name));
153153
button.setAttribute('data-gravity', config.gravity || 'n');
154154

155155
return button;
@@ -162,7 +162,7 @@ proto.createButton = function(config) {
162162
* @Param {string} thisIcon.path
163163
* @Return {HTMLelement}
164164
*/
165-
proto.createIcon = function(thisIcon) {
165+
proto.createIcon = function(thisIcon, name) {
166166
var iconHeight = thisIcon.ascent - thisIcon.descent,
167167
svgNS = 'http://www.w3.org/2000/svg',
168168
icon = document.createElementNS(svgNS, 'svg'),
@@ -172,8 +172,12 @@ proto.createIcon = function(thisIcon) {
172172
icon.setAttribute('width', (thisIcon.width / iconHeight) + 'em');
173173
icon.setAttribute('viewBox', [0, 0, thisIcon.width, iconHeight].join(' '));
174174

175+
var transform = name === 'toggleSpikelines' ?
176+
'matrix(1.5 0 0 -1.5 0 ' + thisIcon.ascent + ')' :
177+
'matrix(1 0 0 -1 0 ' + thisIcon.ascent + ')';
178+
175179
path.setAttribute('d', thisIcon.path);
176-
path.setAttribute('transform', 'matrix(1 0 0 -1 0 ' + thisIcon.ascent + ')');
180+
path.setAttribute('transform', transform);
177181
icon.appendChild(path);
178182

179183
return icon;

src/fonts/ploticon/ploticon.svg

Lines changed: 2 additions & 1 deletion
Loading

0 commit comments

Comments
 (0)