In Sisense, widgets will be refreshed when
- we reload the dashboard
- change any filters
- click on refresh button which can be found in small popup when we click on i-button (in widget title bar).
Here is a script to add refresh button for a widget.
Steps:
Create Bar/Column/Line/Area/Pie chart
Add below script to widget
Save the script and refresh the widget
widget.on('processresult', function(se, ev){
ev.result.chart.marginTop= 60
});
var normalState = {
fill: '#ffffff',
stroke: '#d5d7de',
r: 3,
style: {
color: '#6D6D6D',
fontFamily: 'Open Sans',
borderWidth : 0
}
},
hoverState = {
fill: '#f4f4f4',
stroke: '#d5d7de',
r: 3,
style: {
color: '#6D6D6D',
fontFamily: 'Open Sans',
borderWidth : 0
}
},
pressedState = {
fill: '#f4f4f4',
stroke: '#d5d7de',
r: 3,
style: {
color: '#6D6D6D',
fontFamily: 'Open Sans',
borderWidth : 0
}
},
disabledState = {
fill: '#ffffff',
stroke: '#d5d7de',
r: 3,
style: {
color: '#6D6D6D',
fontFamily: 'Open Sans',
borderWidth : 0
}
},
callback = function () {
}
widget.on("domready", function(w){
chart = w.chart[0][Object.keys(w.chart[0])[0]].hc
chart.renderer.button('↻', 10, 10,
callback,
normalState,
hoverState,
pressedState,
disabledState)
.attr({
zIndex : 10,
height: 14,
width: 45,
'text-align': 'center'
})
.on('click', function() {
widget.refresh();
})
.add();
$('.widget-no-result-overlay').css('top', '80px')
});
Comments