Show the amount of issues over time within a specific project.

Chart Preview



Parameters

ParameterType
in UIin Code

Project

Project_Param
Project Picker (single project)


Layout Script

Layout Script
c3.generate({
	data: chartData,
	axis: {
		x: {
			type: 'timeseries',
			label: {
				text: 'Months',
				position: 'outer-left'
			},
			tick: {
				format: '%B',
				culling: {
					max: 25
				},
				fit: true,
				multiline: false
			}
		},
		y: {
			label: 'Tickets'
		}
	}
})


Data Script

Data Script
import java.text.DateFormat;

import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.jql.builder.JqlClauseBuilder;
import com.atlassian.jira.jql.builder.JqlQueryBuilder;

import com.decadis.jira.xchart.api.ChartParam;
import com.decadis.jira.xchart.api.model.Period;
import com.decadis.jira.xchart.api.util.DateUtils;


DateFormat dateFormat = DateUtils.SimpleDateFormat;
JqlClauseBuilder jqlClauseBuilder = JqlQueryBuilder.newClauseBuilder();

if ( Project_Param != null )
{
  jqlClauseBuilder.project(Project_Param);//Project_Param is the parameter
}

List<Issue> issues = chartBuilder.getFilterUtils().performSearch(jqlClauseBuilder.buildQuery(), user);

def metaCountGroup = chartBuilder.newDataCollector();

for ( Issue issue : issues )
{
  Calendar cwCreated = dateUtils.getStartOfPeriod(issue.getCreated(), Period.MONTH);
  String cw = dateFormat.format(cwCreated.getTime());
  metaCountGroup.addValue(BigDecimal.ONE, issue.getIssueType().getName(), cw);
}

metaCountGroup.accumulateGroups();
def chartData = chartBuilder.newChartData("Issues");
chartData.setxFormat("%Y.%m.%d");
chartData.setType("area-spline");

chartBuilder.getChartUtil().transformResult(metaCountGroup, chartData, true);
return chartData;




On this page