Use links in tooltips or chart labels

Hi

How to link a label or a tooltip

I tried to solve the problem with the help of the following code that I found in the forum, but the problem was not solved



<ej-chart id="container" axis-label-click="axisLabelClick"> </ej-chart>
function axisLabelClick(args) {                

var label = document.getElementById('container_svg_PrimaryAxis_XLabel_' + args.data.index);
                
var aEl = document.createElement('a');               
aEl.rel='nofollow' rel='nofollow' href = 'https://abc.com/users/' + label.innerHTML;
alert(aEl.rel='nofollow' rel='nofollow' href);
aEl.target = '_blank';
aEl.innerHTML = label.innerHTML;
aEl.click();            
}


I'm using version 19.1.0.5



3 Replies

DG Durga Gopalakrishnan Syncfusion Team July 26, 2021 12:36 PM UTC

Hi Alonekjco, 

Greetings from Syncfusion. 

We have applied cursor style for axis labels using CSS, changed the font color using labelStyle property and axisLabelClick event to open the required URL link. Please check with the below sample and snippet. 

<ejs-chart id="container" axisLabelClick="onAxisLabelClick"> 
</ejs-chart> 
<script> 
    function onAxisLabelClick(args) { 
        window.open(https://www.google.com); 
    } 
</script> 
<style> 
    #containerAxisLabels0, #containerAxisLabels1 { 
        cursor: pointer 
    } 
</style> 


 

Kindly revert us if you have any concerns. 

Regards, 
Durga G 



AL alonekjco July 26, 2021 09:10 PM UTC

Thank you. The problem was solved



DG Durga Gopalakrishnan Syncfusion Team July 27, 2021 06:24 AM UTC

Hi Alonekjco, 
  
Most welcome. Please get back to us if you need any further assistance. We are always happy in assisting you.. 
  
Regards, 
Durga G 


Loader.
Up arrow icon