Package 

Class Chart

  • 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.

    • Method Summary

      Modifier and Type Method Description
      String getAccessibilitySummaryDescription()
      void setAccessibilitySummaryDescription(String accessibilitySummaryDescription)
      void setData(T data) Sets a new data object for the chart.
      void clear() Clears the chart from all data (sets it to null) and refreshes it (bycalling invalidate()).
      void clearValues() Removes all DataSets (and thereby Entries) from the chart.
      boolean isEmpty() Returns true if the chart is empty (meaning it's data object is eithernull or contains no entries).
      abstract void notifyDataSetChanged() Lets the chart know its underlying data has changed and performs allnecessary recalculations.
      float getMaxHighlightDistance() Returns the maximum distance in scren dp a touch can be away from an entry to cause it to get highlighted.
      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.
      Array<Highlight> getHighlighted() Returns the array of currently highlighted values.
      boolean isHighlightPerTapEnabled() Returns true if values can be highlighted via tap gesture, false if not.
      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.
      boolean valuesToHighlight() Returns true if there are values to highlight, false if there are novalues to highlight.
      void highlightValues(Array<Highlight> highs) Highlights the values at the given indices in the given DataSets.
      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.
      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.
      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.
      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.
      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.
      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.
      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.
      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.
      void highlightValue(Highlight highlight) Highlights the values represented by the provided Highlight objectThis method *will not* call the listener.
      void highlightValue(Highlight high, boolean callListener) Highlights the value selected by touch gesture.
      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.
      void setOnTouchListener(ChartTouchListener l) Set a new (e.g.
      ChartTouchListener getOnTouchListener() Returns an instance of the currently active touch listener.
      ChartAnimator getAnimator() Returns the animator responsible for animating chart values.
      boolean isDragDecelerationEnabled() If set to true, chart continues to scroll after touch up default: true
      void setDragDecelerationEnabled(boolean enabled) If set to true, chart continues to scroll after touch up.
      float getDragDecelerationFrictionCoef() Returns drag deceleration friction coefficient
      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.
      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.
      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.
      void animateX(int durationMillis, Easing.EasingFunction easing) Animates the rendering of the chart on the x-axis with the specifiedanimation time.
      void animateY(int durationMillis, Easing.EasingFunction easing) Animates the rendering of the chart on the y-axis with the specifiedanimation time.
      void animateX(int durationMillis) Animates the rendering of the chart on the x-axis with the specifiedanimation time.
      void animateY(int durationMillis) Animates the rendering of the chart on the y-axis with the specifiedanimation time.
      void animateXY(int durationMillisX, int durationMillisY) Animates the drawing / rendering of the chart on both x- and y-axis withthe specified animation time.
      XAxis getXAxis() Returns the object representing all x-labels, this method can be used toacquire the XAxis object and modify it (e.g.
      IValueFormatter getDefaultValueFormatter() Returns the default IValueFormatter that has been determined by the chartconsidering the provided minimum and maximum values.
      void setOnChartValueSelectedListener(OnChartValueSelectedListener l) set a selection listener for the chart
      void setOnChartGestureListener(OnChartGestureListener l) Sets a gesture-listener for the chart for custom callbacks when executinggestures on the chart surface.
      OnChartGestureListener getOnChartGestureListener() Returns the custom gesture listener.
      float getYMax() returns the current y-max value across all DataSets
      float getYMin() returns the current y-min value across all DataSets
      float getXChartMax() Returns the maximum x value of the chart, regardless of zoom or translation.
      float getXChartMin() Returns the minimum x value of the chart, regardless of zoom or translation.
      float getXRange()
      MPPointF getCenter() Returns a recyclable MPPointF instance.Returns the center point of the chart (the whole View) in pixels.
      MPPointF getCenterOffsets() Returns a recyclable MPPointF instance.Returns the center of the chart taking offsets under consideration.
      void setExtraOffsets(float left, float top, float right, float bottom) Sets extra offsets (around the chart view) to be appended to theauto-calculated offsets.
      void setExtraTopOffset(float offset) Set an extra offset to be appended to the viewport's top
      float getExtraTopOffset()
      void setExtraRightOffset(float offset) Set an extra offset to be appended to the viewport's right
      float getExtraRightOffset()
      void setExtraBottomOffset(float offset) Set an extra offset to be appended to the viewport's bottom
      float getExtraBottomOffset()
      void setExtraLeftOffset(float offset) Set an extra offset to be appended to the viewport's left
      float getExtraLeftOffset()
      void setLogEnabled(boolean enabled) Set this to true to enable logcat outputs for the chart.
      boolean isLogEnabled() Returns true if log-output is enabled for the chart, fals if not.
      void setNoDataText(String text) Sets the text that informs the user that there is no data available withwhich to draw the chart.
      void setNoDataTextColor(int color) Sets the color of the no data text.
      void setNoDataTextTypeface(Typeface tf) Sets the typeface to be used for the no data text.
      void setNoDataTextAlignment(Paint.Align align) alignment of the no data text
      void setTouchEnabled(boolean enabled) Set this to false to disable all gestures and touches on the chart,default: true
      void setMarker(IMarker marker) sets the marker that is displayed when a value is clicked on the chart
      IMarker getMarker() returns the marker that is set as a marker view for the chart
      void setMarkerView(IMarker v)
      IMarker getMarkerView()
      void setDescription(Description desc) Sets a new Description object for the chart.
      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).
      Legend getLegend() Returns the Legend object of the chart.
      LegendRenderer getLegendRenderer() Returns the renderer object responsible for rendering / drawing theLegend.
      RectF getContentRect() Returns the rectangle that defines the borders of the chart-value surface(into which the actual values are drawn).
      void disableScroll() disables intercept touchevents
      void enableScroll() enables intercept touchevents
      void setPaint(Paint p, int which) set a new paint object for the specified parameter in the chart e.g.Chart.
      Paint getPaint(int which) Returns the paint object associated with the provided constant.
      boolean isDrawMarkerViewsEnabled()
      void setDrawMarkerViews(boolean enabled)
      boolean isDrawMarkersEnabled() returns true if drawing the marker is enabled when tapping on values(use the setMarker(IMarker marker) method to specify a marker)
      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).
      T getData() Returns the ChartData object that has been set for the chart.
      ViewPortHandler getViewPortHandler() Returns the ViewPortHandler of the chart that is responsible for thecontent area of the chart and its offsets and dimensions.
      DataRenderer getRenderer() Returns the Renderer object the chart uses for drawing data.
      void setRenderer(DataRenderer renderer) Sets a new DataRenderer object for the chart.
      IHighlighter getHighlighter()
      void setHighlighter(ChartHighlighter highlighter) Sets a custom highligher object for the chart that handles / processesall highlight touch events performed on the chart-view.
      MPPointF getCenterOfView() Returns a recyclable MPPointF instance.
      Bitmap getChartBitmap() Returns the bitmap that represents the chart.
      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");
      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.
      boolean saveToGallery(String fileName, int quality) Saves the current state of the chart to the gallery as a JPEG image.
      boolean saveToGallery(String fileName) Saves the current state of the chart to the gallery as a PNG image.
      void removeViewportJob(Runnable job)
      void clearAllViewportJobs()
      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.
      ArrayList<Runnable> getJobs() Returns all jobs that are scheduled to be executed afteronSizeChanged(...).
      void setHardwareAccelerationEnabled(boolean enabled) Setting this to true will set the layer-type HARDWARE for the view, falsewill set layer-type SOFTWARE.
      void setUnbindEnabled(boolean enabled) Set this to true to enable "unbinding" of drawables.
      abstract String getAccessibilityDescription()
      boolean dispatchPopulateAccessibilityEvent(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
    • Method Detail

      • 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 highlight
        dataSetIndex - The dataset index to search in
        dataIndex - 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 highlight
        dataSetIndex - 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 highlight
        y - The y-value to highlight.
        dataSetIndex - The dataset index to search in
        dataIndex - 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 highlight
        y - 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 highlight
        dataSetIndex - The dataset index to search in
        dataIndex - 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 highlight
        dataSetIndex - The dataset index to search in
        callListener - 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 highlight
        y - The y-value to highlight.
        dataSetIndex - The dataset index to search in
        dataIndex - 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 highlight
        y - The y-value to highlight.
        dataSetIndex - The dataset index to search in
        callListener - 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 object
        callListener - - 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

      • 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.

      • 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 phase
        easingY - 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.

      • 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.

      • 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

      • setExtraRightOffset

         void setExtraRightOffset(float offset)

        Set an extra offset to be appended to the viewport's right

      • setExtraBottomOffset

         void setExtraBottomOffset(float offset)

        Set an extra offset to be appended to the viewport's bottom

      • setExtraLeftOffset

         void setExtraLeftOffset(float offset)

        Set an extra offset to be appended to the viewport's left

      • 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.

      • 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

      • getMarker

         IMarker getMarker()

        returns the marker that is set as a marker view 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.

      • 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 object
        which - 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.
      • 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

      • getData

         T getData()

        Returns the ChartData object that has been set for the chart.

      • getViewPortHandler

         ViewPortHandler getViewPortHandler()

        Returns the ViewPortHandler of the chart that is responsible for thecontent area of the chart and its offsets and dimensions.

      • setHighlighter

         void setHighlighter(ChartHighlighter highlighter)

        Sets a custom highligher object for the chart that handles / processesall highlight touch events performed on the chart-view.

      • 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.
      • 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.

      • 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