Package org.gephi.utils.sparklines
Class SparklineParameters
- java.lang.Object
-
- org.gephi.utils.sparklines.SparklineParameters
-
public class SparklineParameters extends Object
Sparkline rendering settings:- Width and height of the graphic in pixels
- Line color. Blue by default if null
- Optional area color under the line, no area by default
- Color for the background of the graphic. White by default if null
- Highlight colors with a dot for min and max values, null (no highlight) by default
- Highlight colors with a dot for a value closest to the given x pixel position(
highlightedValueXPosition), magenta by default if null andhighlightedValueXPositionis not null - Highlighted value text color, used if
highlightedValueXPositionis provided. By default (x,y) values are shown, usehighlightTextModeto control this. - Highlighted value text box color, used if
highlightedValueXPositionandhighlightTextColorare provided
- Author:
- Eduardo Ramos
- See Also:
SparklineGraph
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSparklineParameters.HighlightTextModeDefines what text is shown when highlightTextColor is not null.
-
Field Summary
Fields Modifier and Type Field Description private ColorareaColorprivate ColorbackgroundColorstatic ColorDEFAULT_AREA_COLORstatic ColorDEFAULT_BACKGROUND_COLORstatic SparklineParameters.HighlightTextModeDEFAULT_HIGHLIGHT_TEXT_MODEstatic ColorDEFAULT_HIGHLIGHT_VALUE_COLORstatic ColorDEFAULT_LINE_COLORstatic ColorDEFAULT_TEXT_BOX_COLORstatic ColorDEFAULT_TEXT_COLORprivate booleandrawAreaprivate intheightprivate IntegerhighlightedValueXPositionprivate ColorhighlightMaxColorprivate ColorhighlightMinColorprivate ColorhighlightTextBoxColorprivate ColorhighlightTextColorprivate SparklineParameters.HighlightTextModehighlightTextModeprivate ColorhighligtValueColorprivate ColorlineColorprivate booleantransparentBackgroundprivate intwidth
-
Constructor Summary
Constructors Constructor Description SparklineParameters(int width, int height)Create a simple sparkline parameters with only linesSparklineParameters(int width, int height, Color lineColor)Create a simple sparkline parameters with only lines and a specific line colorSparklineParameters(int width, int height, Color lineColor, Color backgroundColor)Create a simple sparkline parameters with only lines and a specific line color and background colorSparklineParameters(int width, int height, Color lineColor, Color backgroundColor, Color highlightMinColor, Color highlightMaxColor)Create a sparkline parameters specifying colors for line, background, and max/min highlight colors (no highlight if null)SparklineParameters(int width, int height, Color lineColor, Color backgroundColor, Color highlightMinColor, Color highlightMaxColor, Integer highlightedValueXPosition)Create a sparkline parameters specifying colors for line, background, and max/min highlight colors (no highlight if null) and a x pixel position to highlight closest value with default highlight text and text box colors and defaultHighlightTextMode.SparklineParameters(int width, int height, Color lineColor, Color backgroundColor, Color highlightMinColor, Color highlightMaxColor, Integer highlightedValueXPosition, Color highligtValueColor, Color highlightTextColor, Color highlightTextBoxColor, SparklineParameters.HighlightTextMode highlightTextMode)Create a sparkline parameters specifying colors for line, background, and max/min highlight colors (no highlight if null) and a x pixel position to highlight closest value with specific highlight text and text box colors andHighlightTextMode.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ColorgetAreaColor()Returns current areaColor.ColorgetBackgroundColor()Returns current background color.intgetHeight()Returns current height for the sparkline in pixels.IntegergetHighlightedValueXPosition()Returns current X position for highlighting the closest value.ColorgetHighlightMaxColor()Returns current highlightMaxColor.ColorgetHighlightMinColor()Returns current highlightMinColor.ColorgetHighlightTextBoxColor()Returns current color for the highlighted value text bounding box.ColorgetHighlightTextColor()Returns current color for the highlighted value text.SparklineParameters.HighlightTextModegetHighlightTextMode()Return current HighlightTextModeColorgetHighligtValueColor()Returns current color for the highlighted value.ColorgetLineColor()Returns current color for the sparkline line.intgetWidth()Returns current width for the sparkline in pixels.booleanisDrawArea()Checks if the area under the line is enabled.booleanisTransparentBackground()Checks if transparent background is enabled.voidsetAreaColor(Color areaColor)Set color to fill the area under the line.voidsetBackgroundColor(Color backgroundColor)Set background color.voidsetDrawArea(boolean drawArea)Set draw area.voidsetHeight(int height)Set height for the sparkline in pixels.voidsetHighlightedValueXPosition(Integer highlightedValueXPosition)Set a X position in pixels to find closest value in the sparkline and highlight it.voidsetHighlightMaxColor(Color highlightMaxColor)Set color for the maximum value highlight, or null to draw no highlight.voidsetHighlightMinColor(Color highlightMinColor)Set color for the minimum value highlight, or null to draw no highlight.voidsetHighlightTextBoxColor(Color highlightTextBoxColor)Set color for the highlighted value text bounding box, or null to draw no box.voidsetHighlightTextColor(Color highlightTextColor)Set color for the highlighted value text, or null to draw no text.voidsetHighlightTextMode(SparklineParameters.HighlightTextMode highlightTextMode)Set HighlightTextModevoidsetHighligtValueColor(Color highligtValueColor)Set color for the value highlight, magenta is used if it is null.voidsetLineColor(Color lineColor)Set color for the sparkline line.voidsetTransparentBackground(boolean transparentBackground)Set transparent background.voidsetWidth(int width)Set width for the sparkline in pixels.
-
-
-
Field Detail
-
DEFAULT_LINE_COLOR
public static final Color DEFAULT_LINE_COLOR
-
DEFAULT_AREA_COLOR
public static final Color DEFAULT_AREA_COLOR
-
DEFAULT_BACKGROUND_COLOR
public static final Color DEFAULT_BACKGROUND_COLOR
-
DEFAULT_HIGHLIGHT_VALUE_COLOR
public static final Color DEFAULT_HIGHLIGHT_VALUE_COLOR
-
DEFAULT_TEXT_COLOR
public static final Color DEFAULT_TEXT_COLOR
-
DEFAULT_TEXT_BOX_COLOR
public static final Color DEFAULT_TEXT_BOX_COLOR
-
DEFAULT_HIGHLIGHT_TEXT_MODE
public static final SparklineParameters.HighlightTextMode DEFAULT_HIGHLIGHT_TEXT_MODE
-
width
private int width
-
height
private int height
-
lineColor
private Color lineColor
-
areaColor
private Color areaColor
-
backgroundColor
private Color backgroundColor
-
transparentBackground
private boolean transparentBackground
-
drawArea
private boolean drawArea
-
highlightMinColor
private Color highlightMinColor
-
highlightMaxColor
private Color highlightMaxColor
-
highlightedValueXPosition
private Integer highlightedValueXPosition
-
highligtValueColor
private Color highligtValueColor
-
highlightTextColor
private Color highlightTextColor
-
highlightTextBoxColor
private Color highlightTextBoxColor
-
highlightTextMode
private SparklineParameters.HighlightTextMode highlightTextMode
-
-
Constructor Detail
-
SparklineParameters
public SparklineParameters(int width, int height)Create a simple sparkline parameters with only lines- Parameters:
width- Width in pixelsheight- Height in pixels
-
SparklineParameters
public SparklineParameters(int width, int height, Color lineColor)Create a simple sparkline parameters with only lines and a specific line color- Parameters:
width- Width in pixelsheight- Height in pixelslineColor- Lines color
-
SparklineParameters
public SparklineParameters(int width, int height, Color lineColor, Color backgroundColor)Create a simple sparkline parameters with only lines and a specific line color and background color- Parameters:
width- Width in pixelsheight- Height in pixelslineColor- Lines colorbackgroundColor- Background color
-
SparklineParameters
public SparklineParameters(int width, int height, Color lineColor, Color backgroundColor, Color highlightMinColor, Color highlightMaxColor)Create a sparkline parameters specifying colors for line, background, and max/min highlight colors (no highlight if null)- Parameters:
width- Width in pixelsheight- Height in pixelslineColor- Lines colorbackgroundColor- Background colorhighlightMinColor- Min value highlight color or nullhighlightMaxColor- Max value highlight color or null
-
SparklineParameters
public SparklineParameters(int width, int height, Color lineColor, Color backgroundColor, Color highlightMinColor, Color highlightMaxColor, Integer highlightedValueXPosition)Create a sparkline parameters specifying colors for line, background, and max/min highlight colors (no highlight if null) and a x pixel position to highlight closest value with default highlight text and text box colors and defaultHighlightTextMode.- Parameters:
width- Width in pixelsheight- Height in pixelslineColor- Lines colorbackgroundColor- Background colorhighlightMinColor- Min value highlight color or nullhighlightMaxColor- Max value highlight color or nullhighlightedValueXPosition- X position in pixels to find closest value in the sparkline
-
SparklineParameters
public SparklineParameters(int width, int height, Color lineColor, Color backgroundColor, Color highlightMinColor, Color highlightMaxColor, Integer highlightedValueXPosition, Color highligtValueColor, Color highlightTextColor, Color highlightTextBoxColor, SparklineParameters.HighlightTextMode highlightTextMode)Create a sparkline parameters specifying colors for line, background, and max/min highlight colors (no highlight if null) and a x pixel position to highlight closest value with specific highlight text and text box colors andHighlightTextMode.- Parameters:
width- Width in pixelsheight- Height in pixelslineColor- Lines colorbackgroundColor- Background colorhighlightMinColor- Min value highlight color or nullhighlightMaxColor- Max value highlight color or nullhighlightedValueXPosition- X position in pixels to find closest value in the sparklinehighligtValueColor- Highlighted value color (Magenta if null)highlightTextColor- Highlighted value text color or nullhighlightTextBoxColor- Highlighted value text box color or nullhighlightTextMode- What to show on the highlight text (x and/or y values)
-
-
Method Detail
-
getBackgroundColor
public Color getBackgroundColor()
Returns current background color.- Returns:
- Current background color
-
setBackgroundColor
public void setBackgroundColor(Color backgroundColor)
Set background color. If null and transparent background is not enabled, white will be used by default.- Parameters:
backgroundColor- New background color
-
getHeight
public int getHeight()
Returns current height for the sparkline in pixels.- Returns:
- Current height for the sparkline in pixels
-
setHeight
public void setHeight(int height)
Set height for the sparkline in pixels.- Parameters:
height- Height in pixels
-
getHighlightTextBoxColor
public Color getHighlightTextBoxColor()
Returns current color for the highlighted value text bounding box.- Returns:
- Current highlightTextBoxColor
-
setHighlightTextBoxColor
public void setHighlightTextBoxColor(Color highlightTextBoxColor)
Set color for the highlighted value text bounding box, or null to draw no box. Used only if highlightedValueXPosition is not null.- Parameters:
highlightTextBoxColor- New highlightTextBoxColor or null
-
getHighlightTextColor
public Color getHighlightTextColor()
Returns current color for the highlighted value text.- Returns:
- Current highlightTextColor
-
setHighlightTextColor
public void setHighlightTextColor(Color highlightTextColor)
Set color for the highlighted value text, or null to draw no text. Used only if highlightedValueXPosition is not null.- Parameters:
highlightTextColor- New highlightTextColor or null
-
getHighligtValueColor
public Color getHighligtValueColor()
Returns current color for the highlighted value.- Returns:
- Current highligtValueColor
-
setHighligtValueColor
public void setHighligtValueColor(Color highligtValueColor)
Set color for the value highlight, magenta is used if it is null. Used only if highlightedValueXPosition is not null.- Parameters:
highligtValueColor- New highligtValueColor
-
getHighlightMaxColor
public Color getHighlightMaxColor()
Returns current highlightMaxColor.- Returns:
- Current highlightMaxColor
-
setHighlightMaxColor
public void setHighlightMaxColor(Color highlightMaxColor)
Set color for the maximum value highlight, or null to draw no highlight.- Parameters:
highlightMaxColor- New highlightMaxColor
-
getHighlightMinColor
public Color getHighlightMinColor()
Returns current highlightMinColor.- Returns:
- Current highlightMinColor
-
setHighlightMinColor
public void setHighlightMinColor(Color highlightMinColor)
Set color for the minimum value highlight, or null to draw no highlight.- Parameters:
highlightMinColor- New highlightMinColor
-
getHighlightedValueXPosition
public Integer getHighlightedValueXPosition()
Returns current X position for highlighting the closest value.- Returns:
- Current highlightedValueXPosition in pixels
-
setHighlightedValueXPosition
public void setHighlightedValueXPosition(Integer highlightedValueXPosition)
Set a X position in pixels to find closest value in the sparkline and highlight it.
If null or out of the sparkline width range, no value is highlighted.
- Parameters:
highlightedValueXPosition- New highlightedValueXPosition in pixels
-
getHighlightTextMode
public SparklineParameters.HighlightTextMode getHighlightTextMode()
Return current HighlightTextMode- Returns:
- Current HighlightTextMode
- See Also:
SparklineParameters.HighlightTextMode
-
setHighlightTextMode
public void setHighlightTextMode(SparklineParameters.HighlightTextMode highlightTextMode)
Set HighlightTextMode- Parameters:
highlightTextMode- New HighlightTextMode- See Also:
SparklineParameters.HighlightTextMode
-
getLineColor
public Color getLineColor()
Returns current color for the sparkline line.- Returns:
- Current line color
-
setLineColor
public void setLineColor(Color lineColor)
Set color for the sparkline line. If null, blue will be used by default.- Parameters:
lineColor- New lineColor
-
getWidth
public int getWidth()
Returns current width for the sparkline in pixels.- Returns:
- Current width for the sparkline in pixels
-
setWidth
public void setWidth(int width)
Set width for the sparkline in pixels.- Parameters:
width- width in pixels
-
isTransparentBackground
public boolean isTransparentBackground()
Checks if transparent background is enabled.- Returns:
- transparent background enabled
-
setTransparentBackground
public void setTransparentBackground(boolean transparentBackground)
Set transparent background. If true, background color is ignored and no background is drawn.- Parameters:
transparentBackground- transparent background enabled
-
getAreaColor
public Color getAreaColor()
Returns current areaColor.- Returns:
- Current areaColor
-
setAreaColor
public void setAreaColor(Color areaColor)
Set color to fill the area under the line. If null, semi-transparent default line color will be used. Used only if draw area is enabled.- Parameters:
areaColor- New areaColor
-
isDrawArea
public boolean isDrawArea()
Checks if the area under the line is enabled.- Returns:
- draw area enabled
-
setDrawArea
public void setDrawArea(boolean drawArea)
Set draw area. If true, the area under the line is filled with areaColor.- Parameters:
drawArea- draw area enabled
-
-