org.javasimon.utils
Class GoogleChartImageGenerator

java.lang.Object
  extended by org.javasimon.utils.GoogleChartImageGenerator

public final class GoogleChartImageGenerator
extends Object

Produces URLs for Google Chart Image API - column type. http://code.google.com/apis/chart/image/

Author:
Richard "Virgo" Richter

Field Summary
private static int BAR_SPACING
           
private static int BAR_SPACING_MAX_MIN
           
private static int BAR_WIDTH
           
private  double divisor
           
private  boolean first
           
private static int FIXED_WIDTH
           
private static int IMAGE_HEIGHT
           
private  double max
           
private static DecimalFormat NUMBER_FORMAT
           
private static List<Replacer> REPLACERS
           
private  StopwatchSample[] samples
           
private  boolean showMaxMin
           
private static int TEN_BASE
           
private  String title
           
private static String TYPE_BAR1
           
private static String TYPE_BAR2
           
private  String unit
           
private static String URL_START
           
 
Constructor Summary
private GoogleChartImageGenerator(StopwatchSample[] samples, String title, double divisor, String unit, boolean showMaxMin)
           
 
Method Summary
private  String addValueToAxis(StringBuilder axis, double value)
           
static String barChart(StopwatchSample[] samples, String title, double divisor, String unit, boolean showMaxMin)
          Generates Google bar chart URL for the provided samples.
private static String encode(String s)
           
private  String process()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FIXED_WIDTH

private static final int FIXED_WIDTH
See Also:
Constant Field Values

BAR_WIDTH

private static final int BAR_WIDTH
See Also:
Constant Field Values

BAR_SPACING

private static final int BAR_SPACING
See Also:
Constant Field Values

BAR_SPACING_MAX_MIN

private static final int BAR_SPACING_MAX_MIN
See Also:
Constant Field Values

IMAGE_HEIGHT

private static final int IMAGE_HEIGHT
See Also:
Constant Field Values

URL_START

private static final String URL_START
See Also:
Constant Field Values

TYPE_BAR1

private static final String TYPE_BAR1
See Also:
Constant Field Values

TYPE_BAR2

private static final String TYPE_BAR2
See Also:
Constant Field Values

NUMBER_FORMAT

private static final DecimalFormat NUMBER_FORMAT

REPLACERS

private static final List<Replacer> REPLACERS

TEN_BASE

private static final int TEN_BASE
See Also:
Constant Field Values

samples

private StopwatchSample[] samples

title

private String title

divisor

private double divisor

unit

private String unit

showMaxMin

private boolean showMaxMin

max

private double max

first

private boolean first
Constructor Detail

GoogleChartImageGenerator

private GoogleChartImageGenerator(StopwatchSample[] samples,
                                  String title,
                                  double divisor,
                                  String unit,
                                  boolean showMaxMin)
Method Detail

barChart

public static String barChart(StopwatchSample[] samples,
                              String title,
                              double divisor,
                              String unit,
                              boolean showMaxMin)
Generates Google bar chart URL for the provided samples.

Parameters:
samples - stopwatch samples
title - chart title
divisor - value divisor. For example: if values are in ns and ms are required, divisor should be set to 1000000.
unit - unit shown after values under every bar
showMaxMin - true if additional datasets for max and min values should be shown
Returns:
URL generating the bar chart

process

private String process()

addValueToAxis

private String addValueToAxis(StringBuilder axis,
                              double value)

encode

private static String encode(String s)


Copyright © 2013. All Rights Reserved.