Forum Discussion
Deneb Matrix Visual - Working but with Warnings
- 1 year ago
Adding type to x2 is unnecessary and does nothing, as these share the same scale as x. The type in x dictates how x2 is scaled. Remove type from the channel and the warning should go away. (EDIT: example of using offset channels on a StackOverflow post from the other day that may help clarify)
bandPosition only spans from 0 to 1 and dictates percentage of the band to use for a mark's position (0.5 being the centre). Use xOffset or x2Offset if you want to adjust by a specific amount relative to encoded position.
You're too kind! I get pretty giddy each time I see someone using Deneb to solve a challenge 🙂
These properties have expression support, so you could calculate the x-axis's bandwidth and offset by half of that.
I'd need to see any revised code (and possibly get a sample of data to set up and try to confirm 100%, as it depends on where you're using xOffset, etc., in your spec (whether via mark properties or encoding channels).
If using via mark properties, something like the following could be a starting point which should offset by a quarter of the derived bandwidth in each direction:
// Assuming you want to go left (negative)
"xOffset": {
"expr": "-bandwidth('x') * 0.25"
}
// Assuming you want to go right (positive)
"x2Offset": {
"expr": "bandwidth('x') * 0.25"
}
Hoepfully that may get you on the right path, but if you're still stuck then any contextual info like a revised spec and sample data would be a great help to get you where you need to be.
Good luck!
Daniel
Thanks for all of the help Daniel. Sorry for the lateness in my reply. My initial attempts were unsuccessful and several work priorities have kept me away. I will mark your original post as the solution for my question but will eventually post a sample workbook for my latest question to you.
Thanks again!
Bob