Page tree
Skip to end of metadata
Go to start of metadata

It is possible to customize the status a JIRA issue passes through, but they are always assigned one out of three status categories. JIRA has no easy solution to report how many issues are currently in a state associated with the category "To Do", "In Progress" or "Done", so if you have a complex workflow it might be tricky to get the big picture. Many of our customers struggle with this. So now we will build an overview like that.

Most of the work (e.g. grouping by status category) is done within the converter, while we use a basic jql to retrieve all issues of a project.

If you would like to be guided through this example, refer to the blogpost we wrote on it.



Datasource

Datasource typeREST Application Link
Application LinkYour Company Jira
Datasource Test URL/rest/api/2/search

Query

Query URL
/rest/api/2/search?jql=project%3D:project
Query JSON path
$.issues

Converter

Converter to process result
function convert(json) {
    var statusCategories = [];
    var parsedJsonObject = JSON.parse(json);   // parse json string
     
    // iterate through issues and count occurences of statusCategories
    var index;
    for (index in parsedJsonObject) {   // iterate over all issues
        var currStatusCategory = parsedJsonObject[index].fields.status.statusCategory;
         
        if(statusCategories[currStatusCategory.name]) {   // category is already listed, increase counter
            statusCategories[currStatusCategory.name]++;
        } else {   // category is new, add it to our collection
            statusCategories[currStatusCategory.name] = 1;
        }
    }
     
    // build simple result for template
    var result = [];
    for (name in statusCategories) {
        result.push({
            'Category': name,
            'Number of Issues': statusCategories[name]
        });
    }
     
    result.sort(function(a,b) {        
        return a.Category < b.Category ? 1 : -1;    
    });
     
    return result;
}

Template

Default or this custom chart template:

Custom chart template
<script>
    PocketQuery.chart('ColumnChart', {
        width: 500,
        height: 500,
        bar: {groupWidth: "30%"},
        legend: {position: 'none'}
    });
</script>




  • No labels