Skip to content

Commit

Permalink
Merge pull request finos#2698 from finos/highlight-zero-axis
Browse files Browse the repository at this point in the history
Draw 0 axis prominently
  • Loading branch information
texodus authored Aug 4, 2024
2 parents 012c403 + 4a60aa0 commit 9a07402
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 9a07402

Please sign in to comment.