Skip to content

Wrong label on point hover - Line chart #6183

@sberk97

Description

@sberk97

While providing X and Y in data for Line chart and then adding more labels than there are points in the dataset wrong label is showing up on hovering the point. Example: https://jsfiddle.net/2mq1vt0o/

Expected Behavior

As it is in the example, when you hover the first point it should display the label that is underneath that point (x-axis), not the first label on the chart. Correct label is provided for this point.

Current Behavior

At this moment when you hover a point it displays the first value from x-axis.

Steps to Reproduce (for bugs)

https://jsfiddle.net/2mq1vt0o/

Context

Simply I just wanted to display few datasets on a chart which can have space between each other. For example, show data for dates between 2018-01-01 to 2018-03-01. First dataset could have data for dates 2018-01-05 to 2018-01-25 and the second one 2018-02-05 to 2018-02-25. Problem was that when you didn't provide any x-axis values chart has been asigning these values in order which they are provided to labels. So then I found out that I can provide both x and y value for each point. Now it nearly works, only that tooltip when you hover a point displays wrong X value, just as it was when you didn't provide X axis value.

Environment

  • Chart.js version: 2.8.0
  • Browser name and version: Firefox 63

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions