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'
}
}
]
}
}
});
私は今データを取得しており、チャートに表示することができましたが、問題は将来の日付でもデータが表示されていることです。つまり、現在の反復は 13 から 26 であり、理想的には 13、14 のデータを表示する必要があります。今日は 15 ですが、すべての日付で表示されています。
Thanks,
Surender