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(chart & heatmap): make to fix that y label is rendering out of bounds #20011

Merged
merged 1 commit into from
May 20, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ function Heatmap(element, props) {
let showY = true;
let showX = true;
const pixelsPerCharX = 4.5; // approx, depends on font size
const pixelsPerCharY = 6; // approx, depends on font size
let pixelsPerCharY = 6; // approx, depends on font size

const valueFormatter = getNumberFormatter(numberFormat);

Expand All @@ -121,6 +121,7 @@ function Heatmap(element, props) {
let longestY = 1;

records.forEach(datum => {
if (typeof datum.y === 'number') pixelsPerCharY = 7;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can the user change the font size? Will it work in that case?
Please add a comment above explaining why this is adjusted like so

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Soon, we may be dealing with different fonts, tool. Is this an issue with the ECharts library itself that we're just working around here? If so, I wonder if they've already addressed it in a newer version.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The user can't change the font size of y label.
I think that this maybe the issue of legacy charts library itself.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually It is implemented using d3 and the implementation does not seem elegant. Let's migrate to echarts later.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will later, but we need to get that prioritized on the roadmap... it'll be a while.

longestX = Math.max(
longestX,
(datum.x && datum.x.toString().length) || 1,
Expand Down