vasturiano / timelines-chart

Timelines Chart
http://vasturiano.github.io/timelines-chart/example/categorical/
MIT License
560 stars 122 forks source link

Add additional date on tooltip #112

Open hnfishwu opened 2 years ago

hnfishwu commented 2 years ago

I would like to add more additional data on tooltip. I know I can use myChart.zDataLabel('<div>Additional <b>data</b></div>') to add more text.

But I want to show different text on different segments. Is it possible? Thanks.

vasturiano commented 2 years ago

@hnfishwu you can use .segmentTooltipContent for that purpose.

hnfishwu commented 2 years ago

@vasturiano

Could you give me some example to use this .segmentTooltipContent ? I have tried this but the tooltip only can show the val or timerange. I would like to show different tooltip on different segment , and the tooltip is not val or timerange.

Do you have any suggestion? Thanks.

vasturiano commented 2 years ago

@hnfishwu the segment data is included in the callback function of .segmentTooltipContent. So you can do something like:

.segmentTooltipContent(d => d.data.myCustomTooltipText)
hnfishwu commented 2 years ago

@vasturiano Thanks a lot. It works.