question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Option for <canvas> padding

See original GitHub issue

Very minor issue here with a chart with a line width of 4 where the line and highlight dot is partially cut off on 0 values:

Maybe have a option to define a padding on the <canvas> area? I’d define a 2px padding in this case to accommodate the line width.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
leeoniyacommented, Dec 15, 2019

It might be just me but the dot on the first example seems a bit off-centered: I think the dot position might not yet take the line width into account.

there were a couple rounding issues that should be fixed now. it’s never gonna be perfect since all interactive elements are in the DOM while the grid + trendlines are on canvas (which follows devicePixelRatio). feel free to PR any improvements, though.

I guess I’d also increase the dot radius a bit with, is there a option for it yet?

i’ve moved the dot sizing logic to JS and it’s now relative to series line width: Math.max(5, width * 2 - 1). additionally, series.class now exists and will get tacked onto the cursor points & legend, so you can tweak those further in css as required. at some point it might be good to add full customization like providing ready-to-go dom elements for the cursor points, but that’ll likely be considered when i give more thought to https://github.com/leeoniya/uPlot/issues/10, post 1.0.

0reactions
leeoniyacommented, Mar 4, 2020

@silverwind as of 0bbe1638ebc461a75a1caa97d79ef1b105b93196, the custom padding should no longer be necessary. now that the canvas goes extends outside the plotting area, it was a matter of adjusting the clipping regions for the paths and [new!] points.

if you look at https://leeoniya.github.io/uPlot/demos/pad-scale.html, there’s no longer anything custom there. i’ll remove this demo before 1.0, since it no longer demonstrates anything. i might re-internalize uPlot.rangeNum(), since it was first exposed specifically for this purpose.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Understand margins, paddings, and borders - How to Canvas
Margins and padding both work similarly to create space between elements and content in our Canvas courses, but they do so differently.
Read more >
Canvas padding attributes ✏️ - CodePen
Use + & - buttons to adjust canvas padding on top, left, bottom and right! - 0 +. + 0 -.
Read more >
Solved: New RCE: Image Padding - Instructure Community
To my knowledge, there isn't any way in the Canvas UI (User Interface) to apply image padding to multiple images across the board....
Read more >
Understanding margins, paddings, and borders - YouTube
Margins and padding both work similarly to create space between elements and content in our Canvas courses, but they do so differently.
Read more >
Adding Padding to Images in Canvas - YouTube
A brief tutorial on adding padding to images in Canvas's HTML editor. ... Setting up a Quiz in Canvas. Jenn Kepka. Jenn Kepka....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found