rgiljohann Posted October 1, 2019 Report Share Posted October 1, 2019 Hello all, I am looking to create a column chart URL HERE that allows a user to click on one of the columns to go to a new page. I based my code below off of this jsfiddle. My goal is to have a user click on one of the columns to drill down to another page based on their selection, so if possible, I would love to also include the record as a parameter in the URL string. I cannot get the code below to work even though it works in js fiddle. If it helps, the graph is set so that there will only be 10 records no matter what. <script src="https://code.highcharts.com/highcharts.js"></script> <script type="text/javascript"> Highcharts.chart('container', { chart: { type: 'column' }, title: { text: 'Click points to go to URL' }, xAxis: { type: 'category' }, plotOptions: { series: { cursor: 'pointer', point: { events: { click: function () { location.href = 'https://en.wikipedia.org/wiki/'; } } } } }, series: [{ data: [{ x: 1, }, { x: 2 }, { x: 3, }] }] });</script> Quote Link to comment Share on other sites More sharing options...
Hastur Posted October 1, 2019 Report Share Posted October 1, 2019 Hello @rgiljohann Here is the example of the code you may use with Column chart to implement redirection: <script type="text/javascript"> document.addEventListener('DataPageReady', function (event) { var chart = Highcharts.charts[0]; console.log(chart); chart.update( { plotOptions: { series: { pointWidth: 20, cursor: 'pointer', point: { events: { click: function () { location.href = 'https://en.wikipedia.org/wiki/' + this.name; } } } } }, } ); }); </script> Insert this code into the Header of your chart datapage. Do not forget to disable the HTML editor. rgiljohann 1 Quote Link to comment Share on other sites More sharing options...
rgiljohann Posted October 1, 2019 Author Report Share Posted October 1, 2019 This is fantastic. Thank you so much!. Quote Link to comment Share on other sites More sharing options...
rgiljohann Posted October 1, 2019 Author Report Share Posted October 1, 2019 Last question... Is there something I need to do if I deploy this on a page with multiple datapages? For example, when I tested this by itself, it works perfectly, but when I deploy it on a Weebly page with other pages, it does not seem to work. Quote Link to comment Share on other sites More sharing options...
rgiljohann Posted October 1, 2019 Author Report Share Posted October 1, 2019 I ended up getting this to work. I had deployed by using the embed code and when I used a URL instead on my page it works. Quote Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.