https://responsive-line-sveltekit.netlify.app/
The original React component was created by Sam Selikoff at Build UI. It's a great writeup and code that can be found here.
Follow up could be experimenting with applying this technique in Observable's Plot library or incorporating AM4 data reduction if necessary.
Online on Stackblitz,
https://stackblitz.com/~/github.com/jzavala-gonzalez/responsive-line-sveltekit
Or locally after cloning this repository:
npm install
npm run dev