Skip to content

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

Merged
merged 39 commits into from
Jun 30, 2017
Merged
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
468ef5d
put all contour lines into one group (so we can clip it later)
alexcjohnson Jun 21, 2017
88cc33c
collect contour clipPath in the main <defs>
alexcjohnson Jun 21, 2017
ee7a839
more standard format for contour constants
alexcjohnson Jun 22, 2017
b56f4ea
move lineIntersect -> Lib.geometry2d
alexcjohnson Jun 22, 2017
d534fb2
segmentDistance and tests of geometry2d
alexcjohnson Jun 22, 2017
d1e3448
contour line label basic functionality
alexcjohnson Jun 22, 2017
b8c75c0
better test of alternate Drawing.font syntax
alexcjohnson Jun 23, 2017
2f3a712
use contour/attributes in contourcarpet/attributes
alexcjohnson Jun 23, 2017
6299303
pull path measurement routines out into Lib
alexcjohnson Jun 23, 2017
99f39f8
allow contour labels even without lines
alexcjohnson Jun 23, 2017
d518c83
simple contour label position optimization
alexcjohnson Jun 23, 2017
27f8cfe
use axis formatting for contour labels
alexcjohnson Jun 23, 2017
221b124
include label attrs in contourcarpet to avoid errors but they're noops
alexcjohnson Jun 23, 2017
ca1cced
location -> loc (window global potential confusion)
alexcjohnson Jun 26, 2017
d52cfba
scale min path length for contour labels to width + height
alexcjohnson Jun 26, 2017
0f37648
:cow2: remove obsolete regexp
alexcjohnson Jun 26, 2017
62156dd
:hocho: long-obsolete cache object
alexcjohnson Jun 27, 2017
539ca22
Drawing.bBox "inTester" mode for quicker testing of dummy elements
alexcjohnson Jun 27, 2017
2116a12
contours.font -> contours.labelfont
alexcjohnson Jun 27, 2017
e1880c1
more permissive Drawing.bBox test
alexcjohnson Jun 27, 2017
14c832e
image tests of contour labels
alexcjohnson Jun 27, 2017
1bbdf59
contour line-colored label test
alexcjohnson Jun 27, 2017
e5a2f91
use `editTypes` for contour/contourcarpet-specific attributes
alexcjohnson Jun 27, 2017
cbdf795
no editType nesting - just docalc on editing full containers
alexcjohnson Jun 27, 2017
4db549c
:hocho: obsolete import
alexcjohnson Jun 27, 2017
fb4b690
refactor contour/plot for smaller functions
alexcjohnson Jun 29, 2017
b0f9bb2
updated contour_edge_cases baseline
alexcjohnson Jun 29, 2017
e1caa9e
unify contour.style and contourcarpet.style
alexcjohnson Jun 29, 2017
0ff2dc4
cover contour edge cases with contourcarpet
alexcjohnson Jun 29, 2017
f5873f1
fix contour style when coloring=none
alexcjohnson Jun 29, 2017
b5a674f
a little more stuff contourcarpet can inherit from contour
alexcjohnson Jun 29, 2017
1f85a6f
fix carpet plot clip path
alexcjohnson Jun 30, 2017
6c2043e
:hocho: some obsolete code in carpet/plot
alexcjohnson Jun 30, 2017
bbb9574
update histogram2dcontour for contour.plot API change
alexcjohnson Jun 30, 2017
9495dee
nest scattercontour lines inside a contourlines group
alexcjohnson Jun 30, 2017
7f086e0
fixup font->labelfont in contourcarpet
alexcjohnson Jun 30, 2017
49b8141
labels on contourcarpet
alexcjohnson Jun 30, 2017
8934038
update comment on contourcarpet label bounds
alexcjohnson Jun 30, 2017
dbeecd0
update baselines for findBestTextLocation bugfix
alexcjohnson Jun 30, 2017
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
2 changes: 1 addition & 1 deletion src/traces/contour/plot.js
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ function makeLinesAndLabels(plotgroup, pathinfo, gd, cd0, contours, perimeter) {

var isOpen = d3.select(this).classed('openline');

if(pathLen < textWidth * constants.LABELMIN) return;
if(pathLen < (textWidth + textHeight) * constants.LABELMIN) return;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't increase LABELMIN, instead included both width and height of the label. That way when you have long labels you'll still get them on about the same length paths as before, but short labels will require a bit longer paths than they did previously:
screen shot 2017-06-26 at 2 34 00 pm

Note that this isn't in the cost function, because that controls label location on the path but only weakly affects whether the path gets a label at all - ie if it pushes past MAXCOST


var maxLabels = Math.min(Math.ceil(pathLen / normLength),
constants.LABELMAX);
Expand Down