Add redirect link on bar chart and dounut chart

Hi There ,

I have created  bar chart and dounught chart, I want to redirect into the page on click of chart with their values,

how can I achieve this , please Help


1 Reply

SB Swetha Babu Syncfusion Team August 17, 2022 10:57 AM UTC

Hi Tejaswee,


Greetings from Syncfusion.


We can get the value of the clicked point by using the point argument in pointClick event of the Chart and redirect to an other page when clicking on the point by using the pointClick event. However, we have created two react sample one for Chart and other for Pie chart to demonstrate the same. Please find the below stackblitz links for your sample reference.


Chart Sample link: https://stackblitz.com/edit/react-fby3o1?file=index.js


Pie Chart Sample link: https://stackblitz.com/edit/react-a3x3pr?file=index.js


Code Snippet:


<ChartComponent pointClick={this.click.bind(this)}></ChartComponent>

 

click(args) {

       console.log(args.point);

       window.location.rel='nofollow' href = “https://ej2.syncfusion.com/home/”;

    }

    ;


Screenshot:


Chart:




Pie chart:



Kindly, revert us if you have any concerns.


Regards,

Swetha


Loader.
Up arrow icon