Package org.gephi.utils.sparklines
Class SparklineGraph
- java.lang.Object
-
- org.gephi.utils.sparklines.SparklineGraph
-
public class SparklineGraph extends Object
Class for drawing sparkline graphics.
Drawing settings are controlled with
SparklineParametersclassUse
SparklineComponentclass to easily include interactive sparklines in your GUI- Author:
- Eduardo Ramos
- See Also:
SparklineParameters
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classSparklineGraph.HighlightParameters
-
Field Summary
Fields Modifier and Type Field Description private static intHIGHLIGHT_RADIUS
-
Constructor Summary
Constructors Constructor Description SparklineGraph()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static StringbuildHighlightText(SparklineParameters.HighlightTextMode highlightTextMode, Number x, Number y)private static floatcalculateMax(Number[] yValues)private static floatcalculateMin(Number[] yValues)static BufferedImagedraw(Number[] xValues, Number[] yValues, Number yMinValue, Number yMaxValue, SparklineParameters parameters)Draw a sparkline with x axis and y axis values, and pre-calculated min and max of the y axis values.static BufferedImagedraw(Number[] xValues, Number[] yValues, SparklineParameters parameters)Draw a sparkline with x axis and y axis values.static BufferedImagedraw(Number[] yValues, Number yMinValue, Number yMaxValue, SparklineParameters parameters)Draw a sparkline only providing y axis values, and pre-calculated min and max of the y axis values.static BufferedImagedraw(Number[] values, SparklineParameters parameters)Draw a sparkline only providing y axis values (1 x tick per number assumed)private static voiddrawHighlight(Graphics2D g, float x, float y, Color highlightColor)
-
-
-
Field Detail
-
HIGHLIGHT_RADIUS
private static final int HIGHLIGHT_RADIUS
- See Also:
- Constant Field Values
-
-
Method Detail
-
draw
public static BufferedImage draw(Number[] values, SparklineParameters parameters)
Draw a sparkline only providing y axis values (1 x tick per number assumed)- Parameters:
values- Y axis valuesparameters- Rendering parameters- Returns:
- Image of the sparkline
-
draw
public static BufferedImage draw(Number[] xValues, Number[] yValues, SparklineParameters parameters)
Draw a sparkline with x axis and y axis values. X values must be ordered and not repeated.- Parameters:
xValues- X axis valuesyValues- Y axis valuesparameters- Rendering parameters- Returns:
- Image of the sparkline
-
draw
public static BufferedImage draw(Number[] yValues, Number yMinValue, Number yMaxValue, SparklineParameters parameters)
Draw a sparkline only providing y axis values, and pre-calculated min and max of the y axis values. Use this when you already have min/max values calculated and want to avoid extra calculations bySparklineGraph- Parameters:
yValues- Y axis valuesyMinValue- Minimum value of the Y axis, should be correctyMaxValue- Maximum value of the Y axis, should be correctparameters- Rendering parameters- Returns:
- Image of the sparkline
-
draw
public static BufferedImage draw(Number[] xValues, Number[] yValues, Number yMinValue, Number yMaxValue, SparklineParameters parameters)
Draw a sparkline with x axis and y axis values, and pre-calculated min and max of the y axis values. Use this when you already have min/max values calculated and want to avoid extra calculations bySparklineGraphX values must be ordered and not repeated.- Parameters:
xValues- X axis valuesyValues- Y axis valuesyMinValue- Minimum value of the Y axis, should be correctyMaxValue- Maximum value of the Y axis, should be correctparameters- Rendering parameters- Returns:
- Image of the sparkline
-
drawHighlight
private static void drawHighlight(Graphics2D g, float x, float y, Color highlightColor)
-
calculateMin
private static float calculateMin(Number[] yValues)
-
calculateMax
private static float calculateMax(Number[] yValues)
-
buildHighlightText
private static String buildHighlightText(SparklineParameters.HighlightTextMode highlightTextMode, Number x, Number y)
-
-