Soler
Soler

Reputation: 119

How to load a new dashboard in Dashing when you click on a bar in the highbar widget

I am creating a dashboard in Dashing and am using the highbar widget to display some data. I want to be able to load a new dashboard displaying more detailed data about what you clicked on when you click on a particular bar. I know how to load a new dashboard when you click on a widget, but I want to do it for the specific bars. Any ideas? The documentation for Dashing is pretty scarce.

Upvotes: 1

Views: 738

Answers (1)

Soler
Soler

Reputation: 119

I have figured this out. I found the HighCharts API Reference and it is a great resource.

Specifically if you look here you will see an example of exactly what I was trying to do. Basically in the highbar.coffee file, you have to include

chart:
  plotOptions:
    column:
      point:
        events:
          click: ->
            location.href = 'the dashboard location you want to go to'

Likewise the Javascript code from the example for an alert box they provide looks like

$(function () {
$('#container').highcharts({
    chart: {
        type: 'column'
    },
    xAxis: {
        categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
    },

    plotOptions: {
        series: {
            cursor: 'pointer',
            point: {
                events: {
                    click: function() {
                        alert ('Category: '+ this.category +', value: '+ this.y);
                    }
                }
            }
        }
    },

    series: [{
        data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]        
    }]
});
});

Upvotes: 1

Related Questions