Skip to content

Commit bf97aa1

Browse files
committed
increase contour label area from left and right and decrease from top and bottom
1 parent f5f4d62 commit bf97aa1

15 files changed

+5
-9
lines changed

src/traces/contour/constants.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,5 @@ module.exports = {
7272
INITIALSEARCHPOINTS: 10,
7373
// number of binary search iterations after the initial wide search
7474
ITERATIONS: 5
75-
},
76-
77-
// number of px around labels text clip out of contour lines below
78-
LABEL_LINE_CLIP_PAD_X: 2
75+
}
7976
};

src/traces/contour/plot.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ var convertToConstraints = require('./convert_to_constraints');
2626
var closeBoundaries = require('./close_boundaries');
2727
var constants = require('./constants');
2828
var costConstants = constants.LABELOPTIMIZER;
29-
var LABEL_LINE_CLIP_PAD_X = constants.LABEL_LINE_CLIP_PAD_X;
3029

3130
exports.plot = function plot(gd, plotinfo, cdcontours, contourLayer) {
3231
var xa = plotinfo.xaxis;
@@ -544,8 +543,8 @@ function locationCost(loc, textOpts, labelData, bounds) {
544543
}
545544

546545
exports.addLabelData = function(loc, textOpts, labelData, labelClipPathData) {
547-
var w = textOpts.width + 2 * LABEL_LINE_CLIP_PAD_X;
548-
var h = textOpts.height;
546+
var w = textOpts.width + 4;
547+
var h = Math.max(0, textOpts.height - 4);
549548

550549
var x = loc.x;
551550
var y = loc.y;
@@ -575,8 +574,8 @@ exports.addLabelData = function(loc, textOpts, labelData, labelClipPathData) {
575574
dy: textOpts.dy,
576575
theta: theta,
577576
level: textOpts.level,
578-
width: textOpts.width,
579-
height: textOpts.height
577+
width: w,
578+
height: h
580579
});
581580

582581
labelClipPathData.push(bBoxPts);
-672 Bytes
Loading
34 Bytes
Loading
Loading
15 Bytes
Loading
Loading
Loading
-211 Bytes
Loading
Loading
182 Bytes
Loading
855 Bytes
Loading
40 Bytes
Loading
-116 Bytes
Loading
2.15 KB
Loading

0 commit comments

Comments
 (0)