Skip to content

Commit

Permalink
Draw 0 axis prominently
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Stein <steinlink@gmail.com>
  • Loading branch information
texodus committed Aug 4, 2024
1 parent 938c513 commit 4a60aa0
Showing 1 changed file with 23 additions and 12 deletions.
35 changes: 23 additions & 12 deletions packages/perspective-viewer-d3fc/src/ts/gridlines/gridlines.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,34 @@
import * as fc from "d3fc";
import { D3Scale, Orientation } from "../types";

const mainGridSvg = (settings) => (x) =>
const mainGridSvg = (settings) => (x, xTick) =>
x
.style("stroke-width", "1.0")
.style(
"stroke",
settings ? settings.colorStyles.grid.gridLineColor : "#bbb"
);

const mainGridCanvas = (settings) => (c) => {
c.strokeStyle = settings ? settings.colorStyles.grid.gridLineColor : "#bbb";
.style("stroke-width", (xTick) => "1.0")
.style("stroke", (xTick) => axis_color(xTick, settings));

function axis_color(xTick, settings) {
if (xTick === 0) {
if (settings) {
return settings.textStyles.color;
} else {
return "#666";
}
} else if (settings) {
return settings.colorStyles.grid.gridLineColor;
} else {
return "#bbb";
}
}

const mainGridCanvas = (settings) => (c, xTick) => {
c.strokeStyle = axis_color(xTick, settings);
c.lineWidth = 1;
};

const crossGridSvg = (x) => x.style("display", "none");
const crossGridCanvas = (settings) => (c) => {
const crossGridSvg = (x, _) => x.style("display", "none");
const crossGridCanvas = (settings) => (c, xTick) => {
c.lineWidth = 1;
c.strokeStyle = settings ? settings.colorStyles.grid.gridLineColor : "#bbb";
c.strokeStyle = axis_color(xTick, settings);
};

export interface WithGridLines {
Expand Down

0 comments on commit 4a60aa0

Please sign in to comment.