-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
More gl2d symbols! #1781
More gl2d symbols! #1781
Conversation
- showing off ALL available symbols!
- so that gl3d list remains the same until we spend more time tweaking each symbol's positioning in gl3d
- add per-symbol specs (w/ 'noBorder' and 'bwFactor') - color `-open` symbols using `marker.color` - color symbols with no border (e.g. 'line-ne', 'asterisk') using `marker.line.color` only - puts us close to on-par with SVG
- so that it match the svg version - see https://codepen.io/etpinard/pen/WOxxaO for reproducible codepen
@@ -0,0 +1,505 @@ | |||
{ | |||
"data": [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
generated with https://codepen.io/etpinard/pen/LLZGZV
"marker symbol: 'diamond-open'", | ||
"marker symbol: 'cross'" | ||
], | ||
"marker": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should make sure new marker symbols are positioned and scaled properly in gl3d before adding them. To be completed in a future PR.
@etpinard if marker set is going to be limited, a better solution would be pre-generated sdf sprite with all markers included. That would enable all svg markers in scattergl and allow to get rid of font-atlas-sdf, which would make code of gl-scatter2d way simpler and performant. |
Could we make some of the markers be rotated characters? So like ➕ could rotate 45 degrees to make ✖️ rather than having to use letter X. |
@alexcjohnson we use font-atlas-sdf to render symbols, which in turn uses tiny-sdf internally to draw characters with API call |
Done in ➡️ bb9a46c Thanks for taking a look 🔬 |
@alexcjohnson thanks for the good point! Fixed in dy/font-atlas-sdf@1f610fe |
Yeah, it's a shame. Actually, I should put it back in even it doesn't render in |
- so that -open symbols are noticeabily NOT filled in white
- used in 'fancy' scattergl traces - control its version here, instead of it being a 3rd-party dep
- fill 'cross-open' and 'x-open' with transparent so that they match the svg version - N.B. 'x' does not render in `imagetest` (appears as []) but appears to work ok in other browsers/OS
- dynamically list -open symbols - draw -open symbol as filled unicode symbols with transparent fill so that the border width scales the same as their non-open versions -> this adds support for heaxgon2-open 🎉 - add annotation about 'x' and 'x-open' in `imagetest`
src/traces/scattergl/convert.js
Outdated
} else if(symbolSpec.noBorder) { | ||
bwFactor = 0.25; | ||
} else if(symbolSpec.noFill) { | ||
bwFactor = 0.1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so... this means that for these symbols with a smaller bwFactor
the border will grow more slowly than the others? The result being that for small borderWidth
these ones be thicker than other symbols, and for large borderWidth
they will be thinner, and somewhere in the middle they will look similar right? I would think we'd do better with something like a minimum border width, as a fraction of size
, that corresponds to the line width already baked into the unicode symbol, so the symbol gets no explicit border until you provide a width greater than this, and at greater widths you set a border borderWidth - minBorderWidth
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
. this means that for these symbols with a smaller bwFactor the border will grow more slowly than the others?
You're correct. Thanks for the headsup! For documentation purposes, using https://codepen.io/etpinard/pen/JJRMxo?editors=0010 as of commit fffc702
SVG gives:
and gl:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alexcjohnson here's my latest attempt:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//this.scatter.options.borderWidths[i] = (bw > minBorderWidth) ? bw - minBorderWidth : 0;
// but I found better results with:
this.scatter.options.borderWidths[i] = (bw > minBorderWidth) ? bw - minBorderWidth : bw;
minBorderWidth
should only be nonzero for noBorder
or noFill
symbols right? Does that make it work better to use bw - minBorderWidth : 0
? As it is it looks funny, as border width is non-monotonic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think that's better:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome - I think we've got it 🎉 💃
@etpinard nice work! just the one more question about how we calculate border widths https://github.com/plotly/plotly.js/pull/1781/files#r121820798 and we should be ready to go. The available symbols are looking really good now. Thanks for bearing with all my nitpicks, I just want to get this all as final as possible so we don't need to come back to it again... |
includes PRs: - #1657 - gl-vis/gl-scatter2d-sdf#5 - #1781 - #1770
💃 💃 💃 ! |
Supersedes #1550 with better mocks and fine tuning via gl-vis/gl-scatter2d-sdf#4 and b1bccdc
TODO:
gl-scatter2d-sdf
once @dfcreative 's Update markers alignment gl-vis/gl-scatter2d-sdf#4 is merged/published