Commit bae45101 authored by Remi  PLANEL's avatar Remi PLANEL
Browse files

Add option to set y position

parent 64dab9b3
import { GeneData, PositionedGeneData } from "../component/sequence/gene";
import { scaleLinear } from "d3-scale";
import { extent } from "d3-array";
import { ScaleLinear } from "d3-scale";
export default function linearGene(
data: Array<GeneData>,
width: number,
geneOffset: number
xScale: ScaleLinear<number, number>,
yPosition: number = 20
) {
const sequenceInterval = extent(data.reduce(
(accum, gene) => [...accum, gene.begin, gene.end],
[] as Array<number>
));
const xScale = scaleLinear()
.domain([sequenceInterval[0] || 0, sequenceInterval[1] || 0])
.range([0, width])
return data.reduce(function (
accum: PositionedGeneData[],
gene: GeneData,
......@@ -28,7 +19,7 @@ export default function linearGene(
...gene,
position: {
x,
y: 0,
y: yPosition,
width
}
});
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment