Skip to content
Merged
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
3 changes: 2 additions & 1 deletion src/legends/ramp.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {inferFontVariant} from "../axes.js";
import {createContext, create} from "../context.js";
import {map, maybeNumberChannel} from "../options.js";
import {interpolatePiecewise} from "../scales/quantitative.js";
import {applyInlineStyles, impliedString, maybeClassName} from "../style.js";
import {applyInlineStyles, impliedString, maybeClassName, offset} from "../style.js";

export function legendRamp(color, options) {
let {
Expand Down Expand Up @@ -164,6 +164,7 @@ export function legendRamp(color, options) {
.tickFormat(typeof tickFormat === "function" ? tickFormat : undefined)
.tickSize(tickSize)
.tickValues(Array.isArray(ticks) ? ticks : null)
.offset(offset)
)
.attr("font-size", null)
.attr("font-family", null)
Expand Down
6 changes: 5 additions & 1 deletion src/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ import {isNone, isNoneish, isRound, maybeColorChannel, maybeNumberChannel} from
import {keyof, number, string} from "./options.js";
import {warn} from "./warnings.js";

export const offset = (typeof window !== "undefined" ? window.devicePixelRatio > 1 : typeof it === "undefined") ? 0 : 0.5; // prettier-ignore
export let offset = typeof window === "undefined" || window.devicePixelRatio > 1 ? 0 : 0.5;

export function setOffset(o) {
offset = o;
}

let nextClipId = 0;
let nextPatternId = 0;
Expand Down
Loading
Loading