I`m trying to create a custom App for Rally.
Iteration defects by severity and below is my code.
var startdate;
var enddate;
var iterationid;
Ext.define('CustomApp', {
extend: 'Rally.app.App',
componentCls: 'app',
launch: function() {
var that = this;
that.getCurrentIteration(function(iterations){
console.log("getting iteration object");
startdate = _.map(iterations,function(i){return i.get("StartDate")});
enddate = _.map(iterations,function(i){return i.get("EndDate")});
iterationid = _.map(iterations,function(i){return i.get("ObjectID")});
that._load();
});
},
getCurrentIteration:function ( callback ) {
var today = Rally.util.DateTime.toIsoString(new Date());
Ext.create('Rally.data.wsapi.Store', {
model: 'Iteration',
autoLoad: true,
context : {
projectScopeDown : false
},
filters: [
{
property: 'EndDate', operator: '>=', value: today
},
{
property: 'StartDate', operator: '<=', value: today
}
],
listeners: {
load: function(store, data, success) {
callback(data);
}
},
fetch: true
});
},
_load:function(){
this.defineCalculator();
this.makeChart();
},
defineCalculator: function(){
var that = this;
Ext.define("MyDefectCalculator", {
extend: "Rally.data.lookback.calculator.TimeSeriesCalculator",
getMetrics: function () {
var metrics = [
{
field: "Severity",
as: "Catastrophic",
display: "column",
f: "filteredCount",
filterField: "Severity",
filterValues: ["1 - Catastrophic"]
},
{
field: "Severity",
as: "Severe",
display: "column",
f: "filteredCount",
filterField: "Severity",
filterValues: ["2 - Severe"]
},
{
field: "Severity",
as: "Non - Critical",
display: "column",
f: "filteredCount",
filterField: "Severity",
filterValues: ["3 - Non - Critical"]
},
{
field: "Severity",
as: "Minor",
display: "column",
f: "filteredCount",
filterField: "Severity",
filterValues: ["4 - Minor"]
},
{
field: "Severity",
as: "Enhancement",
display: "column",
f: "filteredCount",
filterField: "Severity",
filterValues: ["5 - Enhancement"]
}
];
return metrics;
}
});
},
makeChart: function(){
if (this.down('#myChart')) {
this.remove('myChart');
}
console.log(enddate[0])
var timePeriod = new Date(enddate[0] - startdate[0]);
var dayMilliSeconds = enddate[0].getTime() - 86400000;
var adjustedEnddate = new Date(dayMilliSeconds);
var project = this.getContext().getProject().ObjectID;
var storeConfig = this.createStoreConfig(project,timePeriod,iterationid);
this.chartConfig.calculatorConfig.startDate = startdate[0];
this.chartConfig.calculatorConfig.endDate = adjustedEnddate;
this.chartConfig.storeConfig = storeConfig;
this.add(this.chartConfig);
},
createStoreConfig : function(project,validFrom,iterationid1) {
return {
listeners : {
load : function(store,data) {
console.log("data",data.length);
}
},
filters: [
{
property: '_ProjectHierarchy',
operator : 'in',
value : [project]
},
{
property: 'Iteration',
operator: 'in',
value: iterationid1
},
{
property: '_TypeHierarchy',
operator: 'in',
value: ['Defect']
},
{
property: '_ValidFrom',
operator: '>',
value: validFrom
}
],
autoLoad : true,
limit: Infinity,
fetch: ['Severity'],
hydrate: ['Severity']
};
},
chartConfig: {
xtype: 'rallychart',
itemId : 'myChart',
chartColors: ['Red', 'Green', 'Yellow', 'Balck' , 'Brown'],
storeConfig: { },
calculatorType: 'MyDefectCalculator',
calculatorConfig: {
},
chartConfig: {
plotOptions: {
column: { stacking: 'normal'}
},
chart: { },
title: { text: 'Iteration Defects by Priority' },
xAxis: {
tickInterval: 1,
labels: {
formatter: function() {
var d = new Date(this.value);
return ""+(d.getMonth()+1)+"/"+d.getDate();
}
},
title: {
text: 'Date'
}
},
yAxis: [
{
tickInterval: 1,
title: {
text: 'Count'
}
}
]
}
}
});
I`m now getting the data and I managed to show it on the chart but the problem is the data is showing even for the future dates i.e.,my current iteration is from 13 to 26 and ideally it should show the data for 13, 14 and 15 which is today, but it is showing for all the dates.. can any one help me where the logic is missing to restrict this.
Thanks,
Surender