<script type="text/javascript">
var dashboardId = 'Sales';
var revealSettings = new $.ig.RevealSettings(dashboardId);
$.ig.RevealUtility.loadDashboard(dashboardId, function (dashboard) {
revealSettings.dashboard = dashboard;
revealSettings.showFilters = false;
window.revealView = new $.ig.RevealView("#revealView", revealSettings);
var filter = window.revealView.dashboard.getFilterByTitle('Territory');
$.ig.RevealUtility.getFilterValues(dashboard, filter, function (values) {
window.territories = values;
var buttonsPanel = $('#buttonsPanel')[0];
for (var i = 0; i < values.length; i++) {
var button = $('<button onclick="setSelectedTerritory(window.territories[' + i + '].values)">' + values[i].label + '</button>');
buttonsPanel.append(button[0]);
}
}, function (error) {
console.log(error);
});
}, function (error) {
console.log(error);
});
function setSelectedTerritory(territory) {
var filter = window.revealView.dashboard.getFilterByTitle('Territory');
window.revealView.setFilterSelectedValues(filter, [territory]);
}
</script>
<section style="display:grid;grid-template-rows:30px auto;">
<section style="display:grid;grid-template-columns:auto auto auto auto auto;" id="buttonsPanel">
</section>
<div id="revealView" style="height:500px;" />
</section>