Skip to content
Draft
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
4 changes: 2 additions & 2 deletions src/marks/hexgrid.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {create} from "../context.js";
import {Mark} from "../mark.js";
import {number, singleton} from "../options.js";
import {applyChannelStyles, applyDirectStyles, applyIndirectStyles, applyTransform, offset} from "../style.js";
import {applyChannelStyles, applyDirectStyles, applyIndirectStyles, applyTransform} from "../style.js";
import {sqrt4_3} from "../symbol.js";
import {ox, oy} from "../transforms/hexbin.js";

Expand Down Expand Up @@ -47,7 +47,7 @@ export class Hexgrid extends Mark {
return create("svg:g", context)
.datum(0)
.call(applyIndirectStyles, this, dimensions, context)
.call(applyTransform, this, {}, offset + ox, offset + oy)
.call(applyTransform, this, {}, ox, oy)
.call((g) => g.append("path").call(applyDirectStyles, this).call(applyChannelStyles, this, channels).attr("d", d))
.node();
}
Expand Down
5 changes: 3 additions & 2 deletions src/transforms/hexbin.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {map, number, valueof} from "../options.js";
import {applyPosition} from "../projection.js";
import {offset} from "../style.js";
import {sqrt3} from "../symbol.js";
import {initializer} from "./basic.js";
import {hasOutput, maybeGroup, maybeGroupOutputs, maybeSubgroup} from "./group.js";
Expand All @@ -9,8 +10,8 @@ import {hasOutput, maybeGroup, maybeGroupOutputs, maybeSubgroup} from "./group.j
// to be rounded up into a floating bin to the right of the plot. Therefore,
// rather than centering the origin hexagon around ⟨0,0⟩ in screen coordinates,
// we offset slightly to ⟨0.5,0⟩. The hexgrid mark uses the same origin.
export const ox = 0.5,
oy = 0;
export const ox = 0.5 - offset;
export const oy = -offset;

export function hexbin(outputs = {fill: "count"}, {binWidth, ...options} = {}) {
const {z} = options;
Expand Down
466 changes: 233 additions & 233 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.
466 changes: 233 additions & 233 deletions test/output/hexbinFillX.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
706 changes: 353 additions & 353 deletions test/output/hexbinIdentityReduce.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
354 changes: 177 additions & 177 deletions test/output/hexbinR.html

Large diffs are not rendered by default.

582 changes: 291 additions & 291 deletions test/output/hexbinText.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
404 changes: 202 additions & 202 deletions test/output/hexbinZ.html

Large diffs are not rendered by default.

452 changes: 226 additions & 226 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.