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

Fixed stutter due to very large tooltip text #519

Closed
Closed
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
4 changes: 2 additions & 2 deletions assets/app/js/helpers/barChart.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class BarChart {
tooltip
.style('left', d3.event.pageX - 50 + 'px')
.style('top', d3.event.pageY - 70 + 'px')
.text((d.name + ' (' + d.val + ')'));
.text((BarChart.trimName(d.name) + ' (' + d.val + ')'));
})
.on('mouseout', () => { tooltip.style('display', 'none'); });

Expand All @@ -112,7 +112,7 @@ class BarChart {
tooltip
Copy link
Member

Choose a reason for hiding this comment

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

There's another .text() on line 96, is that something (and are there other places like this elsewhere in charts/others) that would also benefit from trimming potentially?

I'm not super familiar with .js or this codebase so I have no idea btw.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That line is used to set the count for the bar which won't be that long character wise

to verify i added console log on that line to check what values are used there i.e.
.text((d) => { console.log('text being set on line 96 to', d.val); return '(' + d.val + ')'; })
It gave output:
image

and, about trimming at other places, I searched through a lot of files but only these 2 needed change

.style('left', d3.event.pageX - 50 + 'px')
.style('top', d3.event.pageY - 70 + 'px')
.text((d + displayValue));
.text(BarChart.trimName(d) + displayValue);
})
.on('mouseout', () => { tooltip.style('display', 'none'); })
.attr('data-value', (d) => {
Expand Down