public class ChartComponent extends Component
BASELINE, BOTTOM, BRB_CENTER_OFFSET, BRB_CONSTANT_ASCENT, BRB_CONSTANT_DESCENT, BRB_OTHER, CENTER, DRAG_REGION_LIKELY_DRAG_X, DRAG_REGION_LIKELY_DRAG_XY, DRAG_REGION_LIKELY_DRAG_Y, DRAG_REGION_NOT_DRAGGABLE, DRAG_REGION_POSSIBLE_DRAG_X, DRAG_REGION_POSSIBLE_DRAG_XY, DRAG_REGION_POSSIBLE_DRAG_Y, LEFT, RIGHT, TOP
Constructor and Description |
---|
ChartComponent(AbstractChart chart)
Creates a new chart component to display the provided chart.
|
Modifier and Type | Method and Description |
---|---|
protected Dimension |
calcPreferredSize()
Calculates the preferred size based on component content.
|
Point |
chartToScreenCoord(int x,
int y) |
Shape |
chartToScreenShape(Shape s) |
AbstractChart |
getChart()
Gets the chart that is being displayed in this component.
|
Transform |
getTransform()
Gets the transform for the chart.
|
boolean |
isPanEnabled()
Checks if panning is enabled.
|
boolean |
isZoomEnabled() |
void |
paint(Graphics g)
Paints the chart.
|
void |
pointerDragged(int[] x,
int[] y)
If this Component is focused, the pointer dragged event
will call this method
|
void |
pointerPressed(int x,
int y)
If this Component is focused, the pointer pressed event
will call this method
|
void |
pointerReleased(int x,
int y)
If this Component is focused, the pointer released event
will call this method
|
Point |
screenToChartCoord(int x,
int y)
Converts screen coordinates to chart coordinates.
|
Shape |
screenToChartShape(Shape s) |
protected void |
seriesPressed(SeriesSelection sel)
Called when a pointer is pressed on a series in the chart.
|
protected void |
seriesReleased(SeriesSelection sel)
Called when a pointer is released from a series in the chart.
|
void |
setChart(AbstractChart chart)
Sets the chart to be displayed in this component.
|
void |
setPanEnabled(boolean panEnabled) |
void |
setTransform(Transform transform)
Sets the transform for the chart.
|
void |
setZoomEnabled(boolean zoomEnabled) |
void |
zoomToShapeInChartCoords(Shape s)
Zooms the view port to show a specified shape.
|
void |
zoomToShapeInChartCoords(Shape s,
int duration)
Zooms the view port to show a specified shape.
|
addDragOverListener, addDropListener, addFocusListener, addPointerDraggedListener, addPointerPressedListener, addPointerReleasedListener, addPullToRefresh, addScrollListener, animate, bindProperty, calcScrollSize, cancelRepaints, clearClientProperties, contains, deinitialize, deinitializeCustomStyle, dragEnter, dragExit, draggingOver, dragInitiated, drawDraggedImage, drop, fireClicked, focusGained, focusLost, getAbsoluteX, getAbsoluteY, getBaseline, getBaselineResizeBehavior, getBindablePropertyNames, getBindablePropertyTypes, getBorder, getBottomGap, getBoundPropertyValue, getBounds, getClientProperty, getCloudBoundProperty, getCloudDestinationProperty, getComponentForm, getComponentState, getDirtyRegion, getDisabledStyle, getDraggedx, getDraggedy, getDragImage, getDragRegionStatus, getDragSpeed, getGridPosX, getGridPosY, getHeight, getLabelForComponent, getName, getNextFocusDown, getNextFocusLeft, getNextFocusRight, getNextFocusUp, getParent, getPreferredH, getPreferredSize, getPreferredW, getPressedStyle, getPropertyNames, getPropertyTypeNames, getPropertyTypes, getPropertyValue, getSameHeight, getSameWidth, getScrollable, getScrollAnimationSpeed, getScrollDimension, getScrollOpacity, getScrollOpacityChangeSpeed, getScrollX, getScrollY, getSelectCommandText, getSelectedRect, getSelectedStyle, getSideGap, getStyle, getTensileLength, getUIID, getUIManager, getUnselectedStyle, getVisibleBounds, getWidth, getX, getY, growShrink, handlesInput, hasFocus, initComponent, initCustomStyle, initLaf, installDefaultPainter, isAlwaysTensile, isCellRenderer, isDragActivated, isDragAndDropOperation, isDraggable, isDragRegion, isDropTarget, isEnabled, isFlatten, isFocusable, isGrabsPointerEvents, isHideInPortrait, isInClippingRegion, isInitialized, isRTL, isScrollable, isScrollableX, isScrollableY, isScrollVisible, isSelectableInteraction, isSmoothScrolling, isSnapToGrid, isStickyDrag, isTactileTouch, isTactileTouch, isTensileDragEnabled, isVisible, keyPressed, keyReleased, keyRepeated, laidOut, longKeyPress, longPointerPress, onScrollX, onScrollY, paintBackground, paintBackgrounds, paintBorder, paintComponent, paintComponent, paintLock, paintLockRelease, paintScrollbars, paintScrollbarX, paintScrollbarY, paramString, pinch, pointerDragged, pointerHover, pointerHoverPressed, pointerHoverReleased, pointerPressed, pointerReleased, putClientProperty, refreshTheme, refreshTheme, refreshTheme, removeDragOverListener, removeDropListener, removeFocusListener, removePointerDraggedListener, removePointerPressedListener, removePointerReleasedListener, removeScrollListener, repaint, repaint, requestFocus, resetFocusable, scrollRectToVisible, scrollRectToVisible, setAlwaysTensile, setBoundPropertyValue, setCellRenderer, setCloudBoundProperty, setCloudDestinationProperty, setComponentState, setDirtyRegion, setDisabledStyle, setDraggable, setDropTarget, setEnabled, setFlatten, setFocus, setFocusable, setGrabsPointerEvents, setHandlesInput, setHeight, setHideInPortrait, setInitialized, setIsScrollVisible, setLabelForComponent, setName, setNextFocusDown, setNextFocusLeft, setNextFocusRight, setNextFocusUp, setPreferredH, setPreferredSize, setPreferredW, setPressedStyle, setPropertyValue, setRTL, setSameHeight, setSameWidth, setScrollAnimationSpeed, setScrollOpacityChangeSpeed, setScrollSize, setScrollVisible, setScrollX, setScrollY, setSelectCommandText, setSelectedStyle, setShouldCalcPreferredSize, setSize, setSmoothScrolling, setSnapToGrid, setTactileTouch, setTensileDragEnabled, setTensileLength, setUIID, setUnselectedStyle, setVisible, setWidth, setX, setY, shouldBlockSideSwipe, styleChanged, toString, unbindProperty
public ChartComponent(AbstractChart chart)
chart
- The chart to be displayed in this component.public AbstractChart getChart()
protected Dimension calcPreferredSize()
Component
calcPreferredSize
in class Component
public void setChart(AbstractChart chart)
chart
- public void paint(Graphics g)
public Point screenToChartCoord(int x, int y)
x
- y
- public Point chartToScreenCoord(int x, int y)
public void zoomToShapeInChartCoords(Shape s)
s
- The shape that should be shown.public void zoomToShapeInChartCoords(Shape s, int duration)
s
- The shape that should be shown.duration
- The duration of the transition.public void pointerPressed(int x, int y)
Component
pointerPressed
in class Component
x
- the pointer x coordinatey
- the pointer y coordinateprotected void seriesPressed(SeriesSelection sel)
sel
- public void pointerReleased(int x, int y)
Component
pointerReleased
in class Component
x
- the pointer x coordinatey
- the pointer y coordinateprotected void seriesReleased(SeriesSelection sel)
sel
- public Transform getTransform()
public void setTransform(Transform transform)
transform
- the transform to setpublic void pointerDragged(int[] x, int[] y)
Component
pointerDragged
in class Component
x
- the pointer x coordinatey
- the pointer y coordinatepublic boolean isPanEnabled()
public void setPanEnabled(boolean panEnabled)
panEnabled
- the panEnabled to setpublic boolean isZoomEnabled()
public void setZoomEnabled(boolean zoomEnabled)
zoomEnabled
- the zoomEnabled to set