Drilling down for data with the point click event
So far we have only fiddled with the top countries ordered by gold medals. Let's see how we can use a Highcharts event to navigate around other charts in jQuery Mobile. Back with the pageinit
handler code for chart_page
, we declared the pointEvt
variable, which is a click
event handler shared by all the series in gold medal charts. The following code is for the event:
var pointEvt = { events: { click: function(evt) { document.location.href = './sport.html?country=' // Country code or name + encodeURIComponent(this.category) + // Medal color '&color=' + this.series.name; } } };
This event is triggered by touching a bar in a column chart or a slice in a pie chart. As a result, it loads a new document page (sport.html
) with a bar chart. The URL for the document page is built inside the handler with the selected country...