Skip to content

Commit

Permalink
fix(bar): tooltip to render bar should provide original datapoint
Browse files Browse the repository at this point in the history
  • Loading branch information
scottdickerson committed Jan 17, 2020
1 parent 7af6584 commit ed04f98
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/core/src/components/essentials/tooltip-bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,21 @@ export class TooltipBar extends Tooltip {
if ((e.detail.type === TooltipTypes.DATAPOINT && Tools.getProperty(this.model.getOptions(), "tooltip", "datapoint", "enabled"))
|| (e.detail.type === TooltipTypes.GRIDLINE && Tools.getProperty(this.model.getOptions(), "tooltip", "gridline", "enabled")) ) {

let data = e.detail.hoveredElement.datum() as any;
const hoveredElement = e.detail.hoveredElement.node();

let defaultHTML;
if (e.detail.multidata) {
// multi tooltip
data = e.detail.multidata;
defaultHTML = this.getMultilineTooltipHTML(e.detail.multidata);
} else {
defaultHTML = this.getTooltipHTML(e.detail.hoveredElement.datum());
}

// if there is a provided tooltip HTML function call it and pass the defaultHTML
if (Tools.getProperty(this.model.getOptions(), "tooltip", "customHTML")) {
tooltipTextContainer.html(this.model.getOptions().tooltip.customHTML(hoveredElement, defaultHTML));
tooltipTextContainer.html(this.model.getOptions().tooltip.customHTML(data, defaultHTML));
} else {
// default tooltip
tooltipTextContainer.html(defaultHTML);
Expand Down

0 comments on commit ed04f98

Please sign in to comment.