10000 Fix uniformtext and enable coloraxis for sunburst and treemap as well as pathbar.textfont by archmoj · Pull Request #4444 · plotly/plotly.js · GitHub
[go: up one dir, main page]

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
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
Prev Previous commit
Next Next commit
declare uniform functions on top of bar plot
  • Loading branch information
archmoj committed Dec 31, 2019
commit 599de225827c64819b9f94425998885469f8c59d
7 changes: 5 additions & 2 deletions src/traces/bar/plot.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ var Registry = require('../../registry');
var tickText = require('../../plots/cartesian/axes').tickText;

var uniformText = require('./uniform_text');
var recordMinTextSize = uniformText.recordMinTextSize;
var clearMinTextSize = uniformText.clearMinTextSize;

var style = require('./style');
var helpers = require('./helpers');
var constants = require('./constants');
Expand Down Expand Up @@ -94,7 +97,7 @@ function plot(gd, plotinfo, cdModule, traceLayer, opts, makeOnCompleteCallback)
};

// don't clear bar when this is called from waterfall or funnel
uniformText.clearMinTextSize('bar', fullLayout);
clearMinTextSize('bar', fullLayout);
Copy link
Contributor

Choose a reason for hiding this comment

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

Wait. Here you're clearing the min-text-size stash during the plot step. So what's happens when a style-only edit (e.g. Plotly.restyle(gd, 'marker.color', 'red')) gets called?

To me, this logic should probably be somewhere in the calc step.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Restyle works. Considering interactions (e.g. zoom and selection) this should be cleared after calc and at the stat of plot.

Copy link
Contributor

Choose a reason for hiding this comment

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

Considering interactions (e.g. zoom and selection) this should be cleared after calc and at the stat of plot.

Can you explain a bit more here? To me, sounds like we should not clear minTextSize during zoom interactions.

Copy link
Contributor

Choose a reason for hiding this comment

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

Or let me rephrase my question: if you do move clearMinTextSize to the calc step, do any of the tests fail?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. In that case the react tests would fail.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you share the branch you used to test that?

Copy link
Contributor

Choose a reason for hiding this comment

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

Summing up a private convo:

  • I was under the impression that the uniformtext attributes were editType: 'calc', so that's why I thought it would be best to clear the min-text-size during the calc step, but they're not. The uniformtext attributes are editType: 'plot'.
  • @archmoj says that making the uniformtext attributes editType: 'calc' would have an impact on the way graph with set uniformtext would behave on zoom
  • Since we'll need to refactor the trace text pipeline at some point (more info in Consistent text mode for bar-like & pie-like traces and feature to control text orientation inside pie/sunburst slices #4420 (comment)), let's keep the clear-min-text logic in the plot step for now.
  • The most important of this PR are the newly added tests.

}

var bartraces = Lib.makeTraceGroups(traceLayer, cdModule, 'trace bars').each(function(cd) {
Expand Down Expand Up @@ -410,7 +413,7 @@ function appendBarText(gd, plotinfo, bar, cd, i, x0, x1, y0, y1, opts, makeOnCom
}

transform.fontSize = font.size;
uniformText.recordMinTextSize(trace.type, transform, fullLayout);
recordMinTextSize(trace.type, transform, fullLayout);
calcBar.transform = transform;

transition(textSelection, fullLayout, opts, makeOnCompleteCallback)
Expand Down
0