Home forums Using CanvasJS Whole canvas as a hyperlink Reply To: Whole canvas as a hyperlink

#9491

ashishraaj
Participant

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

function redirect()
{
    window.location = "http://canvasjs.com/" ;// loads webpage in the current tab
    // window.open = "http://canvasjs.com/" ;// loads webpage in the new tab
}