DataType
- specifying the type of data the ChartDataViewer
is able to
display. The DataType has to be derivable from DataEntry
.public abstract class ChartDataViewer<DataType extends DataEntry> extends DataViewer<DataType>
Constructor and Description |
---|
ChartDataViewer(org.eclipse.swt.widgets.Composite parent,
boolean displayScale,
boolean autoAdjust,
double minValue,
double maxValue,
long timeToDisplay)
Creates a new
ChartDataViewer . |
Modifier and Type | Method and Description |
---|---|
protected void |
adjustBorderValues(double newLowerBorderValue,
double newUpperBorderValue)
Lets the
ChartDataViewer adjust the minimal and maximal values
that are displayed and redraw it's content according to the new values. |
protected abstract void |
borderValuesChanged()
Handles a change in the minimal or maximal values that are to be drawn.
|
protected abstract org.eclipse.swt.graphics.Rectangle[] |
calculateClipping(DataType data,
org.eclipse.swt.graphics.Point canvasSize)
Calculates the area to clip for given data to be drawn.
|
protected org.eclipse.swt.graphics.Point[] |
calculatePositionsFor(double[] values,
long time)
Calculates the positions on canvas for all values given at the time
given.
|
void |
draw(DataType data)
Lets the
ChartDataViewer draw data of type
DataType . |
protected abstract void |
drawValues(DataType data,
org.eclipse.swt.graphics.GC canvas,
org.eclipse.swt.graphics.Point canvasSize)
Draws given values on given
GC . |
protected abstract void |
fillCaption(DataType data,
Caption caption)
Fills given
Caption with information gathered from given data. |
double |
getLowerBorderValue() |
protected abstract long |
getTime(DataType data)
Calculates the time from given data.
|
long |
getTimeAtCanvasStart() |
long |
getTimeElapsed() |
long |
getTimeToDisplay() |
double |
getUpperBorderValue() |
protected abstract double[] |
isDataStillInBorderValues(DataType data)
Checks whether given data is still in range of upper and lower
border-values.
|
protected abstract void |
reset()
Resets the canvas.
|
changed, checkSubclass, computeSize, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList
computeTrim, getClientArea, getHorizontalBar, getVerticalBar
addControlListener, addDragDetectListener, addFocusListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTraverseListener, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getParent, getRegion, getShell, getSize, getToolTipText, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTraverseListener, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setParent, setRedraw, setRegion, setSize, setSize, setToolTipText, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, update
public ChartDataViewer(org.eclipse.swt.widgets.Composite parent, boolean displayScale, boolean autoAdjust, double minValue, double maxValue, long timeToDisplay)
ChartDataViewer
.parent
- the Composite
the viewer is to be placed in.displayScale
- determines whether a scale is to be displayed or not.autoAdjust
- determines whether the auto-adjust-feature is to be enabled by
default or not.minValue
- specifies the minimal value to be displayed by default.maxValue
- specifies the maximal value to be displayed by default.timeToDisplay
- specifies the time that is displayed on the x-axis by default.protected void adjustBorderValues(double newLowerBorderValue, double newUpperBorderValue)
ChartDataViewer
adjust the minimal and maximal values
that are displayed and redraw it's content according to the new values.newLowerBorderValue
- specifies the new minimal value.newUpperBorderValue
- specifies the new maximal value.protected org.eclipse.swt.graphics.Point[] calculatePositionsFor(double[] values, long time)
values
- the positions are to be calculated for.time
- the positions are to be calculated for.Point
s.public void draw(DataType data)
ChartDataViewer
draw data of type
DataType
.draw
in class DataViewer<DataType extends DataEntry>
data
- to be drawn.public double getUpperBorderValue()
public double getLowerBorderValue()
public long getTimeToDisplay()
public long getTimeElapsed()
public long getTimeAtCanvasStart()
protected abstract double[] isDataStillInBorderValues(DataType data)
data
- to be checked for.protected abstract long getTime(DataType data)
data
- time is to be calculated for.protected abstract org.eclipse.swt.graphics.Rectangle[] calculateClipping(DataType data, org.eclipse.swt.graphics.Point canvasSize)
data
- that is to be drawn.canvasSize
- the size of the canvas the data is to be drawn on.Rectangle
s representing the areas to clip.protected abstract void drawValues(DataType data, org.eclipse.swt.graphics.GC canvas, org.eclipse.swt.graphics.Point canvasSize)
GC
.data
- to be drawn.canvas
- to be drawn on.canvasSize
- the size of the canvas to be drawn on.protected abstract void borderValuesChanged()
protected abstract void reset()