Skip to content
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 rendering issue, rect x always NaN #474

Closed
MartinClement opened this issue Jul 8, 2019 · 1 comment · Fixed by #475
Closed

Heatmap rendering issue, rect x always NaN #474

MartinClement opened this issue Jul 8, 2019 · 1 comment · Fixed by #475

Comments

@MartinClement
Copy link

Hey guys !

I just find out something strange in the heatmap code, just here

For me, the 'bin.x0' can't be found in the bin

I had issues when I rendered my heatmap, the rect x attribute was alway 'Nan'.

I just removed '+ bin.x0' and this fixed all =)

I may be wrong but I think x0 is missing in bin construction.

No problem using children way !

Have a good day guys !

@MartinClement MartinClement changed the title Heatmap rendering issue, rect x alway NaN Heatmap rendering issue, rect x always NaN Jul 8, 2019
hshoff added a commit that referenced this issue Jul 9, 2019
@hshoff
Copy link
Member

hshoff commented Jul 9, 2019

Thanks for the bug report! Will get this fixed in v0.0.190. Until it gets published, the workaround is to use the render prop api by passing a function as children:

       <HeatmapRect
          data={data}
          xScale={xScale}
          yScale={yScale}
          colorScale={rectColorScale}
          opacityScale={opacityScale}
          binWidth={binWidth}
          binHeight={binWidth}
          gap={2}
        >
          {heatmap => {
            return heatmap.map(bins => {
              return bins.map(bin => {
                return (
                  <rect
                    key={`heatmap-rect-${bin.row}-${bin.column}`}
                    className="vx-heatmap-rect"
                    width={bin.width}
                    height={bin.height}
                    x={bin.x}
                    y={bin.y}
                    fill={bin.color}
                    fillOpacity={bin.opacity}
                    onClick={event => {
                      const { row, column } = bin;
                      alert(JSON.stringify({ row, column, ...bin.bin }));
                    }}
                  />
                );
              });
            });
          }}
        </HeatmapRect>

hshoff added a commit that referenced this issue Jul 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants