|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.perf4j.chart.GoogleChartGenerator
public class GoogleChartGenerator
This implementation of StatisticsChartGenerator creates a chart URL in the format expected by the Google Chart API.
Field Summary | |
---|---|
static String |
DEFAULT_BASE_URL
The DEFAULT_BASE_URL points to Google's charting server at chart.apis.google.com. |
static int |
DEFAULT_CHART_HEIGHT
The default chart height is 400 pixels. |
static int |
DEFAULT_CHART_WIDTH
The default chart width is 750 pixels. |
static String[] |
DEFAULT_SERIES_COLORS
The default hex color codes used for the individual data series displayed on the chart. |
static int |
MAX_POSSIBLE_CHART_SIZE
The maximum supported chart size is 300,000 pixels per the Google Chart API. |
Fields inherited from interface org.perf4j.chart.StatisticsChartGenerator |
---|
DEFAULT_MAX_DATA_POINTS |
Constructor Summary | |
---|---|
GoogleChartGenerator()
Default constructor creates a chart that displays mean execution values and uses the default Google Chart URL. |
|
GoogleChartGenerator(StatsValueRetriever statsValueRetriever)
Creates a chart that uses the specified StatsValueRetriever to determine which values from the TimingStatistic object to display. |
|
GoogleChartGenerator(StatsValueRetriever valueRetriever,
String baseUrl)
Creates a chart that uses the specified StatsValueRetriever to determine which values from the StatsPerTag object to display, and also allows the base chart URL to be overridden from the Google default. |
Method Summary | |
---|---|
void |
appendData(GroupedTimingStatistics statistics)
Appends a set of statistics to the list of data to be displayed on the chart. |
protected String |
encodeUrl(String string)
Helper method encodes a string use as a URL parameter value. |
protected String |
generateGoogleChartParams()
Helper method takes the list of data values and converts them to a String suitable for appending to a Google Chart URL. |
String |
getChartUrl()
Implementing classes should return a URL to the chart that depicts the data sent in to the appendData method. |
List<GroupedTimingStatistics> |
getData()
Gets the data that will be visualized by any charts created by this chart generator. |
Set<String> |
getEnabledTags()
Gets the set of tag names for which values will be displayed on the chart. |
int |
getHeight()
Gets the height of the chart that will be displayed |
int |
getMaxDataPoints()
Gets the maximum number of data points to display on a chart. |
int |
getWidth()
Gets the width of the chart that will be displayed |
protected String |
numberValuesToGoogleDataSeriesParam(List<Number> values,
double minPossibleValue,
double maxPossibleValue)
This helper method is used to normalize a list of data values from 0 - 100 as required by the Google Chart Data API, and from this data it constructs the series data URL param. |
void |
setEnabledTags(Set<String> enabledTags)
Sets the set of tag names for which values will be displayed on the chart. |
void |
setHeight(int height)
Sets the height of the chart in pixels. |
void |
setMaxDataPoints(int maxDataPoints)
Sets the maximum number of data points to display on a chart. |
void |
setWidth(int width)
Sets the width of the chart in pixels. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String DEFAULT_BASE_URL
public static final int MAX_POSSIBLE_CHART_SIZE
public static final int DEFAULT_CHART_WIDTH
public static final int DEFAULT_CHART_HEIGHT
public static final String[] DEFAULT_SERIES_COLORS
Constructor Detail |
---|
public GoogleChartGenerator()
public GoogleChartGenerator(StatsValueRetriever statsValueRetriever)
statsValueRetriever
- The StatsPerTagDataValueExtractor that determines which value to display.public GoogleChartGenerator(StatsValueRetriever valueRetriever, String baseUrl)
valueRetriever
- Determines which value (such as mean/min/max/etc) from the TimingStatistic to display on
the chartbaseUrl
- A value to override for the default base URL of "http://chart.apis.google.com/chart?"Method Detail |
---|
public int getWidth()
public void setWidth(int width)
width
- the width of the chart in pixels.public int getHeight()
public void setHeight(int height)
height
- the height of the chart in pixels.public Set<String> getEnabledTags()
public void setEnabledTags(Set<String> enabledTags)
enabledTags
- The set of enabled tag names. If this method is not called, or if enabledTags is null,
then ALL tags from the GroupedTimingStatistics data will be displayed on the chart.public int getMaxDataPoints()
public void setMaxDataPoints(int maxDataPoints)
maxDataPoints
- The maximum number of data points.public List<GroupedTimingStatistics> getData()
StatisticsChartGenerator
getData
in interface StatisticsChartGenerator
public void appendData(GroupedTimingStatistics statistics)
StatisticsChartGenerator
appendData
in interface StatisticsChartGenerator
statistics
- the statistics to be added to the list of data.public String getChartUrl()
StatisticsChartGenerator
getChartUrl
in interface StatisticsChartGenerator
protected String generateGoogleChartParams()
protected String numberValuesToGoogleDataSeriesParam(List<Number> values, double minPossibleValue, double maxPossibleValue)
values
- the values to be normalizedminPossibleValue
- the minimum possible value for the valuesmaxPossibleValue
- the maximmum possible value for the values
protected String encodeUrl(String string)
string
- the string to encode
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |