Open mayfield opened 4 years ago
@mayfield Was wondering if you have a dist with the retina and hover fix?
@anandmehrotra I don't have a dist, but i I'm now using a heavily modified version of this lib in one of my projects here: https://github.com/SauceLLC/sauce4strava/blob/master/src/site/sparkline.js It has the above changes plus a bunch other enhancements and things like value based gradient fills. You can clone and grep through that project for examples of how to use some of the extended funcs.
If the canvas element is scaled by
window.devicePixelRatio
and then scaled back down by the CSS properties the results look better on HiDPI displays. Given the small nature of most sparklines, this is pretty huge. #nopunHere are two images from my use case. First with stock code...
And here with a modified
_calculatePixelDims
...Those results come from this incomplete patch:
I'd be happy to complete the work on this (hover over is broken) and write it using more compatible code (e.g. no
const
) if this project is still active (last commit 2013). Otherwise I'll probably fork and put my changes up there.