Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(viz): improve domain data value handling
- add DomainValues, DomainValueFn types - update plot fns & processedPoints() to accept new types - convert uniformDomain() to HOF form - update deps & tests
- Loading branch information
1 parent
beba35f
commit ab89655
Showing
8 changed files
with
37 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,15 @@ | ||
import { map } from "@thi.ng/transducers"; | ||
import type { PlotFn } from "../api"; | ||
import type { DomainValues, PlotFn } from "../api"; | ||
import { processedPoints } from "./utils"; | ||
|
||
export interface LinePlotOpts { | ||
attribs: any; | ||
} | ||
|
||
export const linePlot = ( | ||
data: Iterable<number[]>, | ||
data: DomainValues, | ||
opts: Partial<LinePlotOpts> = {} | ||
): PlotFn => (spec) => [ | ||
"polyline", | ||
opts.attribs || {}, | ||
[...map((p) => p[0], processedPoints(spec, data))], | ||
[...processedPoints(spec, data, true)], | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
import type { PlotFn } from "../api"; | ||
import type { DomainValues, PlotFn } from "../api"; | ||
import { processedPoints } from "./utils"; | ||
|
||
export interface ScatterPlotOpts { | ||
attribs: any; | ||
} | ||
|
||
export const scatterPlot = ( | ||
data: Iterable<number[]>, | ||
data: DomainValues, | ||
opts: Partial<ScatterPlotOpts> = {} | ||
): PlotFn => (spec) => [ | ||
"points", | ||
opts.attribs || {}, | ||
[...processedPoints(spec, data)], | ||
[...processedPoints(spec, data, true)], | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters