Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
I am developing custom simple visual where I would like to use built-in tooltips, I integrated it by documentation steps, but I am getting console error
what is pointing to customVisualHost bundle where it looks like event is null in this method
and I have no clue what am I doing wrong. I prepared separate repository just with tooltip functionality.
https://github.com/janstrbik/PowerBI-custom-visual-tooltip
Can anyone help me out here?
Thanks. Jan
Solved! Go to Solution.
Hi @janstrbik, and thanks so much for providing a complete repo - super easy to start having a look around 🙂
The "issue" is on line 51, where you are passing the third parameter (selector):
private renderTooltip() {
this.tooltipServiceWrapper.addTooltip(
d3.select(this.target),
(tooltipEvent: tooltip.TooltipEventArgs<number>) => this.getTooltipData(),
(tooltipEvent: tooltip.TooltipEventArgs<number>) => null); /** <--- right here */
}
Modify this to an empty array, e.g.:
private renderTooltip() {
this.tooltipServiceWrapper.addTooltip(
d3.select(this.target),
(tooltipEvent: tooltip.TooltipEventArgs<number>) => this.getTooltipData(),
(tooltipEvent: tooltip.TooltipEventArgs<number>) => []); /** <--- right here */
}
This will now work as expected, e.g.:
Based on the typings, I think your approach is correct and there is an issue in the utilities somewhere (based on what looks like changes made to explicitly remove this restriction in the repo a while back.) This should apparently not need to be an array - report page tooltips only support a single selector.
I don't personally use this package in my projects (I usually use the visual host directly) so haven't come across this issue - you might want to raise this as an issue in the repo for the team to look at or provide an official response (giving them a link to your repo as a means of reproducing; it's quite clear in helping to illustrate what I think is incorrect here).
Either way, the above resolution should get you moving. If you do get to the point of passing in a selection ID for a report page tooltip here, I assume this would also need to be a single element array, so bear this in mind if/when you get there.
Good luck!
Daniel
Proud to be a Super User!
On how to ask a technical question, if you really want an answer (courtesy of SQLBI)
Hi @janstrbik, and thanks so much for providing a complete repo - super easy to start having a look around 🙂
The "issue" is on line 51, where you are passing the third parameter (selector):
private renderTooltip() {
this.tooltipServiceWrapper.addTooltip(
d3.select(this.target),
(tooltipEvent: tooltip.TooltipEventArgs<number>) => this.getTooltipData(),
(tooltipEvent: tooltip.TooltipEventArgs<number>) => null); /** <--- right here */
}
Modify this to an empty array, e.g.:
private renderTooltip() {
this.tooltipServiceWrapper.addTooltip(
d3.select(this.target),
(tooltipEvent: tooltip.TooltipEventArgs<number>) => this.getTooltipData(),
(tooltipEvent: tooltip.TooltipEventArgs<number>) => []); /** <--- right here */
}
This will now work as expected, e.g.:
Based on the typings, I think your approach is correct and there is an issue in the utilities somewhere (based on what looks like changes made to explicitly remove this restriction in the repo a while back.) This should apparently not need to be an array - report page tooltips only support a single selector.
I don't personally use this package in my projects (I usually use the visual host directly) so haven't come across this issue - you might want to raise this as an issue in the repo for the team to look at or provide an official response (giving them a link to your repo as a means of reproducing; it's quite clear in helping to illustrate what I think is incorrect here).
Either way, the above resolution should get you moving. If you do get to the point of passing in a selection ID for a report page tooltip here, I assume this would also need to be a single element array, so bear this in mind if/when you get there.
Good luck!
Daniel
Proud to be a Super User!
On how to ask a technical question, if you really want an answer (courtesy of SQLBI)
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
4 | |
4 | |
3 | |
3 | |
3 |