You must be logged in to post your query.
Home › Forums › Chart Support › Whole canvas as a hyperlink
Tagged: linking
Hello.
How can I make the whole chart canvas to be linked to another page? I tried to add the “a” tag to the chart canvas container, but it allows clicking and transferring to another page only when you click on the tooltip. What I need is to be able to click in any place of the chart and go to a certain page.
Use onclick to make whole canvas to be linked to another page/ url as shown below, <div id="chartContainer" onclick="redirect()"></div> then add a function “redirect” to your javascript code, which will contain a link to another page/ url
<div id="chartContainer" onclick="redirect()"></div>
function redirect() { window.location = "https://canvasjs.com/" ;// loads webpage in the current tab // window.open = "https://canvasjs.com/" ;// loads webpage in the new tab }
Thank you.
Hmm, it appeared to be working only on desktop browsers. On mobile devices you have to tap at least 10 times to trigger the ‘onclick’ event. Do you know what the problem is?
Hi, please help me how to create hyperlink to each sub chart of the canvas??
vinay,
You can href the chart-container div. Here is an example.
You must be logged in to reply to this topic. Login/Register