Dropbown to adjust Date Aggregation Unit


#1

Hi,

I’m building workload tracking graph with Dashboard Designer and am using several dropdown to adjust my graph.

I got two of them (Project group and timeframe selectors, in green in the screenshot) working properly, using

if (processor && !processor.subscribed) {
$(’#mydropbown’).bind(“DOMSubtreeModified”,function(){
el.html(’loading...’);
processor.process(el);
});
processor.subscribed = true;
}

in handlers.finish on the datasource side to capture the dropdown action and rebuilding the query.

I also managed to programatically change the Date Aggregation Unit setting config.categoryAxis.baseUnit in handlers.preRender but would it be possible to add it to a kind of handlers.finish to the Dashboard side to get the same “refresh” behavior that on the dataside ?


#2

Dear Tonio,
It is possible to change base unit with JavaScript. First, add these two lines to preRender before return true:

window.$ = $;
console.log(el.selector);

First line will make JQuery available on the page, second will allow you to get ID of the chart you want to change. Then you can bind code like this to change event of the dropdown and change base unit dynamically:

$('#chartg_7bb98786_3e63_4149_b90f_ef2fc623c5fa').data('kendoChart').setOptions({
  categoryAxis: {
    baseUnit: 'days'
  }
});

You’ll obviously need to customize it, so it can read value from the dropdown and change baseUnit to an appropriate one, but this should work. Tell us if you’ll experience any trouble, we’ll try to find a way to resolve it.