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 not displaying title on load #1482

Closed
tttp opened this issue Sep 10, 2018 · 3 comments
Closed

heatmap not displaying title on load #1482

tttp opened this issue Sep 10, 2018 · 3 comments

Comments

@tttp
Copy link
Contributor

tttp commented Sep 10, 2018

Hi,

On the heatmap, the title are empty on load: https://dc-js.github.io/dc.js/examples/heat.html

They are properly generated and displayed when you filter them, but shouldn't the title be displayed at load?

@tttp
Copy link
Contributor Author

tttp commented Sep 10, 2018

FYI, I "solved" the problem by removing the title and add a tooltip

    var tip = d3.tip()
    .attr('class', 'd3-tip wide-tip')
    .offset([-10, 0])
    .html(function (d) {
      return "<h5>"+d.key+"</h5><div>"
        +d.value
        + "</div>";
    });

    graph.on('pretransition', function() {
      graph.selectAll('.heat-box')
      .call(tip)
      .on('mouseover.tip', tip.show)
      .on('mouseout.tip', tip.hide);
    });

@gordonwoodhull
Copy link
Contributor

Good catch! Thanks @tttp!

@gordonwoodhull
Copy link
Contributor

Looks like this is more fallout of the port to D3v4. The code which sets the titles for both render and redraw is

dc.js/src/heatmap.js

Lines 229 to 234 in 2fa1fca

if (_chart.renderTitle()) {
gEnter.append('title');
boxes.select('title').text(_chart.title());
}
boxes = gEnter.merge(boxes);

On the first run, the enter selection is not automatically merged into the update selection as it used to be, so boxes is still empty until the merge in the following line. Moving the merge before the title updates fixes the problem.

I've added a test and a fix for 3.0.7

gordonwoodhull added a commit that referenced this issue Sep 17, 2018
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

No branches or pull requests

2 participants