The fallowing code will display a report showing how many issues are in a certain status, based on your choice of project and chart type.
number[] statusCount;
string [] issues = selectIssues( "project = " + argv[ 0 ]);
for (string iss in issues) {
string currStatus = iss.status;
if (isNull(statusCount[currStatus])) {
statusCount[currStatus] = 1 ;
} else {
statusCount[currStatus] += 1 ;
}
}
SILReportingChartDataset datasets;
datasets.label = "Issues" ;
datasets.backgroundColor = { "#3e95cd" , "#8e5ea2" , "#3cba9f" , "#e8c3b9" , "#c45850" };
datasets.data = statusCount;
SILReportingChartData data;
data.labels = arrayKeys(statusCount);
data.datasets = {datasets};
SILReportingChartTitle title;
title.display = true ;
title.text = "Issues in status" ;
SILReportingChartLegend legend;
legend.display = true ;
legend.position = "top" ;
SILReportingChartOptions options;
options.title = title;
options.aspectRatio = 1.5 ;
SILReportingChart chart;
chart.type = argv[ 1 ];
chart.data = data;
chart.options = options;
silreporting_createAutocompleteSelectList( "Project" , { "TEST" , "test" , "test" , "FIBER" , "FIBR" , "fibr" , "GERBEI" , "GRBI" , "grbi" }, "TEST" );
silreporting_createSelectList( "Chart Type" , { "Line" , "line" , "line" , "Bar" , "bar" , "bar" , "Pie" , "pie" , "pie" , "Doughnut" , "doughnut" , "doughnut" }, "pie" );
return chart;
|
