Skip to content

[BUG] yLabel type in toopltipItem object #5830

@monstasat

Description

@monstasat

I have a line chart with numeric y axis. To implement a custom tooltip for this chart, I have attached a custom callback to tooltips section of chart options. As it mentioned in docs, this callback receives a tooltipModel object, with dataPoints object of type tooltipItem[] inside. Chartjs doc says that xLabel and yLabel fields of tooltipItem must be of type string. But in fact I have yLabel field of type number.
Here is one of the received tooltipItem object:

{ x: 29.3583984375
xLabel: undefined
y: 46.2
yLabel: 15 
}

Expected Behavior

xLabel and yLabel fields must be of type string

Current Behavior

yLabel field is of type number

Context

As I am writing OCaml bindings for Chartjs, types of object fields matter. Are there any reasons why these fields are of the same type as they are stored in a dataset or it is just a bug? At least, I think it is not good that there is some discrepancy between documentation and actual behaviour.

Sorry for not attaching a live example or code to reproduce a bug. If it is essential, I will attach it later.

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