Home forums Feature Requests & Feedback Tooltip customFormatter

Tagged: 

This topic contains 2 replies, has 2 voices, and was last updated by  dbouyssie 2 weeks ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #17788

    dbouyssie
    Member

    If I understood the documentation correctly (https://canvasjs.com/docs/charts/chart-options/tooltip/content-formatter/), the object passed to the contentFormatter function returns all chart series.
    It would be nice if this object could also contain the index of series involved in the mouse hover event.

    Otherwise it’s pretty hard to display a tooltip containing only the dataPoint coming from this specific series.

    I know I can also use the content parameter but it is less flexible.
    For instance I would like to format numbers using the exponential format (https://www.w3schools.com/jsref/jsref_toexponential.asp)
    So I would need to execute a JS function to achieve this.

    Thank you!

    #17830

    Bivek Singh
    Moderator

    @dbouyssie,

    Thank you for the suggestion. We will discuss this among the team and give it a thought. For now, you can use e.entries[0].dataSeries._index if you are not using shared tooltip.

    —–
    Bivek Singh,
    Team CanvasJS

    #17833

    dbouyssie
    Member

    Thank you very much for your quick reply.
    Under my version of CanvasJS (1.9.6) the field “_index” is undefined.
    However I do have a value at “e.entries[0].dataSeries.index”.

    Thank you for the tip!

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.