-
Notifications
You must be signed in to change notification settings - Fork 715
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
Heatmap - Allow for auto indexed rows #302
Comments
Great idea @JacquiManzi! I went for a bit different approach that allows you to pass in a Both instead of adding a boolean prop you would do: <HeatmapRect
bins={d => d.values }
bin={d => d.bucket }
yBin={(d,i) => i}
data={data}
x={0}
xScale={xScale}
yScale={yScale}
colorScale={colorScale}
opacityScale={opacityScale}
binWidth={binWidth}
binHeight={binHeight}
step={dStep}
gap={0}
/> |
hshoff
added a commit
that referenced
this issue
Jun 13, 2018
[shape] add index + yBin to heatmap circle/rect. fixes #302
Perfect, thanks so much @hshoff ! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
First off, thanks for making this project- it’s exactly what I've needed.
So, I'm implementing a heatmap using VX and would like to provide a custom data structure. From reading the docs and source code, I believe this is the structure that is intended for the heatmap chart:
The problem is that I would like to have my API return matching data structures for my charts to consume in order to prevent expensive data mapping on the client. My ideal structure looks like this:
Luckily, VX allows me to override these props:
Which allows me to replace
bin
withbucket
andbins
withvalues
, but I run into issues here since the yScale value is re-using the bin accessor function here:y={yScale(bin(b) + step) + gap}
I think it’s valuable to allow for a custom row value (bin in this case) because it means you can have a custom order to items, but I would rather just use the index value of my values array. This way I wouldn’t need my API to provide a row value at all.
Could there potentially be a boolean prop that allows for an auto index like:
const y = indexedRows ? j : bin(b);
Which then can be used here:
y={yScale(y + step) + gap}
Ultimately this would allow me to do this:
A quick example of what I'm considering is here: https://github.com/muxinc/vx/pull/1/files
The text was updated successfully, but these errors were encountered: