## External (Custom) Tooltips
-Custom tooltips allow you to hook into the tooltip rendering process so that you can render the tooltip in your own custom way. Generally this is used to create an HTML tooltip instead of an oncanvas one. You can enable custom tooltips in the global or chart configuration like so:
+Custom tooltips allow you to hook into the tooltip rendering process so that you can render the tooltip in your own custom way. Generally this is used to create an HTML tooltip instead of an on-canvas tooltip. The `custom` option takes a function which is passed a context parameter containing the `chart` and `tooltip`. You can enable custom tooltips in the global or chart configuration like so:
```javascript
var myPieChart = new Chart(ctx, {
// Disable the on-canvas tooltip
enabled: false,
- custom: function(tooltipModel) {
+ custom: function(context) {
// Tooltip Element
var tooltipEl = document.getElementById('chartjs-tooltip');
}
// Hide if no tooltip
+ var tooltipModel = context.tooltip;
if (tooltipModel.opacity === 0) {
tooltipEl.style.opacity = 0;
return;
* `xLabel` and `yLabel` were removed. Please use `index` and `value`
* The `filter` option will now be passed additional parameters when called and should have the method signature `function(tooltipItem, index, tooltipItems, data)`
+* The `custom` callback now takes a context object that has `tooltip` and `chart` properties
## Developer migration
}
if (changed && options.custom) {
- options.custom.call(me, [me]);
+ options.custom.call(me, {chart: me._chart, tooltip: me});
}
}