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
11 changes: 3 additions & 8 deletions src/chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ export class Chart extends EventEmitter.EventEmitter {
.enter()
.append('path')
.attr('class', 'y origin')
.attr('stroke', 'black')
.attr('stroke', 'currentColor')
.attr('opacity', 0.2)
yOrigin.merge(yOriginEnter).attr('d', this.line)
}
Expand All @@ -533,7 +533,7 @@ export class Chart extends EventEmitter.EventEmitter {
.enter()
.append('path')
.attr('class', 'x origin')
.attr('stroke', 'black')
.attr('stroke', 'currentColor')
.attr('opacity', 0.2)
xOrigin.merge(xOriginEnter).attr('d', this.line)
}
Expand Down Expand Up @@ -674,12 +674,7 @@ export class Chart extends EventEmitter.EventEmitter {
canvas.selectAll('.y.axis path, .y.axis line').attr('transform', 'translate(' + -xTranslation + ',0)')
}

canvas
.selectAll('.axis path, .axis line')
.attr('fill', 'none')
.attr('stroke', 'black')
.attr('shape-rendering', 'crispedges')
.attr('opacity', 0.1)
canvas.selectAll('.axis path, .axis line').attr('stroke', 'currentColor').attr('opacity', 0.2)
}

private syncOptions() {
Expand Down
54 changes: 54 additions & 0 deletions src/datum-defaults.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import { describe, expect, it } from '@jest/globals'
import { FunctionPlotDatum } from './types.js'
import datumDefaults from '../src/datum-defaults.js'

describe('datumDefaults', () => {
it('should assign a random ID if one is not provided', () => {
const datum: FunctionPlotDatum = {}
const result = datumDefaults(datum)
expect(result.id).toBeDefined()
})

it('should default graphType to "interval" if not provided', () => {
const datum: FunctionPlotDatum = {}
const result = datumDefaults(datum)
expect(result.graphType).toBe('interval')
})

it('should default sampler to "builtIn" if graphType is not "interval"', () => {
const datum: FunctionPlotDatum = { graphType: 'polyline' }
const result = datumDefaults(datum)
expect(result.sampler).toBe('builtIn')
})

it('should default sampler to "interval" if graphType is "interval"', () => {
const datum: FunctionPlotDatum = { graphType: 'interval' }
const result = datumDefaults(datum)
expect(result.sampler).toBe('interval')
})

it('should default fnType to "linear" if graphType is "polyline", "interval", or "scatter"', () => {
let datum: FunctionPlotDatum = { graphType: 'polyline' }
let result = datumDefaults(datum)
expect(result.fnType).toBe('linear')

datum = { graphType: 'interval' }
result = datumDefaults(datum)
expect(result.fnType).toBe('linear')

datum = { graphType: 'scatter' }
result = datumDefaults(datum)
expect(result.fnType).toBe('linear')
})

it('should not modify the datum if all defaults are already set', () => {
const datum: FunctionPlotDatum = {
id: 'test',
graphType: 'polyline',
sampler: 'builtIn',
fnType: 'linear'
}
const result = datumDefaults(datum)
expect(result).toEqual(datum)
})
})
1 change: 0 additions & 1 deletion src/samplers/interval.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { SamplerParams, IntervalSamplerResult, IntervalSamplerResultGroup, Sampl

async function asyncInterval1d({
d,
xAxis,
range,
nSamples,
nGroups,
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.