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

fix(heatmap): add option for align in heatmap #14779

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

xiaoyueguang
Copy link

@xiaoyueguang xiaoyueguang commented Apr 23, 2021

Brief Information

This pull request is in the type of:

  • bug fixing
  • new feature
  • others

What does this PR do?

add option called strictlyAligned, fix lines aligned in Heatmap.

Fixed issues

issues/14733

Details

Before: What was the problem?

Lines are not aligned in Heatmap

You can see this demo

After: How is it fixed in this PR?

The error is caused by the conversion of the decimal point to an integer.

  // src/chart/heatmap/HeatmapView.ts
  rect = new graphic.Rect({
      shape: {
          x: Math.floor(Math.round(point[0]) - width / 2),
          y: Math.floor(Math.round(point[1]) - height / 2),
          width: Math.ceil(width),
          height: Math.ceil(height)
      },
      style
  });

I add an option to fix this issues, but this will cause performance issues.

So developers can look at the scene to determine whether to enable.

Misc

  • The API has been changed (apache/echarts-doc#xxx).
  • This PR depends on ZRender changes (ecomfe/zrender#xxx).

Related test cases or examples to use the new APIs

test/heatmap-strictly-aligned.html

NA.

Others

Merging options

  • Please squash the commits into a single one when merge.

Other information

@echarts-bot
Copy link

echarts-bot bot commented Apr 23, 2021

Thanks for your contribution!
The community will review it ASAP. In the meanwhile, please checkout the coding standard and Wiki about How to make a pull request.

Document changes are required in this PR. Please also make a PR to apache/echarts-doc for document changes and update the issue id in the PR description. When the doc PR is merged, the maintainers will remove the PR: awaiting doc label.

@hughess
Copy link

hughess commented Feb 11, 2024

I ran into this as well and hoping this PR has the fix to it. My heatmap has borders, which makes the misalignment slightly more obvious as well. See example here

CleanShot 2024-02-11 at 10 27 16@2x

@hughess
Copy link

hughess commented Mar 3, 2024

any chance this will be in the next version?

Currently, it's challenging to make a heatmap that doesn't look strange due to the lines/boxes being out of alignment:
CleanShot 2024-03-03 at 16 29 41@2x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants