public class SparklineGraph2DRenderer extends Graph2DRenderer<SparklineGraph2DRendererUpdate>
A sparkline graph
aspectRatio
.
The aspect ratio should be set so that the line of the sparkline
never has a slope greater than 45-degrees.Modifier and Type | Field and Description |
---|---|
static List<InterpolationScheme> |
supportedInterpolationScheme
The set of interpolation schemes that are supported by the
SparklineGraph2DRenderer . |
backgroundColor, bottomAreaMargin, bottomMargin, g, labelColor, labelFont, labelFontMetrics, leftAreaMargin, leftMargin, referenceLineColor, rightAreaMargin, rightMargin, topAreaMargin, topMargin, xAreaCoordEnd, xAreaCoordStart, xLabelMargin, xPlotCoordEnd, xPlotCoordStart, xPlotCoordWidth, xPlotValueEnd, xPlotValueStart, xPointMargin, xReferenceCoords, xReferenceLabels, xReferenceValues, xValueScale, yAreaCoordEnd, yAreaCoordStart, yLabelMargin, yPlotCoordEnd, yPlotCoordHeight, yPlotCoordStart, yPlotValueEnd, yPlotValueStart, yPointMargin, yReferenceCoords, yReferenceLabels, yReferenceValues, yValueScale
Constructor and Description |
---|
SparklineGraph2DRenderer(int imageWidth,
int imageHeight)
Creates a new sparkline graph renderer.
|
Modifier and Type | Method and Description |
---|---|
protected Shape |
createShape(double x,
double y,
double size)
Creates a circle shape at the given position with given size.
|
void |
draw(Graphics2D g,
Point2DDataset data)
Draws the graph on the given graphics context.
|
protected void |
drawCircle(Graphics2D g,
Point2DDataset data,
int index,
Color color)
Draws a circle of a certain color at a certain position.
|
double |
getAspectRatio()
Gets the preferred width to height ratio that must be maintained within the graph area.
|
int |
getCircleDiameter()
Gets the diameter for all circles that are drawn along the line in pixels.
|
boolean |
getDrawCircles()
Gets the decision of whether the draw function also draws circles at important data points.
|
int |
getFirstIndex()
The index corresponding to the first value.
|
double |
getFirstValue()
Gets the first y-value in the list of data.
|
InterpolationScheme |
getInterpolation()
The current interpolation used for the line.
|
int |
getLastIndex()
The index corresponding to the last value.
|
double |
getLastValue()
Gets the last y-value in the list of data.
|
Color |
getLastValueColor()
Gets the color of the circle drawn at the last y-value.
|
int |
getMaxIndex()
The index corresponding to the maximum y-value.
|
double |
getMaxValue()
The maximum y-value in the list of data.
|
Color |
getMaxValueColor()
Gets the color of the circle drawn at the maximum y-value.
|
int |
getMinIndex()
The index corresponding to the minimum y-value.
|
double |
getMinValue()
Gets the minimum y-value in the list of data.
|
Color |
getMinValueColor()
Gets the color for the circle drawn at the minimum y-value.
|
SparklineGraph2DRendererUpdate |
newUpdate()
Creates an object that allows updating of sparkline parameters.
|
protected void |
processScaledValue(int index,
double valueX,
double valueY,
double scaledX,
double scaledY)
Operations for every value in data as it is processed.
|
void |
update(SparklineGraph2DRendererUpdate update)
Applies the update to the renderer.
|
calculateGraphArea, calculateLabels, calculateRanges, drawBackground, drawGraphArea, drawHorizontalReferenceLines, drawValueExplicitLine, drawValueLine, drawVerticalReferenceLines, drawXLabels, drawYLabels, getImageHeight, getImageWidth, getXAggregatedRange, getXAxisRange, getXPlotRange, getYAggregatedRange, getYAxisRange, getYPlotRange, scaledX, scaledY, setClip, setupDataAsAreas, setupDataAsPoints, setupXAsAreas, setupXAsPoints, setupYAsAreas, setupYAsPoints
public static List<InterpolationScheme> supportedInterpolationScheme
SparklineGraph2DRenderer
.
The interpolation schemes supported are NEAREST_NEIGHBOR
, LINEAR
, and CUBIC
.public SparklineGraph2DRenderer(int imageWidth, int imageHeight)
imageWidth
- the graph width in pixelsimageHeight
- the graph height in pixelspublic void draw(Graphics2D g, Point2DDataset data)
g
- the graphics on which to display the datadata
- the data to displayprotected void drawCircle(Graphics2D g, Point2DDataset data, int index, Color color)
g
- graphic context to draw (where circles are drawn)data
- set of data that is graphedindex
- position in the data set where the circle is drawn (index position)color
- color of circle that is drawnprotected Shape createShape(double x, double y, double size)
x
- x position of shapey
- y position of shapesize
- diameter of circleprotected void processScaledValue(int index, double valueX, double valueY, double scaledX, double scaledY)
processScaledValue
in class Graph2DRenderer<SparklineGraph2DRendererUpdate>
index
- element position in data setvalueX
- x value being processedvalueY
- y value being processedscaledX
- x value scaled by datascaledY
- y value scaled by datapublic void update(SparklineGraph2DRendererUpdate update)
update
in class Graph2DRenderer<SparklineGraph2DRendererUpdate>
update
- the update to applypublic SparklineGraph2DRendererUpdate newUpdate()
newUpdate
in class Graph2DRenderer<SparklineGraph2DRendererUpdate>
public InterpolationScheme getInterpolation()
public int getMaxIndex()
public int getMinIndex()
public int getFirstIndex()
public int getLastIndex()
public double getMaxValue()
public double getMinValue()
public double getFirstValue()
public double getLastValue()
public boolean getDrawCircles()
public Color getMinValueColor()
public Color getMaxValueColor()
public Color getLastValueColor()
public int getCircleDiameter()
public double getAspectRatio()
Copyright © 2015. All rights reserved.