Skip to content

Commit fe36e50

Browse files
committed
Make axis <path> elements color be currentColor
1 parent 39511d4 commit fe36e50

11 files changed

+57
-9
lines changed

src/chart.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ export class Chart extends EventEmitter.EventEmitter {
513513
.enter()
514514
.append('path')
515515
.attr('class', 'y origin')
516-
.attr('stroke', 'black')
516+
.attr('stroke', 'currentColor')
517517
.attr('opacity', 0.2)
518518
yOrigin.merge(yOriginEnter).attr('d', this.line)
519519
}
@@ -533,7 +533,7 @@ export class Chart extends EventEmitter.EventEmitter {
533533
.enter()
534534
.append('path')
535535
.attr('class', 'x origin')
536-
.attr('stroke', 'black')
536+
.attr('stroke', 'currentColor')
537537
.attr('opacity', 0.2)
538538
xOrigin.merge(xOriginEnter).attr('d', this.line)
539539
}
@@ -674,12 +674,7 @@ export class Chart extends EventEmitter.EventEmitter {
674674
canvas.selectAll('.y.axis path, .y.axis line').attr('transform', 'translate(' + -xTranslation + ',0)')
675675
}
676676

677-
canvas
678-
.selectAll('.axis path, .axis line')
679-
.attr('fill', 'none')
680-
.attr('stroke', 'black')
681-
.attr('shape-rendering', 'crispedges')
682-
.attr('opacity', 0.1)
677+
canvas.selectAll('.axis path, .axis line').attr('stroke', 'currentColor').attr('opacity', 0.2)
683678
}
684679

685680
private syncOptions() {

src/datum-defaults.test.ts

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import { describe, expect, it } from '@jest/globals'
2+
import { FunctionPlotDatum } from './types.js'
3+
import datumDefaults from '../src/datum-defaults.js'
4+
5+
describe('datumDefaults', () => {
6+
it('should assign a random ID if one is not provided', () => {
7+
const datum: FunctionPlotDatum = {}
8+
const result = datumDefaults(datum)
9+
expect(result.id).toBeDefined()
10+
})
11+
12+
it('should default graphType to "interval" if not provided', () => {
13+
const datum: FunctionPlotDatum = {}
14+
const result = datumDefaults(datum)
15+
expect(result.graphType).toBe('interval')
16+
})
17+
18+
it('should default sampler to "builtIn" if graphType is not "interval"', () => {
19+
const datum: FunctionPlotDatum = { graphType: 'polyline' }
20+
const result = datumDefaults(datum)
21+
expect(result.sampler).toBe('builtIn')
22+
})
23+
24+
it('should default sampler to "interval" if graphType is "interval"', () => {
25+
const datum: FunctionPlotDatum = { graphType: 'interval' }
26+
const result = datumDefaults(datum)
27+
expect(result.sampler).toBe('interval')
28+
})
29+
30+
it('should default fnType to "linear" if graphType is "polyline", "interval", or "scatter"', () => {
31+
let datum: FunctionPlotDatum = { graphType: 'polyline' }
32+
let result = datumDefaults(datum)
33+
expect(result.fnType).toBe('linear')
34+
35+
datum = { graphType: 'interval' }
36+
result = datumDefaults(datum)
37+
expect(result.fnType).toBe('linear')
38+
39+
datum = { graphType: 'scatter' }
40+
result = datumDefaults(datum)
41+
expect(result.fnType).toBe('linear')
42+
})
43+
44+
it('should not modify the datum if all defaults are already set', () => {
45+
const datum: FunctionPlotDatum = {
46+
id: 'test',
47+
graphType: 'polyline',
48+
sampler: 'builtIn',
49+
fnType: 'linear'
50+
}
51+
const result = datumDefaults(datum)
52+
expect(result).toEqual(datum)
53+
})
54+
})

src/samplers/interval.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import { SamplerParams, IntervalSamplerResult, IntervalSamplerResultGroup, Sampl
1212

1313
async function asyncInterval1d({
1414
d,
15-
xAxis,
1615
range,
1716
nSamples,
1817
nGroups,
61 Bytes
Loading
-43 Bytes
Loading
-40 Bytes
Loading
-78 Bytes
Loading
-48 Bytes
Loading
246 Bytes
Loading
-43 Bytes
Loading

0 commit comments

Comments
 (0)