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;
|