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

Expanded tooltip not displaying #2

Open
lukewendling opened this issue Mar 1, 2017 · 1 comment
Open

Expanded tooltip not displaying #2

lukewendling opened this issue Mar 1, 2017 · 1 comment

Comments

@lukewendling
Copy link

I'm looking for assistance in understanding the tooltip display.

Problem: I only see the minimal date text in the tooltip, instead of the additional label and coloring.

image

This bit of code is why

serie.find = function (date) {
    var bisect = d3.bisector(fk(aes.x)).left;
    var i = bisect(serie.data, date) - 1
    if (i == -1)
        return null
    //look to far after serie is defined
    if (i == serie.data.length - 1 && serie.data.length > 1 &&
        Number(date) - Number(serie.data[i][aes.x]) > Number(serie.data[i][aes.x]) - Number(serie.data[i - 1][aes.x]))
        return null /******** this is always returned *************/
    return serie.data[i]
}

Data looks like this

[{query_type: "jobset", count: 100, created: 1488393368058}]

Chart config:

var chart = d3.timeseries()
        .addSerie(
        data,
        { x: 'created', y: ofX },
        { interpolate: 'linear', width: 3 }
        )
        .margin.left(65)
        .width(650)

Any ideas greatly appreciated!

@crlsktr
Copy link

crlsktr commented Mar 27, 2019

Hi Luke! Sorry I'm so late to this. I ran into the same problem. I figured that the problem is in the subtraction of the dates. If your dates have hours (which usually happens on the constructor of Date because of localization) then there is the possibility that Number(date) - Number(serie.data[i][aes.x]) will indeed be greater than Number(serie.data[i][aes.x]) - Number(serie.data[i - 1][aes.x]). The solution is to remove hours.

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