h5web icon indicating copy to clipboard operation
h5web copied to clipboard

Ordinate label can appear above tick labels

Open axelboc opened this issue 3 years ago • 4 comments

image

axelboc avatar Dec 13 '21 12:12 axelboc

Can be seen also in /surface_file plot of https://h5web.panosc.eu/h5wasm?url=https%3A%2F%2Fraw.githubusercontent.com%2Foasys-esrf-kit%2Fdabam2d%2Fmain%2Fdata%2Fdabam2d-001.h5

loichuder avatar Oct 07 '22 14:10 loichuder

Issue also raised in visx (that renders the axis): https://github.com/airbnb/visx/issues/1395

loichuder avatar Oct 25 '22 08:10 loichuder

Playing with some D3 formats:

.3~g

d3.format(".3~g")(3234234234234452) // 3.23e+15 (B)
d3.format(".3~g")(123452) // 1.23e+5
d3.format(".3~g")(122) // 122
d3.format(".3~g")(1) // 1 (C)
d3.format(".3~g")(0.12342354345) // 0.123
d3.format(".3~g")(0.0000012342354345) // 0.00000123 (A)
d3.format(".3~g")(0.00000012342354345) // 1.23e-7
d3.format(".3~g")(0.0000000000012342354345) // 1.23e-12
  • (A) max length of 10 characters. It's weird; I would expect exponent notation to kick in right from 0.0xxx...
  • (B) length of 8, which is what I would have expected the max length to be.
  • (C) min length of 1.

.3~s

d3.format(".3~s")(3234234234234452) // 3.23P
d3.format(".3~s")(123452) // 123k
d3.format(".3~s")(122) // 122
d3.format(".3~s")(1) // 1
d3.format(".3~s")(0.12342354345) // 123m
d3.format(".3~s")(0.0000012342354345) // 1.23µ
d3.format(".3~s")(0.00000012342354345) // 123n
d3.format(".3~s")(0.0000000000012342354345) // 1.23p

This is a lot more stable with 5 characters max. But do we want SI prefixes even when axes don't have units?

axelboc avatar Oct 25 '22 09:10 axelboc

g is in fact an alias for Number.toPrecision.

s is indeed the best candidate to get fixed-width strings. I am not a huge fan of prefixes but it could be an option to activate :shrug:

loichuder avatar Oct 25 '22 12:10 loichuder