Skip to content
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

the default sorting of Plot.dot didn't work with Plot.hexbin #889

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2250,8 +2250,6 @@ The following aggregation methods are supported:
* a function to be passed the array of values for each bin and the extent of the bin
* an object with a *reduce* method

When the hexbin transform has an *r* output channel, bins are returned in order of descending radius.

See also the [hexgrid](#hexgrid) mark.

### Custom initializers
Expand Down
3 changes: 2 additions & 1 deletion src/transforms/hexbin.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ export function hexbin(outputs = {fill: "count"}, inputs = {}) {

// Populate default values for the r and symbol options, as appropriate.
if (options.symbol === undefined) options.symbol = "hexagon";
if (options.r === undefined && !hasOutput(outputs, "r")) options.r = binWidth / 2;
if (hasOutput(outputs, "r")) options.r = []; // hint that r channel will exist (e.g., for dot to sort)
else if (options.r === undefined) options.r = binWidth / 2;

return initializer(options, (data, facets, {x: X, y: Y, z: Z, fill: F, stroke: S, symbol: Q}, scales) => {
if (X === undefined) throw new Error("missing channel: x");
Expand Down
168 changes: 84 additions & 84 deletions test/output/hexbin.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
392 changes: 196 additions & 196 deletions test/output/hexbinR.html

Large diffs are not rendered by default.

146 changes: 73 additions & 73 deletions test/output/hexbinSymbol.html

Large diffs are not rendered by default.

154 changes: 77 additions & 77 deletions test/output/hexbinZ.html

Large diffs are not rendered by default.

168 changes: 84 additions & 84 deletions test/output/hexbinZNull.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.