Skip to content

Conversation

@NavigSB
Copy link

@NavigSB NavigSB commented Jan 15, 2026

Description

Hey Philip! When showing the new PNSN website around to coworkers, a common suggestion was to upscale the resolution of the seismogram displays. Once I found out it was relatively simple to add resolution support to HTML canvases, I thought I'd spin something up on Seisplot.js. Let me know what you think!

Makes a lovely difference on our end! Here's a before and after:

Before:
Screenshot 2026-01-15 at 10 52 54

After:
Screenshot 2026-01-15 at 10 53 12

Scope

What's changed:

  • Added resolutionScale parameter to SeismographConfig to control Seismograph canvas resolution
  • Added _canvasWidth and _canvasHeight private helper fields to store the resolution-scaled canvas size
  • Added scaleForResolution parameter to timeScaleForSeisDisplayData and __initAmpScale methods for creating time and amplitude scales that are relative to the resolution-scaled canvas size
  • Scale Seismograph canvas to _canvasWidth and _canvasHeight, then style canvas to original width and height through CSS
  • Scale Seismograph lineWidth by resolutionScale

Potential Risks / Drawbacks

  • Increased resolution for Seismograph canvases could lead to increased computation and browser latency

Tested Scenarios

  • Tested on PNSN's website, utilizing helicorder, seismograph, and animatedseismograph

Review Notes / Questions

  • I haven't tested this anywhere other than PNSN's website- it worked with minimal changes on our side, so hopefully it will work with your systems too

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

dependabot bot and others added 6 commits November 21, 2025 21:49
Bumps [js-yaml](https://github.com/nodeca/js-yaml) from 3.14.1 to 3.14.2.
- [Changelog](https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md)
- [Commits](nodeca/js-yaml@3.14.1...3.14.2)

---
updated-dependencies:
- dependency-name: js-yaml
  dependency-version: 3.14.2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
…js-yaml-3.14.2

Bump js-yaml from 3.14.1 to 3.14.2
@crotwell
Copy link
Owner

Looks really nice, that is a cool idea. I've been a bit swamped, but will try to look in detail next week.

Quick thought, is it needed to store _canvasWidth and _canvasHeight and resolutionScale? Maybe resolutionScale being 1 is the same as current drawing, then resolutionScale of 2 does the fancy trick? Just thinking the less fields in the Seismograph class the better as it is already pretty huge. In general I try to avoid storing A and B if I can just store A and calc B easily from A.

Perhaps having the default be resolutionScale=2 would be good? Might as well make the default look nice, as long as the performance hit isn't too much.

Also, is there a need to have this be integer? I am thinking not.

Is 2 good enough, or were you using something larger?

@crotwell
Copy link
Owner

Just did a quick test and it makes the realtime display look A LOT BETTER!

Really nice! You win this week's prize! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants