Skip to main content

Custom tooltips

In order to add a custom tooltip to your custom button in the toolbar, simply wrap the button in a WithTooltip wrapper like this:

const { React, uiOverridesUtils, chartKitUtils } = DXChart;
const { DEFAULT_TOOLBAR_BUTTONS, addCustomToolbarButtons } = uiOverridesUtils.toolbarButtons;
const { WithTooltip } = chartKitUtils.tooltip;
const CustomButton = () => {
return React.createElement(
WithTooltip,
{ label: 'My custom tooltip', position: 'bottom' },
React.createElement('Button', null, 'CustomSpan'),
);
};
const enhancedButtons = addCustomToolbarButtons({ button: CustomButton });
const destroy = DXChart.widget.createWidget(document.getElementById('chart-iframe'), {
uiOverrides: {
Toolbar: {
ToolbarButtons: enhancedButtons,
},
},
});