org.achartengine
Class GraphicalView

java.lang.Object
  extended by android.view.View
      extended by org.achartengine.GraphicalView
All Implemented Interfaces:
android.graphics.drawable.Drawable.Callback, android.view.accessibility.AccessibilityEventSource, android.view.KeyEvent.Callback

public class GraphicalView
extends android.view.View

The view that encapsulates the graphical chart.


Nested Class Summary
 
Nested classes/interfaces inherited from class android.view.View
android.view.View.BaseSavedState, android.view.View.MeasureSpec, android.view.View.OnClickListener, android.view.View.OnCreateContextMenuListener, android.view.View.OnFocusChangeListener, android.view.View.OnKeyListener, android.view.View.OnLongClickListener, android.view.View.OnTouchListener
 
Field Summary
 
Fields inherited from class android.view.View
DRAWING_CACHE_QUALITY_AUTO, DRAWING_CACHE_QUALITY_HIGH, DRAWING_CACHE_QUALITY_LOW, EMPTY_STATE_SET, ENABLED_FOCUSED_SELECTED_STATE_SET, ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_FOCUSED_STATE_SET, ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, ENABLED_SELECTED_STATE_SET, ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_STATE_SET, ENABLED_WINDOW_FOCUSED_STATE_SET, FOCUS_BACKWARD, FOCUS_DOWN, FOCUS_FORWARD, FOCUS_LEFT, FOCUS_RIGHT, FOCUS_UP, FOCUSABLES_ALL, FOCUSABLES_TOUCH_MODE, FOCUSED_SELECTED_STATE_SET, FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, FOCUSED_STATE_SET, FOCUSED_WINDOW_FOCUSED_STATE_SET, GONE, HAPTIC_FEEDBACK_ENABLED, INVISIBLE, KEEP_SCREEN_ON, NO_ID, PRESSED_ENABLED_FOCUSED_SELECTED_STATE_SET, PRESSED_ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_SELECTED_STATE_SET, PRESSED_ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_STATE_SET, PRESSED_ENABLED_WINDOW_FOCUSED_STATE_SET, PRESSED_FOCUSED_SELECTED_STATE_SET, PRESSED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_FOCUSED_STATE_SET, PRESSED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_SELECTED_STATE_SET, PRESSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_WINDOW_FOCUSED_STATE_SET, SCROLLBARS_INSIDE_INSET, SCROLLBARS_INSIDE_OVERLAY, SCROLLBARS_OUTSIDE_INSET, SCROLLBARS_OUTSIDE_OVERLAY, SELECTED_STATE_SET, SELECTED_WINDOW_FOCUSED_STATE_SET, SOUND_EFFECTS_ENABLED, VIEW_LOG_TAG, VISIBLE, WINDOW_FOCUSED_STATE_SET
 
Constructor Summary
GraphicalView(android.content.Context context, AbstractChart chart)
          Creates a new graphical view.
 
Method Summary
 void addPanListener(PanListener listener)
          Adds a new pan listener.
 void addZoomListener(ZoomListener listener, boolean onButtons, boolean onPinch)
          Adds a new zoom listener.
 SeriesSelection getCurrentSeriesAndPoint()
          Returns the current series selection object.
protected  android.graphics.RectF getZoomRectangle()
           
protected  void onDraw(android.graphics.Canvas canvas)
           
 boolean onTouchEvent(android.view.MotionEvent event)
           
 void removePanListener(PanListener listener)
          Removes a pan listener.
 void removeZoomListener(ZoomListener listener)
          Removes a zoom listener.
 void repaint()
          Schedule a view content repaint.
 void repaint(int left, int top, int right, int bottom)
          Schedule a view content repaint, in the specified rectangle area.
 void setZoomRate(float rate)
          Sets the zoom rate.
 android.graphics.Bitmap toBitmap()
          Saves the content of the graphical view to a bitmap.
 double[] toRealPoint(int scale)
          Transforms the currently selected screen point to a real point.
 void zoomIn()
          Do a chart zoom in.
 void zoomOut()
          Do a chart zoom out.
 void zoomReset()
          Do a chart zoom reset / fit zoom.
 
Methods inherited from class android.view.View
addFocusables, addFocusables, addTouchables, awakenScrollBars, awakenScrollBars, awakenScrollBars, bringToFront, buildDrawingCache, buildDrawingCache, cancelLongPress, checkInputConnectionProxy, clearAnimation, clearFocus, computeHorizontalScrollExtent, computeHorizontalScrollOffset, computeHorizontalScrollRange, computeScroll, computeVerticalScrollExtent, computeVerticalScrollOffset, computeVerticalScrollRange, createContextMenu, destroyDrawingCache, dispatchDraw, dispatchKeyEvent, dispatchKeyEventPreIme, dispatchKeyShortcutEvent, dispatchPopulateAccessibilityEvent, dispatchRestoreInstanceState, dispatchSaveInstanceState, dispatchSetPressed, dispatchSetSelected, dispatchTouchEvent, dispatchTrackballEvent, dispatchUnhandledMove, dispatchWindowFocusChanged, dispatchWindowVisibilityChanged, draw, drawableStateChanged, finalize, findFocus, findViewById, findViewWithTag, fitSystemWindows, focusSearch, forceLayout, getAnimation, getApplicationWindowToken, getBackground, getBaseline, getBottom, getBottomFadingEdgeStrength, getBottomPaddingOffset, getContentDescription, getContext, getContextMenuInfo, getDefaultSize, getDrawableState, getDrawingCache, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getFocusables, getFocusedRect, getGlobalVisibleRect, getGlobalVisibleRect, getHandler, getHeight, getHitRect, getHorizontalFadingEdgeLength, getHorizontalScrollbarHeight, getId, getKeepScreenOn, getKeyDispatcherState, getLayoutParams, getLeft, getLeftFadingEdgeStrength, getLeftPaddingOffset, getLocalVisibleRect, getLocationInWindow, getLocationOnScreen, getMeasuredHeight, getMeasuredWidth, getNextFocusDownId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getPaddingBottom, getPaddingLeft, getPaddingRight, getPaddingTop, getParent, getResources, getRight, getRightFadingEdgeStrength, getRightPaddingOffset, getRootView, getScrollBarStyle, getScrollX, getScrollY, getSolidColor, getSuggestedMinimumHeight, getSuggestedMinimumWidth, getTag, getTag, getTop, getTopFadingEdgeStrength, getTopPaddingOffset, getTouchables, getTouchDelegate, getVerticalFadingEdgeLength, getVerticalScrollbarWidth, getViewTreeObserver, getVisibility, getWidth, getWindowAttachCount, getWindowToken, getWindowVisibility, getWindowVisibleDisplayFrame, hasFocus, hasFocusable, hasWindowFocus, inflate, initializeFadingEdge, initializeScrollbars, invalidate, invalidate, invalidate, invalidateDrawable, isClickable, isDrawingCacheEnabled, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isHapticFeedbackEnabled, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isInEditMode, isInTouchMode, isLayoutRequested, isLongClickable, isOpaque, isPaddingOffsetRequired, isPressed, isSaveEnabled, isScrollbarFadingEnabled, isSelected, isShown, isSoundEffectsEnabled, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, layout, measure, mergeDrawableStates, offsetLeftAndRight, offsetTopAndBottom, onAnimationEnd, onAnimationStart, onAttachedToWindow, onCheckIsTextEditor, onCreateContextMenu, onCreateDrawableState, onCreateInputConnection, onDetachedFromWindow, onDrawScrollBars, onFinishInflate, onFinishTemporaryDetach, onFocusChanged, onKeyDown, onKeyLongPress, onKeyMultiple, onKeyPreIme, onKeyShortcut, onKeyUp, onLayout, onMeasure, onRestoreInstanceState, onSaveInstanceState, onScrollChanged, onSetAlpha, onSizeChanged, onStartTemporaryDetach, onTrackballEvent, onWindowFocusChanged, onWindowVisibilityChanged, performClick, performHapticFeedback, performHapticFeedback, performLongClick, playSoundEffect, post, postDelayed, postInvalidate, postInvalidate, postInvalidateDelayed, postInvalidateDelayed, refreshDrawableState, removeCallbacks, requestFocus, requestFocus, requestFocus, requestFocusFromTouch, requestLayout, requestRectangleOnScreen, requestRectangleOnScreen, resolveSize, restoreHierarchyState, saveHierarchyState, scheduleDrawable, scrollBy, scrollTo, sendAccessibilityEvent, sendAccessibilityEventUnchecked, setAnimation, setBackgroundColor, setBackgroundDrawable, setBackgroundResource, setClickable, setContentDescription, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setEnabled, setFadingEdgeLength, setFocusable, setFocusableInTouchMode, setHapticFeedbackEnabled, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setId, setKeepScreenOn, setLayoutParams, setLongClickable, setMeasuredDimension, setMinimumHeight, setMinimumWidth, setNextFocusDownId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnClickListener, setOnCreateContextMenuListener, setOnFocusChangeListener, setOnKeyListener, setOnLongClickListener, setOnTouchListener, setPadding, setPressed, setSaveEnabled, setScrollbarFadingEnabled, setScrollBarStyle, setScrollContainer, setSelected, setSoundEffectsEnabled, setTag, setTag, setTouchDelegate, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setVisibility, setWillNotCacheDrawing, setWillNotDraw, showContextMenu, startAnimation, unscheduleDrawable, unscheduleDrawable, verifyDrawable, willNotCacheDrawing, willNotDraw
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GraphicalView

public GraphicalView(android.content.Context context,
                     AbstractChart chart)
Creates a new graphical view.

Parameters:
context - the context
chart - the chart to be drawn
Method Detail

getCurrentSeriesAndPoint

public SeriesSelection getCurrentSeriesAndPoint()
Returns the current series selection object.

Returns:
the series selection

toRealPoint

public double[] toRealPoint(int scale)
Transforms the currently selected screen point to a real point.

Parameters:
scale - the scale
Returns:
the currently selected real point

onDraw

protected void onDraw(android.graphics.Canvas canvas)
Overrides:
onDraw in class android.view.View

setZoomRate

public void setZoomRate(float rate)
Sets the zoom rate.

Parameters:
rate - the zoom rate

zoomIn

public void zoomIn()
Do a chart zoom in.


zoomOut

public void zoomOut()
Do a chart zoom out.


zoomReset

public void zoomReset()
Do a chart zoom reset / fit zoom.


addZoomListener

public void addZoomListener(ZoomListener listener,
                            boolean onButtons,
                            boolean onPinch)
Adds a new zoom listener.

Parameters:
listener - zoom listener

removeZoomListener

public void removeZoomListener(ZoomListener listener)
Removes a zoom listener.

Parameters:
listener - zoom listener

addPanListener

public void addPanListener(PanListener listener)
Adds a new pan listener.

Parameters:
listener - pan listener

removePanListener

public void removePanListener(PanListener listener)
Removes a pan listener.

Parameters:
listener - pan listener

getZoomRectangle

protected android.graphics.RectF getZoomRectangle()

onTouchEvent

public boolean onTouchEvent(android.view.MotionEvent event)
Overrides:
onTouchEvent in class android.view.View

repaint

public void repaint()
Schedule a view content repaint.


repaint

public void repaint(int left,
                    int top,
                    int right,
                    int bottom)
Schedule a view content repaint, in the specified rectangle area.

Parameters:
left - the left position of the area to be repainted
top - the top position of the area to be repainted
right - the right position of the area to be repainted
bottom - the bottom position of the area to be repainted

toBitmap

public android.graphics.Bitmap toBitmap()
Saves the content of the graphical view to a bitmap.

Returns:
the bitmap


Copyright © 2009 - 2011 4ViewSoft. All Rights Reserved.