Skip to content

Commit

Permalink
[desktop]: Fix Guider chart zoom
Browse files Browse the repository at this point in the history
  • Loading branch information
tiagohm committed Jun 8, 2024
1 parent 44066a0 commit 8221951
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions desktop/src/app/guider/guider.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,8 @@ export class GuiderComponent implements AfterViewInit, OnDestroy, Pingable {
const scale = barType ? this.phdDurationScale : 1.0
const y = context.parsed.y * scale
const prefix = raType ? 'RA: ' : 'DEC: '
const barSuffix = ' ms'
const lineSuffix = this.yAxisUnit === 'ARCSEC' ? '"' : 'px'
const formattedY = prefix + (barType ? y.toFixed(0) + barSuffix : y.toFixed(2) + lineSuffix)
const formattedY = prefix + (barType ? y.toFixed(0) + ' ms' : y.toFixed(2) + lineSuffix)
return formattedY
}
}
Expand Down Expand Up @@ -197,13 +196,20 @@ export class GuiderComponent implements AfterViewInit, OnDestroy, Pingable {
dash: [2, 4],
},
ticks: {
autoSkip: true,
autoSkip: false,
count: 11,
maxRotation: 0,
minRotation: 0,
callback: (value) => {
callback: (value, i, ticks) => {
const a = value as number
return (a - Math.trunc(a) > 0) ? undefined : a.toFixed(0)

if (i === 0) {
return a.toFixed(0)
} else if (ticks[i - 1]) {
if (Math.abs(Math.trunc(ticks[i - 1].value) - Math.trunc(a)) >= 1) {
return a.toFixed(0)
}
}
}
},
grid: {
Expand Down

0 comments on commit 8221951

Please sign in to comment.