-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Contour line labels #1815
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
Contour line labels #1815
Changes from 1 commit
468ef5d
88cc33c
ee7a839
b56f4ea
d534fb2
d1e3448
b8c75c0
2f3a712
6299303
99f39f8
d518c83
27f8cfe
221b124
ca1cced
d52cfba
0f37648
62156dd
539ca22
2116a12
e1880c1
14c832e
1bbdf59
e5a2f91
cbdf795
4db549c
fb4b690
b0f9bb2
e1caa9e
0ff2dc4
f5873f1
b5a674f
1f85a6f
6c2043e
bbb9574
9495dee
7f086e0
49b8141
8934038
dbeecd0
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 |
---|---|---|
|
@@ -73,9 +73,8 @@ function plotOne(gd, plotinfo, cd) { | |
function drawClipPath(trace, t, layer, xaxis, yaxis) { | ||
var seg, xp, yp, i; | ||
// var clip = makeg(layer, 'g', 'carpetclip'); | ||
trace.clipPathId = 'clip' + trace.uid + 'carpet'; | ||
|
||
var clip = layer.select('#' + trace.clipPathId); | ||
var clip = layer.select('#' + trace._clipPathId); | ||
|
||
if(!clip.size()) { | ||
clip = layer.append('clipPath') | ||
|
@@ -96,9 +95,9 @@ function drawClipPath(trace, t, layer, xaxis, yaxis) { | |
// This could be optimized ever so slightly to avoid no-op L segments | ||
// at the corners, but it's so negligible that I don't think it's worth | ||
// the extra complexity | ||
trace.clipPathData = 'M' + segs.join('L') + 'Z'; | ||
clip.attr('id', trace.clipPathId); | ||
path.attr('d', trace.clipPathData); | ||
var clipPathData = 'M' + segs.join('L') + 'Z'; | ||
clip.attr('id', trace._clipPathId); | ||
path.attr('d', clipPathData); | ||
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. Ah, thanks for removing. I left those because I so frequently wanted to toggle over to displaying the clip path instead of using the clip path. But no good reason to keep. |
||
// .style('stroke-width', 20) | ||
// .style('vector-effect', 'non-scaling-stroke') | ||
// .style('stroke', 'black') | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
|
||
var scatterPlot = require('../scatter/plot'); | ||
var Axes = require('../../plots/cartesian/axes'); | ||
var Drawing = require('../../components/drawing'); | ||
|
||
module.exports = function plot(gd, plotinfoproxy, data) { | ||
var i, trace, node; | ||
|
@@ -37,6 +38,6 @@ module.exports = function plot(gd, plotinfoproxy, data) { | |
// separately to all scattercarpet traces, but that would require | ||
// lots of reorganization of scatter traces that is otherwise not | ||
// necessary. That makes this a potential optimization. | ||
node.attr('clip-path', 'url(#clip' + carpet.uid + 'carpet)'); | ||
Drawing.setClipUrl(node, carpet._clipPathId); | ||
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. Ha. That means carpet traces will now be functional in Angular 1.0 see #509 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. yeah, as mentioned in #1815 (comment) Tried to figure out if we have a way to enforce that... only allow |
||
} | ||
}; |
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.
@rreusser FYI - it turns out that we weren't applying the clip path to mocks that have the data trace before the carpet trace because the ID was cached during the plot step. I moved
_clipPathId
up tosupplyDefaults
to get around that. It's barely visible in the test images, but that's why they all changed (all the ones that put the data before the carpet anyway).Also two more changes in here:
_clipPathId
rather thanclipPathId
- if we're attaching something to the trace (or layout) that's not an attribute, it should either be a function or it should start with an underscore.Drawing.setClipUrl
rather than directly setting theclip-path
attribute. This is to handle pages with a<base>
tag, which is obnoxious but important if it's present - which happens most notably in angular 😑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.
Oh wow… Good catch! Yeah, I can imagine that's a subtle half-border-width-effect. 👍