-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Cartesian dropline support #1461
Changes from all commits
d9fab15
5d39b53
be47533
17d815c
162068e
762b54a
d680bd4
2433d4c
75da2fe
7953488
55b17b2
b9f6ab1
7fe4363
34a1562
8c7ac76
6e243de
c036bf7
08371c2
69dc781
37b77fe
710d2d6
e509fa7
75121d2
bd11567
3a9aa58
052417b
a3a0a4f
f7b467e
7aa4359
5925049
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* Copyright 2012-2017, Plotly, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
|
||
'use strict'; | ||
|
||
exports.dash = { | ||
valType: 'string', | ||
// string type usually doesn't take values... this one should really be | ||
// a special type or at least a special coercion function, from the GUI | ||
// you only get these values but elsewhere the user can supply a list of | ||
// dash lengths in px, and it will be honored | ||
values: ['solid', 'dot', 'dash', 'longdash', 'dashdot', 'longdashdot'], | ||
dflt: 'solid', | ||
role: 'style', | ||
description: [ | ||
'Sets the dash style of lines. Set to a dash type string', | ||
'(*solid*, *dot*, *dash*, *longdash*, *dashdot*, or *longdashdot*)', | ||
'or a dash length list in px (eg *5px,10px,2px,2px*).' | ||
].join(' ') | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -149,7 +149,7 @@ proto.createButton = function(config) { | |
button.setAttribute('data-toggle', config.toggle || false); | ||
if(config.toggle) d3.select(button).classed('active', true); | ||
|
||
button.appendChild(this.createIcon(config.icon || Icons.question)); | ||
button.appendChild(this.createIcon(config.icon || Icons.question, config.name)); | ||
button.setAttribute('data-gravity', config.gravity || 'n'); | ||
|
||
return button; | ||
|
@@ -162,7 +162,7 @@ proto.createButton = function(config) { | |
* @Param {string} thisIcon.path | ||
* @Return {HTMLelement} | ||
*/ | ||
proto.createIcon = function(thisIcon) { | ||
proto.createIcon = function(thisIcon, name) { | ||
var iconHeight = thisIcon.ascent - thisIcon.descent, | ||
svgNS = 'http://www.w3.org/2000/svg', | ||
icon = document.createElementNS(svgNS, 'svg'), | ||
|
@@ -172,8 +172,12 @@ proto.createIcon = function(thisIcon) { | |
icon.setAttribute('width', (thisIcon.width / iconHeight) + 'em'); | ||
icon.setAttribute('viewBox', [0, 0, thisIcon.width, iconHeight].join(' ')); | ||
|
||
var transform = name === 'toggleSpikelines' ? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A little hacky here. Ideally, the icon should have been exported 50% bigger. I opted for this hacky fix because implementing some icon There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that was me. Grab my latest commit. |
||
'matrix(1.5 0 0 -1.5 0 ' + thisIcon.ascent + ')' : | ||
'matrix(1 0 0 -1 0 ' + thisIcon.ascent + ')'; | ||
|
||
path.setAttribute('d', thisIcon.path); | ||
path.setAttribute('transform', 'matrix(1 0 0 -1 0 ' + thisIcon.ascent + ')'); | ||
path.setAttribute('transform', transform); | ||
icon.appendChild(path); | ||
|
||
return icon; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -153,6 +153,9 @@ Plotly.plot = function(gd, data, layout, config) { | |
makePlotFramework(gd); | ||
} | ||
|
||
// save initial show spikes once per graph | ||
if(graphWasEmpty) Plotly.Axes.saveShowSpikeInitial(gd); | ||
|
||
// prepare the data and find the autorange | ||
|
||
// generate calcdata, if we need to | ||
|
@@ -2121,14 +2124,16 @@ function _relayout(gd, aobj) { | |
flags.doticks = flags.dolayoutstyle = true; | ||
} | ||
/* | ||
* hovermode and dragmode don't need any redrawing, since they just | ||
* affect reaction to user input, everything else, assume full replot. | ||
* hovermode, dragmode, and spikes don't need any redrawing, since they just | ||
* affect reaction to user input. Everything else, assume full replot. | ||
* height, width, autosize get dealt with below. Except for the case of | ||
* of subplots - scenes - which require scene.updateFx to be called. | ||
*/ | ||
else if(['hovermode', 'dragmode'].indexOf(ai) !== -1) flags.domodebar = true; | ||
else if(['hovermode', 'dragmode', 'height', | ||
'width', 'autosize'].indexOf(ai) === -1) { | ||
else if(['hovermode', 'dragmode'].indexOf(ai) !== -1 || | ||
ai.indexOf('spike') !== -1) { | ||
flags.domodebar = true; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🐎 |
||
} | ||
else if(['height', 'width', 'autosize'].indexOf(ai) === -1) { | ||
flags.doplot = true; | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally, I think I'd prefer placing this new icon first from the right. Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My reasoning was to put it beside
hovermode: closest
because of how spikeline functionality is tied to that mode. (Needed for any spikelines, and using the toggle will force you into that mode)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. I'm ok leaving it there.