Skip to content

Fix uniformtext and enable coloraxis for sunburst and treemap as well as pathbar.textfont #4444

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 16 commits into from
Jan 6, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
10 changes: 5 additions & 5 deletions src/traces/bar/plot.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ function getXY(di, xa, ya, isHorizontal) {
return isHorizontal ? [s, p] : [p, s];
}

function transition(selection, opts, makeOnCompleteCallback) {
if(hasTransition(opts)) {
function transition(selection, fullLayout, opts, makeOnCompleteCallback) {
if(!fullLayout.uniformtext.mode && hasTransition(opts)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why? I thought you said this transitions looked fine

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They did not apply a uniform text size during and after smooth transition.

var onComplete;
if(makeOnCompleteCallback) {
onComplete = makeOnCompleteCallback();
Expand Down Expand Up @@ -212,13 +212,13 @@ function plot(gd, plotinfo, cdModule, traceLayer, opts, makeOnCompleteCallback)
y1 = fixpx(y1, y0);
}

var sel = transition(Lib.ensureSingle(bar, 'path'), opts, makeOnCompleteCallback);
var sel = transition(Lib.ensureSingle(bar, 'path'), fullLayout, opts, makeOnCompleteCallback);
sel
.style('vector-effect', 'non-scaling-stroke')
.attr('d', 'M' + x0 + ',' + y0 + 'V' + y1 + 'H' + x1 + 'V' + y0 + 'Z')
.call(Drawing.setClipUrl, plotinfo.layerClipId, gd);

if(hasTransition(opts)) {
if(!fullLayout.uniformtext.mode && hasTransition(opts)) {
var styleFns = Drawing.makePointStyleFns(trace);
Drawing.singlePointStyle(di, sel, trace, styleFns, gd);
}
Expand Down Expand Up @@ -412,7 +412,7 @@ function appendBarText(gd, plotinfo, bar, cd, i, x0, x1, y0, y1, opts, makeOnCom
recordMinTextSize(trace.type, transform, fullLayout);
calcBar.transform = transform;

transition(textSelection, opts, makeOnCompleteCallback)
transition(textSelection, fullLayout, opts, makeOnCompleteCallback)
.attr('transform', Lib.getTextTransform(transform));
}

Expand Down
4 changes: 2 additions & 2 deletions src/traces/sunburst/plot.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ exports.plot = function(gd, cdmodule, transitionOpts, makeOnCompleteCallback) {
// If transition config is provided, then it is only a partial replot and traces not
// updated are removed.
var isFullReplot = !transitionOpts;
var hasTransition = helpers.hasTransition(transitionOpts);
var hasTransition = !fullLayout.uniformtext.mode && helpers.hasTransition(transitionOpts);

clearMinTextSize('sunburst', fullLayout);

Expand Down Expand Up @@ -87,7 +87,7 @@ exports.plot = function(gd, cdmodule, transitionOpts, makeOnCompleteCallback) {

function plotOne(gd, cd, element, transitionOpts) {
var fullLayout = gd._fullLayout;
var hasTransition = helpers.hasTransition(transitionOpts);
var hasTransition = !fullLayout.uniformtext.mode && helpers.hasTransition(transitionOpts);

var gTrace = d3.select(element);
var slices = gTrace.selectAll('g.slice');
Expand Down
4 changes: 2 additions & 2 deletions src/traces/treemap/plot.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ module.exports = function(gd, cdmodule, transitionOpts, makeOnCompleteCallback)

join.order();

if(helpers.hasTransition(transitionOpts)) {
if(!fullLayout.uniformtext.mode && helpers.hasTransition(transitionOpts)) {
if(makeOnCompleteCallback) {
// If it was passed a callback to register completion, make a callback. If
// this is created, then it must be executed on completion, otherwise the
Expand Down Expand Up @@ -103,7 +103,7 @@ function plotOne(gd, cd, element, transitionOpts) {
}

var isRoot = helpers.isHierarchyRoot(entry);
var hasTransition = helpers.hasTransition(transitionOpts);
var hasTransition = !fullLayout.uniformtext.mode && helpers.hasTransition(transitionOpts);

var maxDepth = helpers.getMaxDepth(trace);
var hasVisibleDepth = function(pt) {
Expand Down