-
- All Implemented Interfaces:
-
android.graphics.drawable.Drawable.Callback,android.view.KeyEvent.Callback,android.view.ViewManager,android.view.ViewParent,android.view.accessibility.AccessibilityEventSource,com.github.mikephil.charting.interfaces.dataprovider.ChartInterface
public abstract class Chart<T extends ChartData<out IDataSet<out Entry>>> extends ViewGroup implements ChartInterface
Baseclass of all Chart-Views.
-
-
Field Summary
Fields Modifier and Type Field Description public final static StringLOG_TAGprivate StringaccessibilitySummaryDescriptionpublic final static intPAINT_GRID_BACKGROUNDpublic final static intPAINT_INFOpublic final static intPAINT_DESCRIPTIONpublic final static intPAINT_HOLEpublic final static intPAINT_CENTER_TEXTpublic final static intPAINT_LEGEND_LABEL
-
Constructor Summary
Constructors Constructor Description Chart(Context context)default constructor for initialization in code Chart(Context context, AttributeSet attrs)constructor for initialization in xml Chart(Context context, AttributeSet attrs, int defStyle)even more awesome constructor
-
Method Summary
Modifier and Type Method Description StringgetAccessibilitySummaryDescription()voidsetAccessibilitySummaryDescription(String accessibilitySummaryDescription)voidsetData(T data)Sets a new data object for the chart. voidclear()Clears the chart from all data (sets it to null) and refreshes it (bycalling invalidate()). voidclearValues()Removes all DataSets (and thereby Entries) from the chart. booleanisEmpty()Returns true if the chart is empty (meaning it's data object is eithernull or contains no entries). abstract voidnotifyDataSetChanged()Lets the chart know its underlying data has changed and performs allnecessary recalculations. floatgetMaxHighlightDistance()Returns the maximum distance in scren dp a touch can be away from an entry to cause it to get highlighted. voidsetMaxHighlightDistance(float distDp)Sets the maximum distance in screen dp a touch can be away from an entry to cause it to get highlighted. Array<Highlight>getHighlighted()Returns the array of currently highlighted values. booleanisHighlightPerTapEnabled()Returns true if values can be highlighted via tap gesture, false if not. voidsetHighlightPerTapEnabled(boolean enabled)Set this to false to prevent values from being highlighted by tap gesture.Values can still be highlighted via drag or programmatically. booleanvaluesToHighlight()Returns true if there are values to highlight, false if there are novalues to highlight. voidhighlightValues(Array<Highlight> highs)Highlights the values at the given indices in the given DataSets. voidhighlightValue(float x, int dataSetIndex, int dataIndex)Highlights any y-value at the given x-value in the given DataSet.Provide -1 as the dataSetIndex to undo all highlighting.This method will call the listener. voidhighlightValue(float x, int dataSetIndex)Highlights any y-value at the given x-value in the given DataSet.Provide -1 as the dataSetIndex to undo all highlighting.This method will call the listener. voidhighlightValue(float x, float y, int dataSetIndex, int dataIndex)Highlights the value at the given x-value and y-value in the given DataSet.Provide -1 as the dataSetIndex to undo all highlighting.This method will call the listener. voidhighlightValue(float x, float y, int dataSetIndex)Highlights the value at the given x-value and y-value in the given DataSet.Provide -1 as the dataSetIndex to undo all highlighting.This method will call the listener. voidhighlightValue(float x, int dataSetIndex, int dataIndex, boolean callListener)Highlights any y-value at the given x-value in the given DataSet.Provide -1 as the dataSetIndex to undo all highlighting. voidhighlightValue(float x, int dataSetIndex, boolean callListener)Highlights any y-value at the given x-value in the given DataSet.Provide -1 as the dataSetIndex to undo all highlighting. voidhighlightValue(float x, float y, int dataSetIndex, int dataIndex, boolean callListener)Highlights any y-value at the given x-value in the given DataSet.Provide -1 as the dataSetIndex to undo all highlighting. voidhighlightValue(float x, float y, int dataSetIndex, boolean callListener)Highlights any y-value at the given x-value in the given DataSet.Provide -1 as the dataSetIndex to undo all highlighting. voidhighlightValue(Highlight highlight)Highlights the values represented by the provided Highlight objectThis method *will not* call the listener. voidhighlightValue(Highlight high, boolean callListener)Highlights the value selected by touch gesture. HighlightgetHighlightByTouchPoint(float x, float y)Returns the Highlight object (contains x-index and DataSet index) of theselected value at the given touch point inside the Line-, Scatter-, orCandleStick-Chart. voidsetOnTouchListener(ChartTouchListener l)Set a new (e.g. ChartTouchListenergetOnTouchListener()Returns an instance of the currently active touch listener. ChartAnimatorgetAnimator()Returns the animator responsible for animating chart values. booleanisDragDecelerationEnabled()If set to true, chart continues to scroll after touch up default: true voidsetDragDecelerationEnabled(boolean enabled)If set to true, chart continues to scroll after touch up. floatgetDragDecelerationFrictionCoef()Returns drag deceleration friction coefficient voidsetDragDecelerationFrictionCoef(float newValue)Deceleration friction coefficient in [0 ; 1] interval, higher valuesindicate that speed will decrease slowly, for example if it set to 0, itwill stop immediately. voidanimateXY(int durationMillisX, int durationMillisY, Easing.EasingFunction easingX, Easing.EasingFunction easingY)Animates the drawing / rendering of the chart on both x- and y-axis withthe specified animation time. voidanimateXY(int durationMillisX, int durationMillisY, Easing.EasingFunction easing)Animates the drawing / rendering of the chart on both x- and y-axis withthe specified animation time. voidanimateX(int durationMillis, Easing.EasingFunction easing)Animates the rendering of the chart on the x-axis with the specifiedanimation time. voidanimateY(int durationMillis, Easing.EasingFunction easing)Animates the rendering of the chart on the y-axis with the specifiedanimation time. voidanimateX(int durationMillis)Animates the rendering of the chart on the x-axis with the specifiedanimation time. voidanimateY(int durationMillis)Animates the rendering of the chart on the y-axis with the specifiedanimation time. voidanimateXY(int durationMillisX, int durationMillisY)Animates the drawing / rendering of the chart on both x- and y-axis withthe specified animation time. XAxisgetXAxis()Returns the object representing all x-labels, this method can be used toacquire the XAxis object and modify it (e.g. IValueFormattergetDefaultValueFormatter()Returns the default IValueFormatter that has been determined by the chartconsidering the provided minimum and maximum values. voidsetOnChartValueSelectedListener(OnChartValueSelectedListener l)set a selection listener for the chart voidsetOnChartGestureListener(OnChartGestureListener l)Sets a gesture-listener for the chart for custom callbacks when executinggestures on the chart surface. OnChartGestureListenergetOnChartGestureListener()Returns the custom gesture listener. floatgetYMax()returns the current y-max value across all DataSets floatgetYMin()returns the current y-min value across all DataSets floatgetXChartMax()Returns the maximum x value of the chart, regardless of zoom or translation. floatgetXChartMin()Returns the minimum x value of the chart, regardless of zoom or translation. floatgetXRange()MPPointFgetCenter()Returns a recyclable MPPointF instance.Returns the center point of the chart (the whole View) in pixels. MPPointFgetCenterOffsets()Returns a recyclable MPPointF instance.Returns the center of the chart taking offsets under consideration. voidsetExtraOffsets(float left, float top, float right, float bottom)Sets extra offsets (around the chart view) to be appended to theauto-calculated offsets. voidsetExtraTopOffset(float offset)Set an extra offset to be appended to the viewport's top floatgetExtraTopOffset()voidsetExtraRightOffset(float offset)Set an extra offset to be appended to the viewport's right floatgetExtraRightOffset()voidsetExtraBottomOffset(float offset)Set an extra offset to be appended to the viewport's bottom floatgetExtraBottomOffset()voidsetExtraLeftOffset(float offset)Set an extra offset to be appended to the viewport's left floatgetExtraLeftOffset()voidsetLogEnabled(boolean enabled)Set this to true to enable logcat outputs for the chart. booleanisLogEnabled()Returns true if log-output is enabled for the chart, fals if not. voidsetNoDataText(String text)Sets the text that informs the user that there is no data available withwhich to draw the chart. voidsetNoDataTextColor(int color)Sets the color of the no data text. voidsetNoDataTextTypeface(Typeface tf)Sets the typeface to be used for the no data text. voidsetNoDataTextAlignment(Paint.Align align)alignment of the no data text voidsetTouchEnabled(boolean enabled)Set this to false to disable all gestures and touches on the chart,default: true voidsetMarker(IMarker marker)sets the marker that is displayed when a value is clicked on the chart IMarkergetMarker()returns the marker that is set as a marker view for the chart voidsetMarkerView(IMarker v)IMarkergetMarkerView()voidsetDescription(Description desc)Sets a new Description object for the chart. DescriptiongetDescription()Returns the Description object of the chart that is responsible for holding all information relatedto the description text that is displayed in the bottom right corner of the chart (by default). LegendgetLegend()Returns the Legend object of the chart. LegendRenderergetLegendRenderer()Returns the renderer object responsible for rendering / drawing theLegend. RectFgetContentRect()Returns the rectangle that defines the borders of the chart-value surface(into which the actual values are drawn). voiddisableScroll()disables intercept touchevents voidenableScroll()enables intercept touchevents voidsetPaint(Paint p, int which)set a new paint object for the specified parameter in the chart e.g.Chart. PaintgetPaint(int which)Returns the paint object associated with the provided constant. booleanisDrawMarkerViewsEnabled()voidsetDrawMarkerViews(boolean enabled)booleanisDrawMarkersEnabled()returns true if drawing the marker is enabled when tapping on values(use the setMarker(IMarker marker) method to specify a marker) voidsetDrawMarkers(boolean enabled)Set this to true to draw a user specified marker when tapping onchart values (use the setMarker(IMarker marker) method to specify amarker). TgetData()Returns the ChartData object that has been set for the chart. ViewPortHandlergetViewPortHandler()Returns the ViewPortHandler of the chart that is responsible for thecontent area of the chart and its offsets and dimensions. DataRenderergetRenderer()Returns the Renderer object the chart uses for drawing data. voidsetRenderer(DataRenderer renderer)Sets a new DataRenderer object for the chart. IHighlightergetHighlighter()voidsetHighlighter(ChartHighlighter highlighter)Sets a custom highligher object for the chart that handles / processesall highlight touch events performed on the chart-view. MPPointFgetCenterOfView()Returns a recyclable MPPointF instance. BitmapgetChartBitmap()Returns the bitmap that represents the chart. booleansaveToPath(String title, String pathOnSD)Saves the current chart state with the given name to the given path onthe sdcard leaving the path empty "" will put the saved file directly onthe SD card chart is saved as a PNG image, example:saveToPath("myfilename", "foldername1/foldername2"); booleansaveToGallery(String fileName, String subFolderPath, String fileDescription, Bitmap.CompressFormat format, int quality)Saves the current state of the chart to the gallery as an image type. booleansaveToGallery(String fileName, int quality)Saves the current state of the chart to the gallery as a JPEG image. booleansaveToGallery(String fileName)Saves the current state of the chart to the gallery as a PNG image. voidremoveViewportJob(Runnable job)voidclearAllViewportJobs()voidaddViewportJob(Runnable job)Either posts a job immediately if the chart has already setup it'sdimensions or adds the job to the execution queue. ArrayList<Runnable>getJobs()Returns all jobs that are scheduled to be executed afteronSizeChanged(...). voidsetHardwareAccelerationEnabled(boolean enabled)Setting this to true will set the layer-type HARDWARE for the view, falsewill set layer-type SOFTWARE. voidsetUnbindEnabled(boolean enabled)Set this to true to enable "unbinding" of drawables. abstract StringgetAccessibilityDescription()booleandispatchPopulateAccessibilityEvent(AccessibilityEvent event)-
Methods inherited from class android.view.ViewGroup
addChildrenForAccessibility, addExtraDataToAccessibilityNodeInfo, addFocusables, addKeyboardNavigationClusters, addStatesFromChildren, addTouchables, addView, bringChildToFront, childDrawableStateChanged, childHasTransientStateChanged, clearChildFocus, clearDisappearingChildren, clearFocus, dispatchApplyWindowInsets, dispatchCapturedPointerEvent, dispatchConfigurationChanged, dispatchCreateViewTranslationRequest, dispatchDisplayHint, dispatchDragEvent, dispatchDrawableHotspotChanged, dispatchFinishTemporaryDetach, dispatchKeyEvent, dispatchKeyEventPreIme, dispatchKeyShortcutEvent, dispatchPointerCaptureChanged, dispatchProvideAutofillStructure, dispatchProvideStructure, dispatchScrollCaptureSearch, dispatchSetActivated, dispatchSetSelected, dispatchStartTemporaryDetach, dispatchSystemUiVisibilityChanged, dispatchTouchEvent, dispatchTrackballEvent, dispatchUnhandledMove, dispatchWindowFocusChanged, dispatchWindowInsetsAnimationEnd, dispatchWindowInsetsAnimationPrepare, dispatchWindowInsetsAnimationProgress, dispatchWindowInsetsAnimationStart, dispatchWindowSystemUiVisiblityChanged, dispatchWindowVisibilityChanged, endViewTransition, findFocus, findOnBackInvokedDispatcherForChild, findViewsWithText, focusSearch, focusableViewAvailable, gatherTransparentRegion, generateLayoutParams, getAccessibilityClassName, getChildAt, getChildCount, getChildMeasureSpec, getChildVisibleRect, getClipChildren, getClipToPadding, getDescendantFocusability, getFocusedChild, getLayoutAnimation, getLayoutAnimationListener, getLayoutMode, getLayoutTransition, getNestedScrollAxes, getOverlay, getPersistentDrawingCache, getTouchscreenBlocksFocus, hasFocus, hasTransientState, indexOfChild, invalidateChild, invalidateChildInParent, isAlwaysDrawnWithCacheEnabled, isAnimationCacheEnabled, isLayoutSuppressed, isMotionEventSplittingEnabled, isTransitionGroup, jumpDrawablesToCurrentState, layout, notifySubtreeAccessibilityStateChanged, offsetDescendantRectToMyCoords, offsetRectIntoDescendantCoords, onDescendantInvalidated, onInterceptHoverEvent, onInterceptTouchEvent, onNestedFling, onNestedPreFling, onNestedPrePerformAccessibilityAction, onNestedPreScroll, onNestedScroll, onNestedScrollAccepted, onRequestSendAccessibilityEvent, onResolvePointerIcon, onStartNestedScroll, onStopNestedScroll, onViewAdded, onViewRemoved, recomputeViewAttributes, removeAllViews, removeAllViewsInLayout, removeView, removeViewAt, removeViewInLayout, removeViews, removeViewsInLayout, requestChildFocus, requestChildRectangleOnScreen, requestDisallowInterceptTouchEvent, requestFocus, requestSendAccessibilityEvent, requestTransparentRegion, restoreDefaultFocus, scheduleLayoutAnimation, setAddStatesFromChildren, setAlwaysDrawnWithCacheEnabled, setAnimationCacheEnabled, setClipChildren, setClipToPadding, setDescendantFocusability, setLayoutAnimation, setLayoutAnimationListener, setLayoutMode, setLayoutTransition, setMotionEventSplittingEnabled, setOnHierarchyChangeListener, setPersistentDrawingCache, setTouchscreenBlocksFocus, setTransitionGroup, setWindowInsetsAnimationCallback, shouldDelayChildPressedState, showContextMenuForChild, startActionModeForChild, startLayoutAnimation, startViewTransition, suppressLayout, updateViewLayout -
Methods inherited from class android.view.View
addOnAttachStateChangeListener, addOnLayoutChangeListener, addOnUnhandledKeyEventListener, animate, announceForAccessibility, autofill, bringToFront, buildDrawingCache, buildLayer, callOnClick, canResolveLayoutDirection, canResolveTextAlignment, canResolveTextDirection, canScrollHorizontally, canScrollVertically, cancelDragAndDrop, cancelLongPress, cancelPendingInputEvents, checkInputConnectionProxy, clearAnimation, clearPendingCredentialRequest, clearViewTranslationCallback, combineMeasuredStates, computeScroll, computeSystemWindowInsets, createAccessibilityNodeInfo, createContextMenu, destroyDrawingCache, dispatchGenericMotionEvent, dispatchNestedFling, dispatchNestedPreFling, dispatchNestedPrePerformAccessibilityAction, dispatchNestedPreScroll, dispatchNestedScroll, dispatchPopulateAccessibilityEvent, draw, drawableHotspotChanged, findOnBackInvokedDispatcher, findViewById, findViewWithTag, forceHasOverlappingRendering, forceLayout, generateDisplayHash, generateViewId, getAccessibilityDelegate, getAccessibilityLiveRegion, getAccessibilityNodeProvider, getAccessibilityPaneTitle, getAccessibilityTraversalAfter, getAccessibilityTraversalBefore, getAllowedHandwritingDelegatePackageName, getAllowedHandwritingDelegatorPackageName, getAlpha, getAnimation, getAnimationMatrix, getApplicationWindowToken, getAttributeResolutionStack, getAttributeSourceResourceMap, getAutofillHints, getAutofillId, getAutofillType, getAutofillValue, getBackground, getBackgroundTintBlendMode, getBackgroundTintList, getBackgroundTintMode, getBaseline, getBottom, getCameraDistance, getClipBounds, getClipBounds, getClipToOutline, getContentCaptureSession, getContentDescription, getContentSensitivity, getContext, getDefaultFocusHighlightEnabled, getDefaultSize, getDisplay, getDrawableState, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getElevation, getExplicitStyle, getFilterTouchesWhenObscured, getFitsSystemWindows, getFocusable, getFocusables, getFocusedRect, getForeground, getForegroundGravity, getForegroundTintBlendMode, getForegroundTintList, getForegroundTintMode, getFrameContentVelocity, getGlobalVisibleRect, getHandler, getHandwritingBoundsOffsetBottom, getHandwritingBoundsOffsetLeft, getHandwritingBoundsOffsetRight, getHandwritingBoundsOffsetTop, getHandwritingDelegateFlags, getHandwritingDelegatorCallback, getHasOverlappingRendering, getHeight, getHitRect, getHorizontalFadingEdgeLength, getHorizontalScrollbarThumbDrawable, getHorizontalScrollbarTrackDrawable, getId, getImportantForAccessibility, getImportantForAutofill, getImportantForContentCapture, getKeepScreenOn, getKeyDispatcherState, getLabelFor, getLayerType, getLayoutDirection, getLayoutParams, getLeft, getLocalVisibleRect, getLocationInSurface, getLocationInWindow, getLocationOnScreen, getMatrix, getMeasuredHeight, getMeasuredHeightAndState, getMeasuredState, getMeasuredWidth, getMeasuredWidthAndState, getMinimumHeight, getMinimumWidth, getNextClusterForwardId, getNextFocusDownId, getNextFocusForwardId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getOutlineAmbientShadowColor, getOutlineProvider, getOutlineSpotShadowColor, getOverScrollMode, getOverlay, getPaddingBottom, getPaddingEnd, getPaddingLeft, getPaddingRight, getPaddingStart, getPaddingTop, getParent, getParentForAccessibility, getPendingCredentialCallback, getPendingCredentialRequest, getPivotX, getPivotY, getPointerIcon, getPreferKeepClearRects, getReceiveContentMimeTypes, getRequestedFrameRate, getResources, getRevealOnFocusHint, getRight, getRootSurfaceControl, getRootView, getRootWindowInsets, getRotation, getRotationX, getRotationY, getScaleX, getScaleY, getScrollBarDefaultDelayBeforeFade, getScrollBarFadeDuration, getScrollBarSize, getScrollBarStyle, getScrollCaptureHint, getScrollIndicators, getScrollX, getScrollY, getSolidColor, getSourceLayoutResId, getStateDescription, getStateListAnimator, getSystemGestureExclusionRects, getSystemUiVisibility, getTag, getTextAlignment, getTextDirection, getTooltipText, getTop, getTouchDelegate, getTouchables, getTransitionAlpha, getTransitionName, getTranslationX, getTranslationY, getTranslationZ, getUniqueDrawingId, getVerticalFadingEdgeLength, getVerticalScrollbarPosition, getVerticalScrollbarThumbDrawable, getVerticalScrollbarTrackDrawable, getVerticalScrollbarWidth, getViewTranslationResponse, getViewTreeObserver, getVisibility, getWidth, getWindowId, getWindowInsetsController, getWindowSystemUiVisibility, getWindowToken, getWindowVisibility, getWindowVisibleDisplayFrame, getX, getY, getZ, hasExplicitFocusable, hasFocusable, hasNestedScrollingParent, hasOnClickListeners, hasOnLongClickListeners, hasOverlappingRendering, hasPointerCapture, hasWindowFocus, inflate, invalidate, invalidateDrawable, invalidateOutline, isAccessibilityDataSensitive, isAccessibilityFocused, isAccessibilityHeading, isActivated, isAttachedToWindow, isAutoHandwritingEnabled, isClickable, isContentSensitive, isContextClickable, isCredential, isDirty, isDrawingCacheEnabled, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isFocusedByDefault, isForceDarkAllowed, isHandwritingDelegate, isHapticFeedbackEnabled, isHardwareAccelerated, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isHovered, isImportantForAccessibility, isImportantForAutofill, isImportantForContentCapture, isInEditMode, isInLayout, isInTouchMode, isKeyboardNavigationCluster, isLaidOut, isLayoutDirectionResolved, isLayoutRequested, isLongClickable, isNestedScrollingEnabled, isOpaque, isPaddingRelative, isPivotSet, isPreferKeepClear, isPressed, isSaveEnabled, isSaveFromParentEnabled, isScreenReaderFocusable, isScrollContainer, isScrollbarFadingEnabled, isSelected, isShowingLayoutBounds, isShown, isSoundEffectsEnabled, isTemporarilyDetached, isTextAlignmentResolved, isTextDirectionResolved, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, isVisibleToUserForAutofill, keyboardNavigationClusterSearch, measure, offsetLeftAndRight, offsetTopAndBottom, onApplyWindowInsets, onCancelPendingInputEvents, onCapturedPointerEvent, onCheckIsTextEditor, onCreateInputConnection, onCreateViewTranslationRequest, onCreateVirtualViewTranslationRequests, onDragEvent, onDrawForeground, onFilterTouchEventForSecurity, onFinishTemporaryDetach, onGenericMotionEvent, onHoverChanged, onHoverEvent, onInitializeAccessibilityEvent, onInitializeAccessibilityNodeInfo, onKeyDown, onKeyLongPress, onKeyMultiple, onKeyPreIme, onKeyShortcut, onKeyUp, onPointerCaptureChange, onPopulateAccessibilityEvent, onProvideAutofillStructure, onProvideAutofillVirtualStructure, onProvideContentCaptureStructure, onProvideStructure, onProvideVirtualStructure, onReceiveContent, onRtlPropertiesChanged, onScreenStateChanged, onScrollCaptureSearch, onStartTemporaryDetach, onTouchEvent, onTrackballEvent, onViewTranslationResponse, onVirtualViewTranslationResponses, onVisibilityAggregated, onWindowFocusChanged, onWindowSystemUiVisibilityChanged, performAccessibilityAction, performClick, performContextClick, performHapticFeedback, performLongClick, performReceiveContent, playSoundEffect, post, postDelayed, postInvalidate, postInvalidateDelayed, postInvalidateOnAnimation, postOnAnimation, postOnAnimationDelayed, refreshDrawableState, releasePointerCapture, removeCallbacks, removeOnAttachStateChangeListener, removeOnLayoutChangeListener, removeOnUnhandledKeyEventListener, requestApplyInsets, requestFitSystemWindows, requestFocusFromTouch, requestLayout, requestPointerCapture, requestRectangleOnScreen, requestUnbufferedDispatch, requireViewById, resetPivot, resolveSize, resolveSizeAndState, restoreHierarchyState, saveAttributeDataForStyleable, saveHierarchyState, scheduleDrawable, scrollBy, scrollTo, sendAccessibilityEvent, sendAccessibilityEventUnchecked, setAccessibilityDataSensitive, setAccessibilityDelegate, setAccessibilityHeading, setAccessibilityLiveRegion, setAccessibilityPaneTitle, setAccessibilityTraversalAfter, setAccessibilityTraversalBefore, setActivated, setAllowClickWhenDisabled, setAllowedHandwritingDelegatePackage, setAllowedHandwritingDelegatorPackage, setAlpha, setAnimation, setAnimationMatrix, setAutoHandwritingEnabled, setAutofillHints, setAutofillId, setBackground, setBackgroundColor, setBackgroundDrawable, setBackgroundResource, setBackgroundTintBlendMode, setBackgroundTintList, setBackgroundTintMode, setBottom, setCameraDistance, setClickable, setClipBounds, setClipToOutline, setContentCaptureSession, setContentDescription, setContentSensitivity, setContextClickable, setDefaultFocusHighlightEnabled, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setElevation, setEnabled, setFadingEdgeLength, setFilterTouchesWhenObscured, setFitsSystemWindows, setFocusable, setFocusableInTouchMode, setFocusedByDefault, setForceDarkAllowed, setForeground, setForegroundGravity, setForegroundTintBlendMode, setForegroundTintList, setForegroundTintMode, setFrameContentVelocity, setHandwritingBoundsOffsets, setHandwritingDelegateFlags, setHandwritingDelegatorCallback, setHapticFeedbackEnabled, setHasTransientState, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setHorizontalScrollbarThumbDrawable, setHorizontalScrollbarTrackDrawable, setHovered, setId, setImportantForAccessibility, setImportantForAutofill, setImportantForContentCapture, setIsCredential, setIsHandwritingDelegate, setKeepScreenOn, setKeyboardNavigationCluster, setLabelFor, setLayerPaint, setLayerType, setLayoutDirection, setLayoutParams, setLeft, setLeftTopRightBottom, setLongClickable, setMinimumHeight, setMinimumWidth, setNestedScrollingEnabled, setNextClusterForwardId, setNextFocusDownId, setNextFocusForwardId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnApplyWindowInsetsListener, setOnCapturedPointerListener, setOnClickListener, setOnContextClickListener, setOnCreateContextMenuListener, setOnDragListener, setOnFocusChangeListener, setOnGenericMotionListener, setOnHoverListener, setOnKeyListener, setOnLongClickListener, setOnReceiveContentListener, setOnScrollChangeListener, setOnSystemUiVisibilityChangeListener, setOnTouchListener, setOutlineAmbientShadowColor, setOutlineProvider, setOutlineSpotShadowColor, setOverScrollMode, setPadding, setPaddingRelative, setPendingCredentialRequest, setPivotX, setPivotY, setPointerIcon, setPreferKeepClear, setPreferKeepClearRects, setPressed, setRenderEffect, setRequestedFrameRate, setRevealOnFocusHint, setRight, setRotation, setRotationX, setRotationY, setSaveEnabled, setSaveFromParentEnabled, setScaleX, setScaleY, setScreenReaderFocusable, setScrollBarDefaultDelayBeforeFade, setScrollBarFadeDuration, setScrollBarSize, setScrollBarStyle, setScrollCaptureCallback, setScrollCaptureHint, setScrollContainer, setScrollIndicators, setScrollX, setScrollY, setScrollbarFadingEnabled, setSelected, setSoundEffectsEnabled, setStateDescription, setStateListAnimator, setSystemGestureExclusionRects, setSystemUiVisibility, setTag, setTextAlignment, setTextDirection, setTooltipText, setTop, setTouchDelegate, setTransitionAlpha, setTransitionName, setTransitionVisibility, setTranslationX, setTranslationY, setTranslationZ, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setVerticalScrollbarPosition, setVerticalScrollbarThumbDrawable, setVerticalScrollbarTrackDrawable, setViewTranslationCallback, setVisibility, setWillNotCacheDrawing, setWillNotDraw, setX, setY, setZ, showContextMenu, startActionMode, startAnimation, startDrag, startDragAndDrop, startNestedScroll, stopNestedScroll, toString, transformMatrixToGlobal, transformMatrixToLocal, unscheduleDrawable, updateDragShadow, willNotCacheDrawing, willNotDraw -
Methods inherited from class com.github.mikephil.charting.interfaces.dataprovider.ChartInterface
getData, getHeight, getMaxVisibleCount, getWidth, getYChartMax, getYChartMin -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
Chart
Chart(Context context)
default constructor for initialization in code
-
Chart
Chart(Context context, AttributeSet attrs)
constructor for initialization in xml
-
Chart
Chart(Context context, AttributeSet attrs, int defStyle)
even more awesome constructor
-
-
Method Detail
-
getAccessibilitySummaryDescription
String getAccessibilitySummaryDescription()
-
setAccessibilitySummaryDescription
void setAccessibilitySummaryDescription(String accessibilitySummaryDescription)
-
setData
void setData(T data)
Sets a new data object for the chart. The data object contains all valuesand information needed for displaying.
-
clear
void clear()
Clears the chart from all data (sets it to null) and refreshes it (bycalling invalidate()).
-
clearValues
void clearValues()
Removes all DataSets (and thereby Entries) from the chart. Does not set the data object to null. Also refreshes thechart by calling invalidate().
-
isEmpty
boolean isEmpty()
Returns true if the chart is empty (meaning it's data object is eithernull or contains no entries).
-
notifyDataSetChanged
abstract void notifyDataSetChanged()
Lets the chart know its underlying data has changed and performs allnecessary recalculations. It is crucial that this method is calledeverytime data is changed dynamically. Not calling this method can leadto crashes or unexpected behaviour.
-
getMaxHighlightDistance
float getMaxHighlightDistance()
Returns the maximum distance in scren dp a touch can be away from an entry to cause it to get highlighted.
-
setMaxHighlightDistance
void setMaxHighlightDistance(float distDp)
Sets the maximum distance in screen dp a touch can be away from an entry to cause it to get highlighted.Default: 500dp
-
getHighlighted
Array<Highlight> getHighlighted()
Returns the array of currently highlighted values. This might a null orempty array if nothing is highlighted.
-
isHighlightPerTapEnabled
boolean isHighlightPerTapEnabled()
Returns true if values can be highlighted via tap gesture, false if not.
-
setHighlightPerTapEnabled
void setHighlightPerTapEnabled(boolean enabled)
Set this to false to prevent values from being highlighted by tap gesture.Values can still be highlighted via drag or programmatically. Default: true
-
valuesToHighlight
boolean valuesToHighlight()
Returns true if there are values to highlight, false if there are novalues to highlight. Checks if the highlight array is null, has a lengthof zero or if the first object is null.
-
highlightValues
void highlightValues(Array<Highlight> highs)
Highlights the values at the given indices in the given DataSets. Providenull or an empty array to undo all highlighting. This should be used toprogrammatically highlight values.This method *will not* call the listener.
-
highlightValue
void highlightValue(float x, int dataSetIndex, int dataIndex)
Highlights any y-value at the given x-value in the given DataSet.Provide -1 as the dataSetIndex to undo all highlighting.This method will call the listener.
- Parameters:
x- The x-value to highlightdataSetIndex- The dataset index to search indataIndex- The data index to search in (only used in CombinedChartView currently)
-
highlightValue
void highlightValue(float x, int dataSetIndex)
Highlights any y-value at the given x-value in the given DataSet.Provide -1 as the dataSetIndex to undo all highlighting.This method will call the listener.
- Parameters:
x- The x-value to highlightdataSetIndex- The dataset index to search in
-
highlightValue
void highlightValue(float x, float y, int dataSetIndex, int dataIndex)
Highlights the value at the given x-value and y-value in the given DataSet.Provide -1 as the dataSetIndex to undo all highlighting.This method will call the listener.
- Parameters:
x- The x-value to highlighty- The y-value to highlight.dataSetIndex- The dataset index to search indataIndex- The data index to search in (only used in CombinedChartView currently)
-
highlightValue
void highlightValue(float x, float y, int dataSetIndex)
Highlights the value at the given x-value and y-value in the given DataSet.Provide -1 as the dataSetIndex to undo all highlighting.This method will call the listener.
- Parameters:
x- The x-value to highlighty- The y-value to highlight.dataSetIndex- The dataset index to search in
-
highlightValue
void highlightValue(float x, int dataSetIndex, int dataIndex, boolean callListener)
Highlights any y-value at the given x-value in the given DataSet.Provide -1 as the dataSetIndex to undo all highlighting.
- Parameters:
x- The x-value to highlightdataSetIndex- The dataset index to search indataIndex- The data index to search in (only used in CombinedChartView currently)callListener- Should the listener be called for this change
-
highlightValue
void highlightValue(float x, int dataSetIndex, boolean callListener)
Highlights any y-value at the given x-value in the given DataSet.Provide -1 as the dataSetIndex to undo all highlighting.
- Parameters:
x- The x-value to highlightdataSetIndex- The dataset index to search incallListener- Should the listener be called for this change
-
highlightValue
void highlightValue(float x, float y, int dataSetIndex, int dataIndex, boolean callListener)
Highlights any y-value at the given x-value in the given DataSet.Provide -1 as the dataSetIndex to undo all highlighting.
- Parameters:
x- The x-value to highlighty- The y-value to highlight.dataSetIndex- The dataset index to search indataIndex- The data index to search in (only used in CombinedChartView currently)callListener- Should the listener be called for this change
-
highlightValue
void highlightValue(float x, float y, int dataSetIndex, boolean callListener)
Highlights any y-value at the given x-value in the given DataSet.Provide -1 as the dataSetIndex to undo all highlighting.
- Parameters:
x- The x-value to highlighty- The y-value to highlight.dataSetIndex- The dataset index to search incallListener- Should the listener be called for this change
-
highlightValue
void highlightValue(Highlight highlight)
Highlights the values represented by the provided Highlight objectThis method *will not* call the listener.
- Parameters:
highlight- contains information about which entry should be highlighted
-
highlightValue
void highlightValue(Highlight high, boolean callListener)
Highlights the value selected by touch gesture. UnlikehighlightValues(...), this generates a callback to theOnChartValueSelectedListener.
- Parameters:
high- - the highlight objectcallListener- - call the listener
-
getHighlightByTouchPoint
Highlight getHighlightByTouchPoint(float x, float y)
Returns the Highlight object (contains x-index and DataSet index) of theselected value at the given touch point inside the Line-, Scatter-, orCandleStick-Chart.
-
setOnTouchListener
void setOnTouchListener(ChartTouchListener l)
Set a new (e.g. custom) ChartTouchListener NOTE: make sure tosetTouchEnabled(true); if you need touch gestures on the chart
-
getOnTouchListener
ChartTouchListener getOnTouchListener()
Returns an instance of the currently active touch listener.
-
getAnimator
ChartAnimator getAnimator()
Returns the animator responsible for animating chart values.
-
isDragDecelerationEnabled
boolean isDragDecelerationEnabled()
If set to true, chart continues to scroll after touch up default: true
-
setDragDecelerationEnabled
void setDragDecelerationEnabled(boolean enabled)
If set to true, chart continues to scroll after touch up. Default: true.
-
getDragDecelerationFrictionCoef
float getDragDecelerationFrictionCoef()
Returns drag deceleration friction coefficient
-
setDragDecelerationFrictionCoef
void setDragDecelerationFrictionCoef(float newValue)
Deceleration friction coefficient in [0 ; 1] interval, higher valuesindicate that speed will decrease slowly, for example if it set to 0, itwill stop immediately. 1 is an invalid value, and will be converted to0.999f automatically.
-
animateXY
void animateXY(int durationMillisX, int durationMillisY, Easing.EasingFunction easingX, Easing.EasingFunction easingY)
Animates the drawing / rendering of the chart on both x- and y-axis withthe specified animation time. If animate(...) is called, no furthercalling of invalidate() is necessary to refresh the chart. ANIMATIONSONLY WORK FOR API LEVEL 11 (Android 3.0.x) AND HIGHER.
- Parameters:
easingX- a custom easing function to be used on the animation phaseeasingY- a custom easing function to be used on the animation phase
-
animateXY
void animateXY(int durationMillisX, int durationMillisY, Easing.EasingFunction easing)
Animates the drawing / rendering of the chart on both x- and y-axis withthe specified animation time. If animate(...) is called, no furthercalling of invalidate() is necessary to refresh the chart. ANIMATIONSONLY WORK FOR API LEVEL 11 (Android 3.0.x) AND HIGHER.
- Parameters:
easing- a custom easing function to be used on the animation phase
-
animateX
void animateX(int durationMillis, Easing.EasingFunction easing)
Animates the rendering of the chart on the x-axis with the specifiedanimation time. If animate(...) is called, no further calling ofinvalidate() is necessary to refresh the chart. ANIMATIONS ONLY WORK FORAPI LEVEL 11 (Android 3.0.x) AND HIGHER.
- Parameters:
easing- a custom easing function to be used on the animation phase
-
animateY
void animateY(int durationMillis, Easing.EasingFunction easing)
Animates the rendering of the chart on the y-axis with the specifiedanimation time. If animate(...) is called, no further calling ofinvalidate() is necessary to refresh the chart. ANIMATIONS ONLY WORK FORAPI LEVEL 11 (Android 3.0.x) AND HIGHER.
- Parameters:
easing- a custom easing function to be used on the animation phase
-
animateX
void animateX(int durationMillis)
Animates the rendering of the chart on the x-axis with the specifiedanimation time. If animate(...) is called, no further calling ofinvalidate() is necessary to refresh the chart. ANIMATIONS ONLY WORK FORAPI LEVEL 11 (Android 3.0.x) AND HIGHER.
-
animateY
void animateY(int durationMillis)
Animates the rendering of the chart on the y-axis with the specifiedanimation time. If animate(...) is called, no further calling ofinvalidate() is necessary to refresh the chart. ANIMATIONS ONLY WORK FORAPI LEVEL 11 (Android 3.0.x) AND HIGHER.
-
animateXY
void animateXY(int durationMillisX, int durationMillisY)
Animates the drawing / rendering of the chart on both x- and y-axis withthe specified animation time. If animate(...) is called, no furthercalling of invalidate() is necessary to refresh the chart. ANIMATIONSONLY WORK FOR API LEVEL 11 (Android 3.0.x) AND HIGHER.
-
getXAxis
XAxis getXAxis()
Returns the object representing all x-labels, this method can be used toacquire the XAxis object and modify it (e.g. change the position of thelabels, styling, etc.)
-
getDefaultValueFormatter
IValueFormatter getDefaultValueFormatter()
Returns the default IValueFormatter that has been determined by the chartconsidering the provided minimum and maximum values.
-
setOnChartValueSelectedListener
void setOnChartValueSelectedListener(OnChartValueSelectedListener l)
set a selection listener for the chart
-
setOnChartGestureListener
void setOnChartGestureListener(OnChartGestureListener l)
Sets a gesture-listener for the chart for custom callbacks when executinggestures on the chart surface.
-
getOnChartGestureListener
OnChartGestureListener getOnChartGestureListener()
Returns the custom gesture listener.
-
getYMax
float getYMax()
returns the current y-max value across all DataSets
-
getYMin
float getYMin()
returns the current y-min value across all DataSets
-
getXChartMax
float getXChartMax()
Returns the maximum x value of the chart, regardless of zoom or translation.
-
getXChartMin
float getXChartMin()
Returns the minimum x value of the chart, regardless of zoom or translation.
-
getXRange
float getXRange()
-
getCenter
MPPointF getCenter()
Returns a recyclable MPPointF instance.Returns the center point of the chart (the whole View) in pixels.
-
getCenterOffsets
MPPointF getCenterOffsets()
Returns a recyclable MPPointF instance.Returns the center of the chart taking offsets under consideration.(returns the center of the content rectangle)
-
setExtraOffsets
void setExtraOffsets(float left, float top, float right, float bottom)
Sets extra offsets (around the chart view) to be appended to theauto-calculated offsets.
-
setExtraTopOffset
void setExtraTopOffset(float offset)
Set an extra offset to be appended to the viewport's top
-
getExtraTopOffset
float getExtraTopOffset()
-
setExtraRightOffset
void setExtraRightOffset(float offset)
Set an extra offset to be appended to the viewport's right
-
getExtraRightOffset
float getExtraRightOffset()
-
setExtraBottomOffset
void setExtraBottomOffset(float offset)
Set an extra offset to be appended to the viewport's bottom
-
getExtraBottomOffset
float getExtraBottomOffset()
-
setExtraLeftOffset
void setExtraLeftOffset(float offset)
Set an extra offset to be appended to the viewport's left
-
getExtraLeftOffset
float getExtraLeftOffset()
-
setLogEnabled
void setLogEnabled(boolean enabled)
Set this to true to enable logcat outputs for the chart. Beware thatlogcat output decreases rendering performance. Default: disabled.
-
isLogEnabled
boolean isLogEnabled()
Returns true if log-output is enabled for the chart, fals if not.
-
setNoDataText
void setNoDataText(String text)
Sets the text that informs the user that there is no data available withwhich to draw the chart.
-
setNoDataTextColor
void setNoDataTextColor(int color)
Sets the color of the no data text.
-
setNoDataTextTypeface
void setNoDataTextTypeface(Typeface tf)
Sets the typeface to be used for the no data text.
-
setNoDataTextAlignment
void setNoDataTextAlignment(Paint.Align align)
alignment of the no data text
-
setTouchEnabled
void setTouchEnabled(boolean enabled)
Set this to false to disable all gestures and touches on the chart,default: true
-
setMarker
void setMarker(IMarker marker)
sets the marker that is displayed when a value is clicked on the chart
-
setMarkerView
@Deprecated() void setMarkerView(IMarker v)
-
getMarkerView
@Deprecated() IMarker getMarkerView()
-
setDescription
void setDescription(Description desc)
Sets a new Description object for the chart.
-
getDescription
Description getDescription()
Returns the Description object of the chart that is responsible for holding all information relatedto the description text that is displayed in the bottom right corner of the chart (by default).
-
getLegend
Legend getLegend()
Returns the Legend object of the chart. This method can be used to get aninstance of the legend in order to customize the automatically generatedLegend.
-
getLegendRenderer
LegendRenderer getLegendRenderer()
Returns the renderer object responsible for rendering / drawing theLegend.
-
getContentRect
RectF getContentRect()
Returns the rectangle that defines the borders of the chart-value surface(into which the actual values are drawn).
-
disableScroll
void disableScroll()
disables intercept touchevents
-
enableScroll
void enableScroll()
enables intercept touchevents
-
setPaint
void setPaint(Paint p, int which)
set a new paint object for the specified parameter in the chart e.g.Chart.PAINT_VALUES
- Parameters:
p- the new paint objectwhich- Chart.PAINT_VALUES, Chart.PAINT_GRID, Chart.PAINT_VALUES,...
-
getPaint
Paint getPaint(int which)
Returns the paint object associated with the provided constant.
- Parameters:
which- e.g.
-
isDrawMarkerViewsEnabled
@Deprecated() boolean isDrawMarkerViewsEnabled()
-
setDrawMarkerViews
@Deprecated() void setDrawMarkerViews(boolean enabled)
-
isDrawMarkersEnabled
boolean isDrawMarkersEnabled()
returns true if drawing the marker is enabled when tapping on values(use the setMarker(IMarker marker) method to specify a marker)
-
setDrawMarkers
void setDrawMarkers(boolean enabled)
Set this to true to draw a user specified marker when tapping onchart values (use the setMarker(IMarker marker) method to specify amarker). Default: true
-
getViewPortHandler
ViewPortHandler getViewPortHandler()
Returns the ViewPortHandler of the chart that is responsible for thecontent area of the chart and its offsets and dimensions.
-
getRenderer
DataRenderer getRenderer()
Returns the Renderer object the chart uses for drawing data.
-
setRenderer
void setRenderer(DataRenderer renderer)
Sets a new DataRenderer object for the chart.
-
getHighlighter
IHighlighter getHighlighter()
-
setHighlighter
void setHighlighter(ChartHighlighter highlighter)
Sets a custom highligher object for the chart that handles / processesall highlight touch events performed on the chart-view.
-
getCenterOfView
MPPointF getCenterOfView()
Returns a recyclable MPPointF instance.
-
getChartBitmap
Bitmap getChartBitmap()
Returns the bitmap that represents the chart.
-
saveToPath
boolean saveToPath(String title, String pathOnSD)
Saves the current chart state with the given name to the given path onthe sdcard leaving the path empty "" will put the saved file directly onthe SD card chart is saved as a PNG image, example:saveToPath("myfilename", "foldername1/foldername2");
- Parameters:
pathOnSD- e.g.
-
saveToGallery
boolean saveToGallery(String fileName, String subFolderPath, String fileDescription, Bitmap.CompressFormat format, int quality)
Saves the current state of the chart to the gallery as an image type. Thecompression must be set for JPEG only. 0 == maximum compression, 100 = lowcompression (high quality). NOTE: Needs permission WRITE_EXTERNAL_STORAGE
- Parameters:
fileName- e.g.subFolderPath- e.g.fileDescription- e.g.format- e.g.quality- e.g.
-
saveToGallery
boolean saveToGallery(String fileName, int quality)
Saves the current state of the chart to the gallery as a JPEG image. Thefilename and compression can be set. 0 == maximum compression, 100 = lowcompression (high quality). NOTE: Needs permission WRITE_EXTERNAL_STORAGE
- Parameters:
fileName- e.g.quality- e.g.
-
saveToGallery
boolean saveToGallery(String fileName)
Saves the current state of the chart to the gallery as a PNG image.NOTE: Needs permission WRITE_EXTERNAL_STORAGE
- Parameters:
fileName- e.g.
-
removeViewportJob
void removeViewportJob(Runnable job)
-
clearAllViewportJobs
void clearAllViewportJobs()
-
addViewportJob
void addViewportJob(Runnable job)
Either posts a job immediately if the chart has already setup it'sdimensions or adds the job to the execution queue.
-
getJobs
ArrayList<Runnable> getJobs()
Returns all jobs that are scheduled to be executed afteronSizeChanged(...).
-
setHardwareAccelerationEnabled
void setHardwareAccelerationEnabled(boolean enabled)
Setting this to true will set the layer-type HARDWARE for the view, falsewill set layer-type SOFTWARE.
-
setUnbindEnabled
void setUnbindEnabled(boolean enabled)
Set this to true to enable "unbinding" of drawables. When a View is detachedfrom a window. This helps avoid memory leaks.Default: falseLink: http://stackoverflow.com/a/6779164/1590502
-
getAccessibilityDescription
abstract String getAccessibilityDescription()
-
dispatchPopulateAccessibilityEvent
boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event)
-
-
-
-