Hi Alex,
Greetings from Syncfusion.
We have analyzed your query. We can achieve your requirement using pointClick event of the chart. This event fired when we click the series point. So we have created a context menu inside of this event and set menu item target as chart container ID. Now the context menu is working fine as you expect. We have prepared a simple sample based on your requirement. Please find below sample and code snippet,
Code Snippet:
let menuObj: ContextMenu;
let menuItems: MenuItemModel[] = [
{
text: 'Cut',
iconCss: 'e-cm-icons e-cut'
},
{
text: 'Copy',
iconCss: 'e-cm-icons e-copy'
},
{
text: 'Paste',
iconCss: 'e-cm-icons e-paste'
}];
//ContextMenu model definition
let menuOptions: ContextMenuModel = {
target: '#container_svg',
items: menuItems,
};
// To create context menu when click the point
pointClick: (args: IPointEventArgs) => {
if(menuObj && !menuObj.isDestroyed) {
menuObj.destroy();
}
menuObj = new ContextMenu(menuOptions, '#contextmenu');
} |
Screenshot:
Hope this helps.
Regards,
Kalai.