com.atlassian.jira.charts.util
Class DataUtils

java.lang.Object
  extended by com.atlassian.jira.charts.util.DataUtils

public class DataUtils
extends Object

Utility methods for manipulating data

Since:
v4.0

Field Summary
static int DAYS_LIMIT_DEFAULT
           
 
Constructor Summary
DataUtils()
           
 
Method Summary
static
<T extends Comparable>
org.jfree.data.category.CategoryDataset
getCategoryDataset(List<Map<T,Number>> dataMaps, String[] seriesNames)
           
static org.jfree.data.time.TimeSeriesCollection getTimeSeriesCollection(List<Map<org.jfree.data.time.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<org.jfree.data.time.RegularTimePeriod,List<Long>> dateMap, int days, Class period, TimeZone timeZone)
           
static void normaliseDateRangeCount(Map<org.jfree.data.time.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 org.jfree.data.time.TimeSeriesCollection reduceDataset(org.jfree.data.time.TimeSeriesCollection dataset, List rowKeysToKeep)
          Reduce a given dataset to only contain a specified number of columns
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DAYS_LIMIT_DEFAULT

public static final int DAYS_LIMIT_DEFAULT
See Also:
Constant Field Values
Constructor Detail

DataUtils

public DataUtils()
Method Detail

getTotalNumber

public static <T,N extends Number> 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

normaliseMapKeys

public 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.

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

makeCumulative

public static <T> 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.

normaliseDateRangeCount

public static void normaliseDateRangeCount(Map<org.jfree.data.time.RegularTimePeriod,Number> dateMap,
                                           int days,
                                           Class period,
                                           TimeZone timeZone)

normaliseDateRange

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

reduceDataset

public static org.jfree.data.time.TimeSeriesCollection reduceDataset(org.jfree.data.time.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.

normalizeDaysValue

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!

getCategoryDataset

public static <T extends Comparable> org.jfree.data.category.CategoryDataset getCategoryDataset(List<Map<T,Number>> dataMaps,
                                                                                                String[] seriesNames)

getTimeSeriesCollection

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


Copyright © 2002-2013 Atlassian. All Rights Reserved.