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
7 changes: 6 additions & 1 deletion packages/ui/client/src/components/CaseCartesian.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,12 @@ function drawDots(svg: Selection<SVGSVGElement, unknown, null, undefined>) {
g.call((horizontal ? axisBottom(scale) : axisLeft(scale)).tickSizeOuter(0))
else
g.call((horizontal ? axisBottom(scale) : axisLeft(scale)).ticks(horizontal ? 8 : 5).tickFormat(value => formatTick(value as number)).tickSizeOuter(0))
g.call(group => group.selectAll('line, path').attr('stroke', 'var(--chart-grid)'))
// NOTICE:
// d3-axis writes `font-family="sans-serif"` (and `font-size="10"`) onto the axis group on every call,
// so tick labels would render in the system sans instead of the viewer font. Drop the attribute so
// the labels inherit `font.sans` from the page. See `node_modules/d3-axis/src/axis.js:109-110` (`selection.attr("font-family", "sans-serif")`).
g.attr('font-family', null)
.call(group => group.selectAll('line, path').attr('stroke', 'var(--chart-grid)'))
.call(group => group.selectAll('text').attr('fill', 'var(--chart-text)').attr('font-size', 11))
if (axis.kind === 'category') {
const picked = props.filters.categories[axis.name]
Expand Down
5 changes: 5 additions & 0 deletions packages/ui/client/src/components/ParallelCoordinates.vue
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,12 @@ function drawLines(svg: Selection<SVGSVGElement, unknown, null, undefined>) {
return
}
const scale = scales.get(axis.name) as ScaleContinuousNumeric<number, number>
// NOTICE:
// d3-axis writes `font-family="sans-serif"` (and `font-size="10"`) onto the axis group on every call,
// so tick labels would render in the system sans instead of the viewer font. Drop the attribute so
// the labels inherit `font.sans` from the page. See `node_modules/d3-axis/src/axis.js:109-110` (`selection.attr("font-family", "sans-serif")`).
g.call(axisLeft(scale).ticks(5).tickFormat(value => formatTick(value as number)).tickSizeOuter(0))
.attr('font-family', null)
.call(axisGroup => axisGroup.selectAll('text').attr('fill', 'var(--chart-text)'))
.call(axisGroup => axisGroup.selectAll('line, path').attr('stroke', 'var(--chart-grid)'))
const brush = brushY<unknown>().extent([[-12, margin.top], [12, height - margin.bottom]]).on('brush end', (event: { selection: [number, number] | null, sourceEvent?: Event }) => {
Expand Down
5 changes: 3 additions & 2 deletions packages/ui/client/src/components/ScatterMatrix.vue
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,12 @@ function render(): void {
if (box != null && box.x === columnMetric && box.y === rowMetric)
group.call(behavior.move, [[xs(box.x0), ys(box.y1)], [xs(box.x1), ys(box.y0)]])
// Ticks only along the outer edge, so the cells stay readable.
// NOTICE: d3-axis sets `font-family="sans-serif"` on each axis group; removing it lets the ticks inherit the viewer font.
if (column === 0) {
g.append('g').attr('transform', `translate(${pad - 3},0)`).call(axisLeft(ys).ticks(3).tickFormat(value => formatTick(value as number)).tickSize(3)).call(axisGroup => axisGroup.select('.domain').remove()).call(axisGroup => axisGroup.selectAll('text').attr('fill', 'var(--chart-text)'))
g.append('g').attr('transform', `translate(${pad - 3},0)`).call(axisLeft(ys).ticks(3).tickFormat(value => formatTick(value as number)).tickSize(3)).attr('font-family', null).call(axisGroup => axisGroup.select('.domain').remove()).call(axisGroup => axisGroup.selectAll('text').attr('fill', 'var(--chart-text)'))
}
if (row === count - 1) {
g.append('g').attr('transform', `translate(0,${cell - pad + 3})`).call(axisBottom(xs).ticks(3).tickFormat(value => formatTick(value as number)).tickSize(3)).call(axisGroup => axisGroup.select('.domain').remove()).call(axisGroup => axisGroup.selectAll('text').attr('fill', 'var(--chart-text)'))
g.append('g').attr('transform', `translate(0,${cell - pad + 3})`).call(axisBottom(xs).ticks(3).tickFormat(value => formatTick(value as number)).tickSize(3)).attr('font-family', null).call(axisGroup => axisGroup.select('.domain').remove()).call(axisGroup => axisGroup.selectAll('text').attr('fill', 'var(--chart-text)'))
}
}))
paint()
Expand Down
Loading