Skip to content

Commit 8495ea4

Browse files
committed
expose fillet attribute for treemap
1 parent 35fb5b9 commit 8495ea4

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

src/traces/treemap/attributes.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,19 @@ module.exports = {
141141

142142
line: sunburstAttrs.marker.line,
143143

144-
editType: 'calc'
144+
fillet: {
145+
valType: 'number',
146+
min: 0,
147+
// max: 10, // TODO: Do we need a max?
148+
dflt: 0,
149+
editType: 'plot',
150+
description: [
151+
'Sets the rounding of corners (in px).'
152+
].join(' ')
153+
},
154+
155+
editType: 'calc',
156+
145157
},
146158
colorScaleAttrs('marker', {
147159
colorAttr: 'colors',

src/traces/treemap/defaults.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
8585
coerce('marker.pad.r', headerSize / 4);
8686
coerce('marker.pad.b', bottomText ? headerSize : headerSize / 4);
8787

88+
coerce('marker.fillet');
89+
8890
traceOut._hovered = {
8991
marker: {
9092
line: {

src/traces/treemap/plot_one.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -217,12 +217,8 @@ module.exports = function plotOne(gd, cd, element, transitionOpts, drawDescendan
217217
var dy = _y1 - _y0;
218218
if(!dx || !dy) return '';
219219

220-
var FILLET = 0; // TODO: may expose this constant
221-
222-
var r = (
223-
dx > 2 * FILLET &&
224-
dy > 2 * FILLET
225-
) ? FILLET : 0;
220+
var FILLET = trace.marker.fillet;
221+
var r = dx > 2 * FILLET && dy > 2 * FILLET ? FILLET : Math.min(dx, dy) / 2;
226222

227223
var arc = function(rx, ry) { return r ? 'a' + pos(r, r) + ' 0 0 1 ' + pos(rx, ry) : ''; };
228224

0 commit comments

Comments
 (0)