Skip to content

Commit

Permalink
feat(tooltip): for customHTML pass along the HTML tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
scottdickerson committed Oct 28, 2019
1 parent 88b6b42 commit 7d1a026
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions packages/core/src/components/essentials/tooltip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,21 @@ export class Tooltip extends Component {

let data = select(event.target).datum() as any;

// if there is a provided tooltip HTML function
if (Tools.getProperty(this.model.getOptions(), "tooltip", "customHTML")) {
tooltipTextContainer.html(this.model.getOptions().tooltip.customHTML(data));
} else if (e.detail.multidata) {
// Generate default tooltip
let defaultTooltip;
if (e.detail.multidata) {
// multi tooltip
data = e.detail.multidata;
tooltipTextContainer.html(this.getMultilineTooltipHTML(data));
defaultTooltip = this.getMultilineTooltipHTML(data);
} else {
defaultTooltip = this.getTooltipHTML(data);
}
// if there is a provided tooltip HTML function call it
if (Tools.getProperty(this.model.getOptions(), "tooltip", "customHTML")) {
tooltipTextContainer.html(this.model.getOptions().tooltip.customHTML(data, defaultTooltip));
} else {
tooltipTextContainer.html(this.getTooltipHTML(data));
// Use default tooltip
tooltipTextContainer.html(defaultTooltip);
}

// Position the tooltip
Expand Down

1 comment on commit 7d1a026

@AdamHeyInovex
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It really would be nice if there was some - ANY - indication of how to use this! i.e. how do you represent the value, group, label etc? Is there some sort of markdown??? Your documentation SUCKS!!

Please sign in to comment.