public abstract class Chart<T extends ChartData<? extends DataSet<? extends Entry>>> extends android.view.ViewGroup implements ChartInterface
android.view.ViewGroup.LayoutParams, android.view.ViewGroup.MarginLayoutParams, android.view.ViewGroup.OnHierarchyChangeListenerandroid.view.View.AccessibilityDelegate, android.view.View.BaseSavedState, android.view.View.DragShadowBuilder, android.view.View.MeasureSpec, android.view.View.OnApplyWindowInsetsListener, android.view.View.OnAttachStateChangeListener, android.view.View.OnClickListener, android.view.View.OnContextClickListener, android.view.View.OnCreateContextMenuListener, android.view.View.OnDragListener, android.view.View.OnFocusChangeListener, android.view.View.OnGenericMotionListener, android.view.View.OnHoverListener, android.view.View.OnKeyListener, android.view.View.OnLayoutChangeListener, android.view.View.OnLongClickListener, android.view.View.OnScrollChangeListener, android.view.View.OnSystemUiVisibilityChangeListener, android.view.View.OnTouchListener| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
LOG_TAG |
protected ChartAnimator |
mAnimator
object responsible for animations
|
protected ChartTouchListener |
mChartTouchListener |
protected T |
mData
object that holds all data that was originally set for the chart, before
it was modified or any filtering algorithms had been applied
|
protected boolean |
mDataNotSet
flag that indicates if the chart has been fed with data yet
|
protected ValueFormatter |
mDefaultFormatter
default value-formatter, number of digits depends on provided chart-data
|
protected float |
mDeltaX
the number of x-values the chart displays
|
protected android.graphics.Paint |
mDescPaint
paint object used for drawing the description text in the bottom right
corner of the chart
|
protected java.lang.String |
mDescription
description text that appears in the bottom right corner of the chart
|
protected boolean |
mDrawMarkerViews
if set to true, the marker view is drawn when a value is clicked
|
protected android.graphics.Paint |
mDrawPaint
paint object used for drawing the bitmap
|
protected ChartHighlighter |
mHighlighter |
protected boolean |
mHighLightPerTapEnabled
Flag that indicates if highlighting per tap (touch) is enabled
|
protected Highlight[] |
mIndicesToHighlight
array of Highlight objects that reference the highlighted slices in the
chart
|
protected android.graphics.Paint |
mInfoPaint
paint object for drawing the information text when there are no values in
the chart
|
protected java.util.ArrayList<java.lang.Runnable> |
mJobs
tasks to be done after the view is setup
|
protected Legend |
mLegend
the legend object containing all data associated with the legend
|
protected LegendRenderer |
mLegendRenderer |
protected boolean |
mLogEnabled
flag that indicates if logging is enabled or not
|
protected MarkerView |
mMarkerView
the view that represents the marker
|
protected DataRenderer |
mRenderer
object responsible for rendering the data
|
protected OnChartValueSelectedListener |
mSelectionListener
listener that is called when a value on the chart is selected
|
protected boolean |
mTouchEnabled
if true, touch gestures are enabled on the chart
|
protected ViewPortHandler |
mViewPortHandler
object that manages the bounds and drawing constraints of the chart
|
protected float |
mXChartMax |
protected float |
mXChartMin |
static int |
PAINT_CENTER_TEXT
paint for the text in the middle of the pie chart
|
static int |
PAINT_DESCRIPTION
paint for the description text in the bottom right corner
|
static int |
PAINT_GRID_BACKGROUND
paint for the grid background (only line and barchart)
|
static int |
PAINT_HOLE
paint for the hole in the middle of the pie chart
|
static int |
PAINT_INFO
paint for the info text that is displayed when there are no values in the
chart
|
static int |
PAINT_LEGEND_LABEL
paint used for the legend
|
CLIP_TO_PADDING_MASK, FOCUS_AFTER_DESCENDANTS, FOCUS_BEFORE_DESCENDANTS, FOCUS_BLOCK_DESCENDANTS, LAYOUT_MODE_CLIP_BOUNDS, LAYOUT_MODE_OPTICAL_BOUNDS, PERSISTENT_ALL_CACHES, PERSISTENT_ANIMATION_CACHE, PERSISTENT_NO_CACHE, PERSISTENT_SCROLLING_CACHEACCESSIBILITY_LIVE_REGION_ASSERTIVE, ACCESSIBILITY_LIVE_REGION_NONE, ACCESSIBILITY_LIVE_REGION_POLITE, ALPHA, 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, FIND_VIEWS_WITH_CONTENT_DESCRIPTION, FIND_VIEWS_WITH_TEXT, 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, IMPORTANT_FOR_ACCESSIBILITY_AUTO, IMPORTANT_FOR_ACCESSIBILITY_NO, IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS, IMPORTANT_FOR_ACCESSIBILITY_YES, INVISIBLE, KEEP_SCREEN_ON, LAYER_TYPE_HARDWARE, LAYER_TYPE_NONE, LAYER_TYPE_SOFTWARE, LAYOUT_DIRECTION_INHERIT, LAYOUT_DIRECTION_LOCALE, LAYOUT_DIRECTION_LTR, LAYOUT_DIRECTION_RTL, MEASURED_HEIGHT_STATE_SHIFT, MEASURED_SIZE_MASK, MEASURED_STATE_MASK, MEASURED_STATE_TOO_SMALL, NO_ID, OVER_SCROLL_ALWAYS, OVER_SCROLL_IF_CONTENT_SCROLLS, OVER_SCROLL_NEVER, 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_STATE_SET, PRESSED_WINDOW_FOCUSED_STATE_SET, ROTATION, ROTATION_X, ROTATION_Y, SCALE_X, SCALE_Y, SCREEN_STATE_OFF, SCREEN_STATE_ON, SCROLL_AXIS_HORIZONTAL, SCROLL_AXIS_NONE, SCROLL_AXIS_VERTICAL, SCROLL_INDICATOR_BOTTOM, SCROLL_INDICATOR_END, SCROLL_INDICATOR_LEFT, SCROLL_INDICATOR_RIGHT, SCROLL_INDICATOR_START, SCROLL_INDICATOR_TOP, SCROLLBAR_POSITION_DEFAULT, SCROLLBAR_POSITION_LEFT, SCROLLBAR_POSITION_RIGHT, SCROLLBARS_INSIDE_INSET, SCROLLBARS_INSIDE_OVERLAY, SCROLLBARS_OUTSIDE_INSET, SCROLLBARS_OUTSIDE_OVERLAY, SELECTED_STATE_SET, SELECTED_WINDOW_FOCUSED_STATE_SET, SOUND_EFFECTS_ENABLED, STATUS_BAR_HIDDEN, STATUS_BAR_VISIBLE, SYSTEM_UI_FLAG_FULLSCREEN, SYSTEM_UI_FLAG_HIDE_NAVIGATION, SYSTEM_UI_FLAG_IMMERSIVE, SYSTEM_UI_FLAG_IMMERSIVE_STICKY, SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN, SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION, SYSTEM_UI_FLAG_LAYOUT_STABLE, SYSTEM_UI_FLAG_LIGHT_STATUS_BAR, SYSTEM_UI_FLAG_LOW_PROFILE, SYSTEM_UI_FLAG_VISIBLE, SYSTEM_UI_LAYOUT_FLAGS, TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_GRAVITY, TEXT_ALIGNMENT_INHERIT, TEXT_ALIGNMENT_TEXT_END, TEXT_ALIGNMENT_TEXT_START, TEXT_ALIGNMENT_VIEW_END, TEXT_ALIGNMENT_VIEW_START, TEXT_DIRECTION_ANY_RTL, TEXT_DIRECTION_FIRST_STRONG, TEXT_DIRECTION_FIRST_STRONG_LTR, TEXT_DIRECTION_FIRST_STRONG_RTL, TEXT_DIRECTION_INHERIT, TEXT_DIRECTION_LOCALE, TEXT_DIRECTION_LTR, TEXT_DIRECTION_RTL, TRANSLATION_X, TRANSLATION_Y, TRANSLATION_Z, VIEW_LOG_TAG, VISIBLE, WINDOW_FOCUSED_STATE_SET, X, Y, Z| Constructor and Description |
|---|
Chart(android.content.Context context)
default constructor for initialization in code
|
Chart(android.content.Context context,
android.util.AttributeSet attrs)
constructor for initialization in xml
|
Chart(android.content.Context context,
android.util.AttributeSet attrs,
int defStyle)
even more awesome constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
addJob(java.lang.Runnable job)
Adds a job to be executed after the chart-view is setup (after
onSizeChanged(...) is called).
|
void |
animateX(int durationMillis)
Animates the rendering of the chart on the x-axis with the specified
animation time.
|
void |
animateX(int durationMillis,
Easing.EasingOption easing)
Animates the rendering of the chart on the x-axis with the specified
animation time.
|
void |
animateX(int durationMillis,
EasingFunction easing)
Animates the rendering of the chart on the x-axis with the specified
animation time.
|
void |
animateXY(int durationMillisX,
int durationMillisY)
Animates the drawing / rendering of the chart on both x- and y-axis with
the specified animation time.
|
void |
animateXY(int durationMillisX,
int durationMillisY,
Easing.EasingOption easingX,
Easing.EasingOption easingY)
Animates the drawing / rendering of the chart on both x- and y-axis with
the specified animation time.
|
void |
animateXY(int durationMillisX,
int durationMillisY,
EasingFunction easingX,
EasingFunction easingY)
Animates the drawing / rendering of the chart on both x- and y-axis with
the specified animation time.
|
void |
animateY(int durationMillis)
Animates the rendering of the chart on the y-axis with the specified
animation time.
|
void |
animateY(int durationMillis,
Easing.EasingOption easing)
Animates the rendering of the chart on the y-axis with the specified
animation time.
|
void |
animateY(int durationMillis,
EasingFunction easing)
Animates the rendering of the chart on the y-axis with the specified
animation time.
|
protected abstract void |
calcMinMax()
calcualtes the y-min and y-max value and the y-delta and x-delta value
|
protected void |
calculateFormatter(float min,
float max)
calculates the required number of digits for the values that might be
drawn in the chart (if enabled), and creates the default-value-formatter
|
protected abstract void |
calculateOffsets()
calculates the offsets of the chart to the border depending on the
position of an eventual legend or depending on the length of the y-axis
and x-axis labels and their position
|
void |
clear()
Clears the chart from all data (sets it to null) and refreshes it (by
calling invalidate()).
|
void |
clearAllJobs() |
void |
clearValues()
Removes all DataSets (and thereby Entries) from the chart.
|
void |
disableScroll()
disables intercept touchevents
|
protected void |
drawDescription(android.graphics.Canvas c)
draws the description text in the bottom right corner of the chart
|
protected void |
drawMarkers(android.graphics.Canvas canvas)
draws all MarkerViews on the highlighted positions
|
void |
enableScroll()
enables intercept touchevents
|
ChartAnimator |
getAnimator()
Returns the animator responsible for animating chart values.
|
android.graphics.PointF |
getCenter()
Returns the center point of the chart (the whole View) in pixels.
|
android.graphics.PointF |
getCenterOffsets()
Returns the center of the chart taking offsets under consideration.
|
android.graphics.PointF |
getCenterOfView() |
android.graphics.Bitmap |
getChartBitmap()
Returns the bitmap that represents the chart.
|
android.graphics.RectF |
getContentRect()
Returns the rectangle that defines the borders of the chart-value surface
(into which the actual values are drawn).
|
T |
getData()
Returns the ChartData object that has been set for the chart.
|
ValueFormatter |
getDefaultValueFormatter()
Returns the default ValueFormatter that has been determined by the chart
considering the provided minimum and maximum values.
|
float |
getDragDecelerationFrictionCoef()
Returns drag deceleration friction coefficient
|
java.util.List<Entry> |
getEntriesAtIndex(int xIndex)
Get all Entry objects at the given index across all DataSets.
|
float |
getExtraBottomOffset() |
float |
getExtraLeftOffset() |
float |
getExtraRightOffset() |
float |
getExtraTopOffset() |
Highlight[] |
getHighlighted()
Returns the array of currently highlighted values.
|
java.util.ArrayList<java.lang.Runnable> |
getJobs()
Returns all jobs that are scheduled to be executed after
onSizeChanged(...).
|
Legend |
getLegend()
Returns the Legend object of the chart.
|
LegendRenderer |
getLegendRenderer()
Returns the renderer object responsible for rendering / drawing the
Legend.
|
protected abstract float[] |
getMarkerPosition(Entry e,
Highlight highlight)
Returns the actual position in pixels of the MarkerView for the given
Entry in the given DataSet.
|
MarkerView |
getMarkerView()
returns the view that is set as a marker view for the chart
|
OnChartGestureListener |
getOnChartGestureListener()
Returns the custom gesture listener.
|
android.graphics.Paint |
getPaint(int which)
Returns the paint object associated with the provided constant.
|
float |
getPercentOfTotal(float val)
returns the percentage the given value has of the total y-value sum
|
DataRenderer |
getRenderer()
Returns the Renderer object the chart uses for drawing data.
|
int |
getValueCount()
Returns the total number of (y) values the chart holds (across all DataSets).
|
ViewPortHandler |
getViewPortHandler()
Returns the ViewPortHandler of the chart that is responsible for the
content area of the chart and its offsets and dimensions.
|
float |
getXChartMax() |
float |
getXChartMin() |
int |
getXValCount() |
java.lang.String |
getXValue(int index)
returns the x-value at the given index
|
float |
getYMax()
returns the current y-max value across all DataSets
|
float |
getYMin()
returns the current y-min value across all DataSets
|
void |
highlightTouch(Highlight high)
Deprecated.
|
void |
highlightValue(Highlight highlight)
Highlights the values represented by the provided Highlight object
This DOES NOT generate a callback to the OnChartValueSelectedListener.
|
void |
highlightValue(Highlight high,
boolean callListener)
Highlights the value selected by touch gesture.
|
void |
highlightValue(int xIndex,
int dataSetIndex)
Highlights the value at the given x-index in the given DataSet.
|
void |
highlightValues(Highlight[] highs)
Highlights the values at the given indices in the given DataSets.
|
protected void |
init()
initialize all paints and stuff
|
boolean |
isDragDecelerationEnabled()
If set to true, chart continues to scroll after touch up default: true
|
boolean |
isDrawMarkerViewEnabled()
returns true if drawing the marker-view is enabled when tapping on values
(use the setMarkerView(View v) method to specify a marker view)
|
boolean |
isEmpty()
Returns true if the chart is empty (meaning it's data object is either
null or contains no entries).
|
boolean |
isHighlightPerTapEnabled()
Returns true if values can be highlighted via tap gesture, false if not.
|
boolean |
isLogEnabled()
Returns true if log-output is enabled for the chart, fals if not.
|
abstract void |
notifyDataSetChanged()
Lets the chart know its underlying data has changed and performs all
necessary recalculations.
|
protected void |
onDraw(android.graphics.Canvas canvas) |
protected void |
onLayout(boolean changed,
int left,
int top,
int right,
int bottom) |
protected void |
onMeasure(int widthMeasureSpec,
int heightMeasureSpec) |
protected void |
onSizeChanged(int w,
int h,
int oldw,
int oldh) |
void |
removeJob(java.lang.Runnable job) |
boolean |
saveToGallery(java.lang.String fileName,
int quality)
Saves the current state of the chart to the gallery as a JPEG image.
|
boolean |
saveToPath(java.lang.String title,
java.lang.String pathOnSD)
Saves the current chart state with the given name to the given path on
the sdcard leaving the path empty "" will put the saved file directly on
the SD card chart is saved as a PNG image, example:
saveToPath("myfilename", "foldername1/foldername2");
|
void |
setData(T data)
Sets a new data object for the chart.
|
void |
setDescription(java.lang.String desc)
set a description text that appears in the bottom right corner of the
chart, size = Y-legend text size
|
void |
setDescriptionColor(int color)
Sets the color of the description text.
|
void |
setDescriptionPosition(float x,
float y)
Sets a custom position for the description text in pixels on the screen.
|
void |
setDescriptionTextSize(float size)
sets the size of the description text in pixels, min 6f, max 16f
|
void |
setDescriptionTypeface(android.graphics.Typeface t)
sets the typeface for the description paint
|
void |
setDragDecelerationEnabled(boolean enabled)
If set to true, chart continues to scroll after touch up.
|
void |
setDragDecelerationFrictionCoef(float newValue)
Deceleration friction coefficient in [0 ; 1] interval, higher values
indicate that speed will decrease slowly, for example if it set to 0, it
will stop immediately.
|
void |
setDrawMarkerViews(boolean enabled)
Set this to true to draw a user specified marker-view when tapping on
chart values (use the setMarkerView(MarkerView mv) method to specify a
marker view).
|
void |
setExtraBottomOffset(float offset)
Set an extra offset to be appended to the viewport's bottom
|
void |
setExtraLeftOffset(float offset)
Set an extra offset to be appended to the viewport's left
|
void |
setExtraOffsets(float left,
float top,
float right,
float bottom)
Sets extra offsets (around the chart view) to be appended to the
auto-calculated offsets.
|
void |
setExtraRightOffset(float offset)
Set an extra offset to be appended to the viewport's right
|
void |
setExtraTopOffset(float offset)
Set an extra offset to be appended to the viewport's top
|
void |
setHardwareAccelerationEnabled(boolean enabled)
Setting this to true will set the layer-type HARDWARE for the view, false
will set layer-type SOFTWARE.
|
void |
setHighlightPerTapEnabled(boolean enabled)
Set this to false to prevent values from being highlighted by tap gesture.
|
void |
setLogEnabled(boolean enabled)
Set this to true to enable logcat outputs for the chart.
|
void |
setMarkerView(MarkerView v)
sets the view that is displayed when a value is clicked on the chart
|
void |
setNoDataText(java.lang.String text)
Sets the text that informs the user that there is no data available with
which to draw the chart.
|
void |
setNoDataTextDescription(java.lang.String text)
Sets descriptive text to explain to the user why there is no chart
available Defaults to empty if not set
|
void |
setOnChartGestureListener(OnChartGestureListener l)
Sets a gesture-listener for the chart for custom callbacks when executing
gestures on the chart surface.
|
void |
setOnChartValueSelectedListener(OnChartValueSelectedListener l)
set a selection listener for the chart
|
void |
setOnTouchListener(ChartTouchListener l)
Set a new (e.g.
|
void |
setPaint(android.graphics.Paint p,
int which)
set a new paint object for the specified parameter in the chart e.g.
|
void |
setRenderer(DataRenderer renderer)
Sets a new DataRenderer object for the chart.
|
void |
setTouchEnabled(boolean enabled)
Set this to false to disable all gestures and touches on the chart,
default: true
|
boolean |
valuesToHighlight()
Returns true if there are values to highlight, false if there are no
values to highlight.
|
addChildrenForAccessibility, addFocusables, addStatesFromChildren, addTouchables, addView, addView, addView, addView, addView, addViewInLayout, addViewInLayout, attachLayoutAnimationParameters, attachViewToParent, bringChildToFront, canAnimate, checkLayoutParams, childDrawableStateChanged, childHasTransientStateChanged, cleanupLayoutState, clearChildFocus, clearDisappearingChildren, clearFocus, debug, detachAllViewsFromParent, detachViewFromParent, detachViewFromParent, detachViewsFromParent, dispatchApplyWindowInsets, dispatchConfigurationChanged, dispatchDisplayHint, dispatchDragEvent, dispatchDraw, dispatchDrawableHotspotChanged, dispatchFreezeSelfOnly, dispatchGenericFocusedEvent, dispatchGenericPointerEvent, dispatchHoverEvent, dispatchKeyEvent, dispatchKeyEventPreIme, dispatchKeyShortcutEvent, dispatchProvideStructure, dispatchRestoreInstanceState, dispatchSaveInstanceState, dispatchSetActivated, dispatchSetPressed, dispatchSetSelected, dispatchSystemUiVisibilityChanged, dispatchThawSelfOnly, dispatchTouchEvent, dispatchTrackballEvent, dispatchUnhandledMove, dispatchVisibilityChanged, dispatchWindowFocusChanged, dispatchWindowSystemUiVisiblityChanged, dispatchWindowVisibilityChanged, drawableStateChanged, drawChild, endViewTransition, findFocus, findViewsWithText, focusableViewAvailable, focusSearch, gatherTransparentRegion, generateDefaultLayoutParams, generateLayoutParams, generateLayoutParams, getAccessibilityClassName, getChildAt, getChildCount, getChildDrawingOrder, getChildMeasureSpec, getChildStaticTransformation, getChildVisibleRect, getClipChildren, getClipToPadding, getDescendantFocusability, getFocusedChild, getLayoutAnimation, getLayoutAnimationListener, getLayoutMode, getLayoutTransition, getNestedScrollAxes, getOverlay, getPersistentDrawingCache, getTouchscreenBlocksFocus, hasFocus, hasFocusable, hasTransientState, indexOfChild, invalidateChild, invalidateChildInParent, isAlwaysDrawnWithCacheEnabled, isAnimationCacheEnabled, isChildrenDrawingOrderEnabled, isChildrenDrawnWithCacheEnabled, isMotionEventSplittingEnabled, isTransitionGroup, jumpDrawablesToCurrentState, layout, measureChild, measureChildren, measureChildWithMargins, notifySubtreeAccessibilityStateChanged, offsetDescendantRectToMyCoords, offsetRectIntoDescendantCoords, onAttachedToWindow, onCreateDrawableState, onDetachedFromWindow, onInterceptHoverEvent, onInterceptTouchEvent, onNestedFling, onNestedPreFling, onNestedPrePerformAccessibilityAction, onNestedPreScroll, onNestedScroll, onNestedScrollAccepted, onRequestFocusInDescendants, onRequestSendAccessibilityEvent, onStartNestedScroll, onStopNestedScroll, onViewAdded, onViewRemoved, recomputeViewAttributes, removeAllViews, removeAllViewsInLayout, removeDetachedView, removeView, removeViewAt, removeViewInLayout, removeViews, removeViewsInLayout, requestChildFocus, requestChildRectangleOnScreen, requestDisallowInterceptTouchEvent, requestFocus, requestSendAccessibilityEvent, requestTransparentRegion, scheduleLayoutAnimation, setAddStatesFromChildren, setAlwaysDrawnWithCacheEnabled, setAnimationCacheEnabled, setChildrenDrawingCacheEnabled, setChildrenDrawingOrderEnabled, setChildrenDrawnWithCacheEnabled, setClipChildren, setClipToPadding, setDescendantFocusability, setLayoutAnimation, setLayoutAnimationListener, setLayoutMode, setLayoutTransition, setMotionEventSplittingEnabled, setOnHierarchyChangeListener, setPersistentDrawingCache, setStaticTransformationsEnabled, setTouchscreenBlocksFocus, setTransitionGroup, shouldDelayChildPressedState, showContextMenuForChild, startActionModeForChild, startActionModeForChild, startLayoutAnimation, startViewTransition, updateViewLayoutaddFocusables, addOnAttachStateChangeListener, addOnLayoutChangeListener, animate, announceForAccessibility, awakenScrollBars, awakenScrollBars, awakenScrollBars, bringToFront, buildDrawingCache, buildDrawingCache, buildLayer, callOnClick, cancelLongPress, cancelPendingInputEvents, canResolveLayoutDirection, canResolveTextAlignment, canResolveTextDirection, canScrollHorizontally, canScrollVertically, checkInputConnectionProxy, clearAnimation, combineMeasuredStates, computeHorizontalScrollExtent, computeHorizontalScrollOffset, computeHorizontalScrollRange, computeScroll, computeSystemWindowInsets, computeVerticalScrollExtent, computeVerticalScrollOffset, computeVerticalScrollRange, createAccessibilityNodeInfo, createContextMenu, destroyDrawingCache, dispatchGenericMotionEvent, dispatchNestedFling, dispatchNestedPreFling, dispatchNestedPrePerformAccessibilityAction, dispatchNestedPreScroll, dispatchNestedScroll, dispatchPopulateAccessibilityEvent, draw, drawableHotspotChanged, findViewById, findViewWithTag, fitSystemWindows, focusSearch, forceLayout, generateViewId, getAccessibilityLiveRegion, getAccessibilityNodeProvider, getAccessibilityTraversalAfter, getAccessibilityTraversalBefore, getAlpha, getAnimation, getApplicationWindowToken, getBackground, getBackgroundTintList, getBackgroundTintMode, getBaseline, getBottom, getBottomFadingEdgeStrength, getBottomPaddingOffset, getCameraDistance, getClipBounds, getClipBounds, getClipToOutline, getContentDescription, getContext, getContextMenuInfo, getDefaultSize, getDisplay, getDrawableState, getDrawingCache, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getElevation, getFilterTouchesWhenObscured, getFitsSystemWindows, getFocusables, getFocusedRect, getForeground, getForegroundGravity, getForegroundTintList, getForegroundTintMode, getGlobalVisibleRect, getGlobalVisibleRect, getHandler, getHeight, getHitRect, getHorizontalFadingEdgeLength, getHorizontalScrollbarHeight, getId, getImportantForAccessibility, getKeepScreenOn, getKeyDispatcherState, getLabelFor, getLayerType, getLayoutDirection, getLayoutParams, getLeft, getLeftFadingEdgeStrength, getLeftPaddingOffset, getLocalVisibleRect, getLocationInWindow, getLocationOnScreen, getMatrix, getMeasuredHeight, getMeasuredHeightAndState, getMeasuredState, getMeasuredWidth, getMeasuredWidthAndState, getMinimumHeight, getMinimumWidth, getNextFocusDownId, getNextFocusForwardId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getOutlineProvider, getOverScrollMode, getPaddingBottom, getPaddingEnd, getPaddingLeft, getPaddingRight, getPaddingStart, getPaddingTop, getParent, getParentForAccessibility, getPivotX, getPivotY, getResources, getRight, getRightFadingEdgeStrength, getRightPaddingOffset, getRootView, getRootWindowInsets, getRotation, getRotationX, getRotationY, getScaleX, getScaleY, getScrollBarDefaultDelayBeforeFade, getScrollBarFadeDuration, getScrollBarSize, getScrollBarStyle, getScrollIndicators, getScrollX, getScrollY, getSolidColor, getStateListAnimator, getSuggestedMinimumHeight, getSuggestedMinimumWidth, getSystemUiVisibility, getTag, getTag, getTextAlignment, getTextDirection, getTop, getTopFadingEdgeStrength, getTopPaddingOffset, getTouchables, getTouchDelegate, getTransitionName, getTranslationX, getTranslationY, getTranslationZ, getVerticalFadingEdgeLength, getVerticalScrollbarPosition, getVerticalScrollbarWidth, getViewTreeObserver, getVisibility, getWidth, getWindowAttachCount, getWindowId, getWindowSystemUiVisibility, getWindowToken, getWindowVisibility, getWindowVisibleDisplayFrame, getX, getY, getZ, hasNestedScrollingParent, hasOnClickListeners, hasOverlappingRendering, hasWindowFocus, inflate, invalidate, invalidate, invalidate, invalidateDrawable, invalidateOutline, isAccessibilityFocused, isActivated, isAttachedToWindow, isClickable, isContextClickable, isDirty, isDrawingCacheEnabled, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isHapticFeedbackEnabled, isHardwareAccelerated, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isHovered, isImportantForAccessibility, isInEditMode, isInLayout, isInTouchMode, isLaidOut, isLayoutDirectionResolved, isLayoutRequested, isLongClickable, isNestedScrollingEnabled, isOpaque, isPaddingOffsetRequired, isPaddingRelative, isPressed, isSaveEnabled, isSaveFromParentEnabled, isScrollbarFadingEnabled, isScrollContainer, isSelected, isShown, isSoundEffectsEnabled, isTextAlignmentResolved, isTextDirectionResolved, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, measure, mergeDrawableStates, offsetLeftAndRight, offsetTopAndBottom, onAnimationEnd, onAnimationStart, onApplyWindowInsets, onCancelPendingInputEvents, onCheckIsTextEditor, onConfigurationChanged, onCreateContextMenu, onCreateInputConnection, onDisplayHint, onDragEvent, onDrawForeground, onDrawScrollBars, onFilterTouchEventForSecurity, onFinishInflate, onFinishTemporaryDetach, onFocusChanged, onGenericMotionEvent, onHoverChanged, onHoverEvent, onInitializeAccessibilityEvent, onInitializeAccessibilityNodeInfo, onKeyDown, onKeyLongPress, onKeyMultiple, onKeyPreIme, onKeyShortcut, onKeyUp, onOverScrolled, onPopulateAccessibilityEvent, onProvideStructure, onProvideVirtualStructure, onRestoreInstanceState, onRtlPropertiesChanged, onSaveInstanceState, onScreenStateChanged, onScrollChanged, onSetAlpha, onStartTemporaryDetach, onTouchEvent, onTrackballEvent, onVisibilityChanged, onWindowFocusChanged, onWindowSystemUiVisibilityChanged, onWindowVisibilityChanged, overScrollBy, performAccessibilityAction, performClick, performContextClick, performHapticFeedback, performHapticFeedback, performLongClick, playSoundEffect, post, postDelayed, postInvalidate, postInvalidate, postInvalidateDelayed, postInvalidateDelayed, postInvalidateOnAnimation, postInvalidateOnAnimation, postOnAnimation, postOnAnimationDelayed, refreshDrawableState, removeCallbacks, removeOnAttachStateChangeListener, removeOnLayoutChangeListener, requestApplyInsets, requestFitSystemWindows, requestFocus, requestFocus, requestFocusFromTouch, requestLayout, requestRectangleOnScreen, requestRectangleOnScreen, requestUnbufferedDispatch, resolveSize, resolveSizeAndState, restoreHierarchyState, saveHierarchyState, scheduleDrawable, scrollBy, scrollTo, sendAccessibilityEvent, sendAccessibilityEventUnchecked, setAccessibilityDelegate, setAccessibilityLiveRegion, setAccessibilityTraversalAfter, setAccessibilityTraversalBefore, setActivated, setAlpha, setAnimation, setBackground, setBackgroundColor, setBackgroundDrawable, setBackgroundResource, setBackgroundTintList, setBackgroundTintMode, setBottom, setCameraDistance, setClickable, setClipBounds, setClipToOutline, setContentDescription, setContextClickable, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setElevation, setEnabled, setFadingEdgeLength, setFilterTouchesWhenObscured, setFitsSystemWindows, setFocusable, setFocusableInTouchMode, setForeground, setForegroundGravity, setForegroundTintList, setForegroundTintMode, setHapticFeedbackEnabled, setHasTransientState, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setHovered, setId, setImportantForAccessibility, setKeepScreenOn, setLabelFor, setLayerPaint, setLayerType, setLayoutDirection, setLayoutParams, setLeft, setLongClickable, setMeasuredDimension, setMinimumHeight, setMinimumWidth, setNestedScrollingEnabled, setNextFocusDownId, setNextFocusForwardId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnApplyWindowInsetsListener, setOnClickListener, setOnContextClickListener, setOnCreateContextMenuListener, setOnDragListener, setOnFocusChangeListener, setOnGenericMotionListener, setOnHoverListener, setOnKeyListener, setOnLongClickListener, setOnScrollChangeListener, setOnSystemUiVisibilityChangeListener, setOnTouchListener, setOutlineProvider, setOverScrollMode, setPadding, setPaddingRelative, setPivotX, setPivotY, setPressed, setRight, setRotation, setRotationX, setRotationY, setSaveEnabled, setSaveFromParentEnabled, setScaleX, setScaleY, setScrollBarDefaultDelayBeforeFade, setScrollBarFadeDuration, setScrollbarFadingEnabled, setScrollBarSize, setScrollBarStyle, setScrollContainer, setScrollIndicators, setScrollIndicators, setScrollX, setScrollY, setSelected, setSoundEffectsEnabled, setStateListAnimator, setSystemUiVisibility, setTag, setTag, setTextAlignment, setTextDirection, setTop, setTouchDelegate, setTransitionName, setTranslationX, setTranslationY, setTranslationZ, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setVerticalScrollbarPosition, setVisibility, setWillNotCacheDrawing, setWillNotDraw, setX, setY, setZ, showContextMenu, startActionMode, startActionMode, startAnimation, startDrag, startNestedScroll, stopNestedScroll, toString, unscheduleDrawable, unscheduleDrawable, verifyDrawable, willNotCacheDrawing, willNotDrawclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetHeight, getWidth, getYChartMax, getYChartMincanResolveLayoutDirection, canResolveTextAlignment, canResolveTextDirection, createContextMenu, getLayoutDirection, getParent, getParentForAccessibility, getTextAlignment, getTextDirection, isLayoutDirectionResolved, isLayoutRequested, isTextAlignmentResolved, isTextDirectionResolved, requestFitSystemWindows, requestLayoutpublic static final java.lang.String LOG_TAG
protected boolean mLogEnabled
protected T extends ChartData<? extends DataSet<? extends Entry>> mData
protected boolean mHighLightPerTapEnabled
protected ValueFormatter mDefaultFormatter
protected android.graphics.Paint mDescPaint
protected android.graphics.Paint mInfoPaint
protected java.lang.String mDescription
protected boolean mDataNotSet
protected float mDeltaX
protected float mXChartMin
protected float mXChartMax
protected boolean mTouchEnabled
protected Legend mLegend
protected OnChartValueSelectedListener mSelectionListener
protected ChartTouchListener mChartTouchListener
protected LegendRenderer mLegendRenderer
protected DataRenderer mRenderer
protected ChartHighlighter mHighlighter
protected ViewPortHandler mViewPortHandler
protected ChartAnimator mAnimator
protected android.graphics.Paint mDrawPaint
protected Highlight[] mIndicesToHighlight
protected boolean mDrawMarkerViews
protected MarkerView mMarkerView
public static final int PAINT_GRID_BACKGROUND
public static final int PAINT_INFO
public static final int PAINT_DESCRIPTION
public static final int PAINT_HOLE
public static final int PAINT_CENTER_TEXT
public static final int PAINT_LEGEND_LABEL
protected java.util.ArrayList<java.lang.Runnable> mJobs
public Chart(android.content.Context context)
public Chart(android.content.Context context,
android.util.AttributeSet attrs)
public Chart(android.content.Context context,
android.util.AttributeSet attrs,
int defStyle)
protected void init()
public void setData(T data)
data - public void clear()
public void clearValues()
public boolean isEmpty()
public abstract void notifyDataSetChanged()
protected abstract void calculateOffsets()
protected abstract void calcMinMax()
protected void calculateFormatter(float min,
float max)
protected void onDraw(android.graphics.Canvas canvas)
onDraw in class android.view.Viewprotected void drawDescription(android.graphics.Canvas c)
public Highlight[] getHighlighted()
public boolean isHighlightPerTapEnabled()
public void setHighlightPerTapEnabled(boolean enabled)
enabled - public boolean valuesToHighlight()
public void highlightValues(Highlight[] highs)
highs - public void highlightValue(int xIndex,
int dataSetIndex)
xIndex - dataSetIndex - public void highlightValue(Highlight highlight)
highlight - contains information about which entry should be highlightedpublic void highlightValue(Highlight high, boolean callListener)
high - - the highlight objectcallListener - - call the listener@Deprecated public void highlightTouch(Highlight high)
public void setOnTouchListener(ChartTouchListener l)
l - protected void drawMarkers(android.graphics.Canvas canvas)
protected abstract float[] getMarkerPosition(Entry e, Highlight highlight)
e - highlight - public ChartAnimator getAnimator()
public boolean isDragDecelerationEnabled()
public void setDragDecelerationEnabled(boolean enabled)
enabled - public float getDragDecelerationFrictionCoef()
public void setDragDecelerationFrictionCoef(float newValue)
newValue - public void animateXY(int durationMillisX,
int durationMillisY,
EasingFunction easingX,
EasingFunction easingY)
durationMillisX - durationMillisY - easingX - a custom easing function to be used on the animation phaseeasingY - a custom easing function to be used on the animation phasepublic void animateX(int durationMillis,
EasingFunction easing)
durationMillis - easing - a custom easing function to be used on the animation phasepublic void animateY(int durationMillis,
EasingFunction easing)
durationMillis - easing - a custom easing function to be used on the animation phasepublic void animateXY(int durationMillisX,
int durationMillisY,
Easing.EasingOption easingX,
Easing.EasingOption easingY)
durationMillisX - durationMillisY - easingX - a predefined easing optioneasingY - a predefined easing optionpublic void animateX(int durationMillis,
Easing.EasingOption easing)
durationMillis - easing - a predefined easing optionpublic void animateY(int durationMillis,
Easing.EasingOption easing)
durationMillis - easing - a predefined easing optionpublic void animateX(int durationMillis)
durationMillis - public void animateY(int durationMillis)
durationMillis - public void animateXY(int durationMillisX,
int durationMillisY)
durationMillisX - durationMillisY - public ValueFormatter getDefaultValueFormatter()
getDefaultValueFormatter in interface ChartInterfacepublic void setOnChartValueSelectedListener(OnChartValueSelectedListener l)
l - public void setOnChartGestureListener(OnChartGestureListener l)
l - public OnChartGestureListener getOnChartGestureListener()
public float getYMax()
public float getYMin()
public float getXChartMax()
getXChartMax in interface ChartInterfacepublic float getXChartMin()
getXChartMin in interface ChartInterfacepublic int getXValCount()
getXValCount in interface ChartInterfacepublic int getValueCount()
public android.graphics.PointF getCenter()
public android.graphics.PointF getCenterOffsets()
getCenterOffsets in interface ChartInterfacepublic void setDescription(java.lang.String desc)
desc - public void setDescriptionPosition(float x,
float y)
x - - xcoordinatey - - ycoordinatepublic void setDescriptionTypeface(android.graphics.Typeface t)
t - public void setDescriptionTextSize(float size)
size - public void setDescriptionColor(int color)
color - public void setExtraOffsets(float left,
float top,
float right,
float bottom)
left - top - right - bottom - public void setExtraTopOffset(float offset)
public float getExtraTopOffset()
public void setExtraRightOffset(float offset)
public float getExtraRightOffset()
public void setExtraBottomOffset(float offset)
public float getExtraBottomOffset()
public void setExtraLeftOffset(float offset)
public float getExtraLeftOffset()
public void setLogEnabled(boolean enabled)
enabled - public boolean isLogEnabled()
public void setNoDataText(java.lang.String text)
text - public void setNoDataTextDescription(java.lang.String text)
text - public void setTouchEnabled(boolean enabled)
enabled - public void setMarkerView(MarkerView v)
v - public MarkerView getMarkerView()
public Legend getLegend()
public LegendRenderer getLegendRenderer()
public android.graphics.RectF getContentRect()
getContentRect in interface ChartInterfacepublic void disableScroll()
public void enableScroll()
public void setPaint(android.graphics.Paint p,
int which)
p - the new paint objectwhich - Chart.PAINT_VALUES, Chart.PAINT_GRID, Chart.PAINT_VALUES,
...public android.graphics.Paint getPaint(int which)
which - e.g. Chart.PAINT_LEGEND_LABELpublic boolean isDrawMarkerViewEnabled()
public void setDrawMarkerViews(boolean enabled)
enabled - public java.lang.String getXValue(int index)
index - public java.util.List<Entry> getEntriesAtIndex(int xIndex)
xIndex - public T getData()
getData in interface ChartInterfacepublic float getPercentOfTotal(float val)
val - public ViewPortHandler getViewPortHandler()
public DataRenderer getRenderer()
public void setRenderer(DataRenderer renderer)
renderer - public android.graphics.PointF getCenterOfView()
getCenterOfView in interface ChartInterfacepublic android.graphics.Bitmap getChartBitmap()
public boolean saveToPath(java.lang.String title,
java.lang.String pathOnSD)
title - pathOnSD - e.g. "folder1/folder2/folder3"public boolean saveToGallery(java.lang.String fileName,
int quality)
fileName - e.g. "my_image"quality - e.g. 50, min = 0, max = 100public void addJob(java.lang.Runnable job)
job - public void removeJob(java.lang.Runnable job)
public void clearAllJobs()
public java.util.ArrayList<java.lang.Runnable> getJobs()
protected void onLayout(boolean changed,
int left,
int top,
int right,
int bottom)
onLayout in class android.view.ViewGroupprotected void onMeasure(int widthMeasureSpec,
int heightMeasureSpec)
onMeasure in class android.view.Viewprotected void onSizeChanged(int w,
int h,
int oldw,
int oldh)
onSizeChanged in class android.view.Viewpublic void setHardwareAccelerationEnabled(boolean enabled)
enabled -