public class

DataUtils

extends Object
java.lang.Object
   ↳ com.atlassian.jira.charts.util.DataUtils

Class Overview

Utility methods for manipulating data

Summary

Constants
int DAYS_LIMIT_DEFAULT
Public Constructors
DataUtils()
Public Methods
static <T extends Comparable> CategoryDataset getCategoryDataset(List<Map<T, Number>> dataMaps, String[] seriesNames)
static TimeSeriesCollection getTimeSeriesCollection(List<Map<RegularTimePeriod, Number>> dataMaps, String[] seriesNames, Class timePeriodClass)
static <T, N extends Number> Integer getTotalNumber(Map<T, N> data)
Finds the total of a map's values.
static <T> void makeCumulative(Map<T, Number> dataMap)
Switch a map from being discrete values to being cumulative.
static void normaliseDateRange(Map<RegularTimePeriod, List<Long>> dateMap, int days, Class period, TimeZone timeZone)
static void normaliseDateRangeCount(Map<RegularTimePeriod, Number> dateMap, int days, Class period, TimeZone timeZone)
static <T> void normaliseMapKeys(Map<T, Number> map1, Map<T, Number> map2)
This method takes two maps, and ensures that all the keys in one map are in the other map, and vice versa.
static int normalizeDaysValue(int days, ChartFactory.PeriodName period)
Trims days to a range of [1...MAX_FOR_PERIOD] where the max is defined in jira-application.properties for each period.
static TimeSeriesCollection reduceDataset(TimeSeriesCollection dataset, List rowKeysToKeep)
Reduce a given dataset to only contain a specified number of columns
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int DAYS_LIMIT_DEFAULT

Constant Value: 1000 (0x000003e8)

Public Constructors

public DataUtils ()

Public Methods

public static CategoryDataset getCategoryDataset (List<Map<T, Number>> dataMaps, String[] seriesNames)

public static TimeSeriesCollection getTimeSeriesCollection (List<Map<RegularTimePeriod, Number>> dataMaps, String[] seriesNames, Class timePeriodClass)

public static Integer getTotalNumber (Map<T, N> data)

Finds the total of a map's values.

Parameters
data The data map to add up
Returns
  • Integer with the total sum

public static void makeCumulative (Map<T, Number> dataMap)

Switch a map from being discrete values to being cumulative.

That is, if a map's values previously are:

Parameters
dataMap The datamap that will have its values changed to cumulative.

public static void normaliseDateRange (Map<RegularTimePeriod, List<Long>> dateMap, int days, Class period, TimeZone timeZone)

public static void normaliseDateRangeCount (Map<RegularTimePeriod, Number> dateMap, int days, Class period, TimeZone timeZone)

public static void normaliseMapKeys (Map<T, Number> map1, Map<T, Number> map2)

This method takes two maps, and ensures that all the keys in one map are in the other map, and vice versa.

Parameters
map1 The first map to combine
map2 The second map to combine

public static int normalizeDaysValue (int days, ChartFactory.PeriodName period)

Trims days to a range of [1...MAX_FOR_PERIOD] where the max is defined in jira-application.properties for each period. The default value of 1000 days will be used, if no mapping can be found for a particular period or if the property defined can't be parsed.

Parameters
days The days input by the user
period The period selected by the user
Returns
  • The no of days for which the chart will be generated!

public static TimeSeriesCollection reduceDataset (TimeSeriesCollection dataset, List rowKeysToKeep)

Reduce a given dataset to only contain a specified number of columns

Parameters
dataset The dataset to reduce
rowKeysToKeep The rows to keep
Returns
  • A reduced dataset copy.