Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coverage fix #455

Merged
merged 1 commit into from
May 5, 2017
Merged
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
10 changes: 4 additions & 6 deletions src/main/viz/CoverageTrack.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,21 +54,19 @@ class CoverageTiledCanvas extends TiledCanvas {
this.options = options;
}

yScaleForRef(ref: string): (y: number) => number {
yScaleForRef(ref: string, bottomPadding: number, topPadding:number): (y: number) => number {
var maxCoverage = this.cache.maxCoverageForRef(ref);

var padding = 10; // TODO: move into style
return scale.linear()
.domain([maxCoverage, 0])
.range([padding, this.height - padding])
.range([bottomPadding, this.height - topPadding])
.nice();
}

render(ctx: DataCanvasRenderingContext2D,
xScale: (x: number)=>number,
range: ContigInterval<string>) {
var bins = this.cache.binsForRef(range.contig);
var yScale = this.yScaleForRef(range.contig);
var yScale = this.yScaleForRef(range.contig, 0, 30);
var relaxedRange = new ContigInterval(
range.contig, range.start() - 1, range.stop() + 1);
renderBars(ctx, xScale, yScale, relaxedRange, bins, this.options);
Expand Down Expand Up @@ -287,7 +285,7 @@ class CoverageTrack extends React.Component {
ctx.reset();
ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);

var yScale = this.tiles.yScaleForRef(range.contig);
var yScale = this.tiles.yScaleForRef(range.contig, 10, 10);

this.tiles.renderToScreen(ctx, range, this.getScale());
this.renderTicks(ctx, yScale);
Expand Down