paramaterized cohort visualization

This commit is contained in:
nathanlubchenco 2015-09-10 15:10:31 -06:00
parent 6210d6ab80
commit 6bd7dc9237
2 changed files with 16 additions and 4 deletions

View File

@ -2,6 +2,12 @@
var cohortVisualization = angular.module('redash.visualization');
cohortVisualization.config(['VisualizationProvider', function(VisualizationProvider) {
var editTemplate = '<cohort-editor2></cohort-editor2>';
var defaultOptions = {
timeInterval: 'daily'
};
VisualizationProvider.registerVisualization({
type: 'COHORT',
name: 'Cohort',
@ -49,13 +55,13 @@
container: container,
cohort: data,
title: null,
timeInterval: 'daily',
timeInterval: $scope.timeInterval,
labels: {
time: 'Activation Day',
time: 'Activation ' + $scope.timeLabel,
people: 'Users'
},
formatHeaderLabel: function (i) {
return "Day " + (i - 1);
return $scope.timeLabel + (i - 1);
}
});
}
@ -64,4 +70,4 @@
}
});
}());
}());

View File

@ -0,0 +1,6 @@
<div class="form-group">
<label class="control-label">Time Interval (daily, weekly, monthly)</label>
<input type="text" class="form-control" ng-model="cohortOptions.timeInterval">
<label class="control-label">Time Label </label>
<input type="text" class="form-control" ng-model="cohortOptions.timeLabel">
</div>