-
- 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 class PieChart extends PieRadarChartBase<PieData>
View that represents a pie chart. Draws cake like slices.
-
-
Constructor Summary
Constructors Constructor Description PieChart(Context context)PieChart(Context context, AttributeSet attrs)PieChart(Context context, AttributeSet attrs, int defStyle)
-
Method Summary
Modifier and Type Method Description voidcalculateOffsets()Calculates the offsets of the chart to the border depending on theposition of an eventual legend or depending on the length of the y-axisand x-axis labels and their position booleanneedsHighlight(int index)Checks if the given index is set to be highlighted. XAxisgetXAxis()This will throw an exception, PieChart has no XAxis object. intgetIndexForAngle(float angle)Returns the xIndex for the given angle around the center of the chart.Returns -1 if not found / outofbounds. intgetDataSetIndexForIndex(int xIndex)Returns the index of the DataSet this x-index belongs to. Array<float>getDrawAngles()returns an integer array of all the different angles the chart sliceshave the angles in the returned array determine how much space (of 360°)each slice takes Array<float>getAbsoluteAngles()returns the absolute angles of the different chart slices (where theslices end) voidsetHoleColor(int color)Sets the color for the hole that is drawn in the center of the PieChart(if enabled). voidsetDrawSlicesUnderHole(boolean enable)Enable or disable the visibility of the inner tips of the slices behind the hole booleanisDrawSlicesUnderHoleEnabled()Returns true if the inner tips of the slices are visible behind the hole,false if not. voidsetDrawHoleEnabled(boolean enabled)set this to true to draw the pie center empty booleanisDrawHoleEnabled()returns true if the hole in the center of the pie-chart is set to bevisible, false if not voidsetCenterText(CharSequence text)Sets the text String that is displayed in the center of the PieChart. CharSequencegetCenterText()returns the text that is drawn in the center of the pie-chart voidsetDrawCenterText(boolean enabled)set this to true to draw the text that is displayed in the center of thepie chart booleanisDrawCenterTextEnabled()returns true if drawing the center text is enabled floatgetRadius()Returns the radius of the chart in pixels. RectFgetCircleBox()returns the circlebox, the boundingbox of the pie-chart slices MPPointFgetCenterCircleBox()returns the center of the circlebox voidsetCenterTextTypeface(Typeface t)sets the typeface for the center-text paint voidsetCenterTextSize(float sizeDp)Sets the size of the center text of the PieChart in dp. voidsetCenterTextSizePixels(float sizePixels)Sets the size of the center text of the PieChart in pixels. voidsetCenterTextOffset(float x, float y)Sets the offset the center text should have from it's original position in dp. MPPointFgetCenterTextOffset()Returns the offset on the x- and y-axis the center text has in dp. voidsetCenterTextColor(int color)Sets the color of the center text of the PieChart. voidsetHoleRadius(float percent)sets the radius of the hole in the center of the piechart in percent ofthe maximum radius (max = the radius of the whole chart), default 50% floatgetHoleRadius()Returns the size of the hole radius in percent of the total radius. voidsetTransparentCircleColor(int color)Sets the color the transparent-circle should have. voidsetTransparentCircleRadius(float percent)sets the radius of the transparent circle that is drawn next to the holein the piechart in percent of the maximum radius (max = the radius of thewhole chart), default 55% -> means 5% larger than the center-hole bydefault floatgetTransparentCircleRadius()voidsetTransparentCircleAlpha(int alpha)Sets the amount of transparency the transparent circle should have 0 = fully transparent,255 = fully opaque.Default value is 100. voidsetDrawSliceText(boolean enabled)Set this to true to draw the entry labels into the pie slices (Provided by the getLabel() method of the PieEntry class).Deprecated -> use setDrawEntryLabels(...) instead. voidsetDrawEntryLabels(boolean enabled)Set this to true to draw the entry labels into the pie slices (Provided by the getLabel() method of the PieEntry class). booleanisDrawEntryLabelsEnabled()Returns true if drawing the entry labels is enabled, false if not. voidsetEntryLabelColor(int color)Sets the color the entry labels are drawn with. voidsetEntryLabelTypeface(Typeface tf)Sets a custom Typeface for the drawing of the entry labels. voidsetEntryLabelTextSize(float size)Sets the size of the entry labels in dp. voidsetDrawRoundedSlices(boolean enabled)Sets whether to draw slices in a curved fashion, only works if drawing the hole is enabledand if the slices are not drawn under the hole. booleanisDrawRoundedSlicesEnabled()Returns true if the chart is set to draw each end of a pie-slice"rounded". voidsetUsePercentValues(boolean enabled)If this is enabled, values inside the PieChart are drawn in percent andnot with their original value. booleanisUsePercentValuesEnabled()Returns true if using percentage values is enabled for the chart. voidsetCenterTextRadiusPercent(float percent)the rectangular radius of the bounding box for the center text, as a percentage of the pieholedefault 1. floatgetCenterTextRadiusPercent()the rectangular radius of the bounding box for the center text, as a percentage of the pieholedefault 1. floatgetMaxAngle()voidsetMaxAngle(float maxangle)Sets the max angle that is used for calculating the pie-circle. floatgetMinAngleForSlices()The minimum angle slices on the chart are rendered with, default is 0f. voidsetMinAngleForSlices(float minAngle)Set the angle to set minimum size for slices, you must call notifyDataSetChanged and invalidate when changing this, only works if there is enough room for allslices to have the minimum angle. StringgetAccessibilityDescription()-
Methods inherited from class com.github.mikephil.charting.charts.PieRadarChartBase
computeScroll, distanceToCenter, getAngleForPoint, getDiameter, getMaxVisibleCount, getMinOffset, getPosition, getPosition, getRawRotationAngle, getRotationAngle, getYChartMax, getYChartMin, isRotationEnabled, notifyDataSetChanged, onTouchEvent, setMinOffset, setRotationAngle, setRotationEnabled, spin -
Methods inherited from class com.github.mikephil.charting.charts.Chart
addViewportJob, animateX, animateX, animateXY, animateXY, animateXY, animateY, animateY, clear, clearAllViewportJobs, clearValues, disableScroll, dispatchPopulateAccessibilityEvent, enableScroll, getAccessibilitySummaryDescription, getAnimator, getCenter, getCenterOfView, getCenterOffsets, getChartBitmap, getContentRect, getData, getDefaultValueFormatter, getDescription, getDragDecelerationFrictionCoef, getExtraBottomOffset, getExtraLeftOffset, getExtraRightOffset, getExtraTopOffset, getHighlightByTouchPoint, getHighlighted, getHighlighter, getJobs, getLegend, getLegendRenderer, getMarker, getMarkerView, getMaxHighlightDistance, getOnChartGestureListener, getOnTouchListener, getPaint, getRenderer, getViewPortHandler, getXChartMax, getXChartMin, getXRange, getYMax, getYMin, highlightValue, highlightValue, highlightValue, highlightValue, highlightValue, highlightValue, highlightValue, highlightValue, highlightValue, highlightValue, highlightValues, isDragDecelerationEnabled, isDrawMarkerViewsEnabled, isDrawMarkersEnabled, isEmpty, isHighlightPerTapEnabled, isLogEnabled, removeViewportJob, saveToGallery, saveToGallery, saveToGallery, saveToPath, setAccessibilitySummaryDescription, setData, setDescription, setDragDecelerationEnabled, setDragDecelerationFrictionCoef, setDrawMarkerViews, setDrawMarkers, setExtraBottomOffset, setExtraLeftOffset, setExtraOffsets, setExtraRightOffset, setExtraTopOffset, setHardwareAccelerationEnabled, setHighlightPerTapEnabled, setHighlighter, setLogEnabled, setMarker, setMarkerView, setMaxHighlightDistance, setNoDataText, setNoDataTextAlignment, setNoDataTextColor, setNoDataTextTypeface, setOnChartGestureListener, setOnChartValueSelectedListener, setOnTouchListener, setPaint, setRenderer, setTouchEnabled, setUnbindEnabled, valuesToHighlight -
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, getWidth -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
PieChart
PieChart(Context context)
-
PieChart
PieChart(Context context, AttributeSet attrs)
-
PieChart
PieChart(Context context, AttributeSet attrs, int defStyle)
-
-
Method Detail
-
calculateOffsets
void calculateOffsets()
Calculates the offsets of the chart to the border depending on theposition of an eventual legend or depending on the length of the y-axisand x-axis labels and their position
-
needsHighlight
boolean needsHighlight(int index)
Checks if the given index is set to be highlighted.
-
getXAxis
@Deprecated() XAxis getXAxis()
This will throw an exception, PieChart has no XAxis object.
-
getIndexForAngle
int getIndexForAngle(float angle)
Returns the xIndex for the given angle around the center of the chart.Returns -1 if not found / outofbounds.
-
getDataSetIndexForIndex
int getDataSetIndexForIndex(int xIndex)
Returns the index of the DataSet this x-index belongs to.
-
getDrawAngles
Array<float> getDrawAngles()
returns an integer array of all the different angles the chart sliceshave the angles in the returned array determine how much space (of 360°)each slice takes
-
getAbsoluteAngles
Array<float> getAbsoluteAngles()
returns the absolute angles of the different chart slices (where theslices end)
-
setHoleColor
void setHoleColor(int color)
Sets the color for the hole that is drawn in the center of the PieChart(if enabled).
-
setDrawSlicesUnderHole
void setDrawSlicesUnderHole(boolean enable)
Enable or disable the visibility of the inner tips of the slices behind the hole
-
isDrawSlicesUnderHoleEnabled
boolean isDrawSlicesUnderHoleEnabled()
Returns true if the inner tips of the slices are visible behind the hole,false if not.
-
setDrawHoleEnabled
void setDrawHoleEnabled(boolean enabled)
set this to true to draw the pie center empty
-
isDrawHoleEnabled
boolean isDrawHoleEnabled()
returns true if the hole in the center of the pie-chart is set to bevisible, false if not
-
setCenterText
void setCenterText(CharSequence text)
Sets the text String that is displayed in the center of the PieChart.
-
getCenterText
CharSequence getCenterText()
returns the text that is drawn in the center of the pie-chart
-
setDrawCenterText
void setDrawCenterText(boolean enabled)
set this to true to draw the text that is displayed in the center of thepie chart
-
isDrawCenterTextEnabled
boolean isDrawCenterTextEnabled()
returns true if drawing the center text is enabled
-
getRadius
float getRadius()
Returns the radius of the chart in pixels.
-
getCircleBox
RectF getCircleBox()
returns the circlebox, the boundingbox of the pie-chart slices
-
getCenterCircleBox
MPPointF getCenterCircleBox()
returns the center of the circlebox
-
setCenterTextTypeface
void setCenterTextTypeface(Typeface t)
sets the typeface for the center-text paint
-
setCenterTextSize
void setCenterTextSize(float sizeDp)
Sets the size of the center text of the PieChart in dp.
-
setCenterTextSizePixels
void setCenterTextSizePixels(float sizePixels)
Sets the size of the center text of the PieChart in pixels.
-
setCenterTextOffset
void setCenterTextOffset(float x, float y)
Sets the offset the center text should have from it's original position in dp. Default x = 0, y = 0
-
getCenterTextOffset
MPPointF getCenterTextOffset()
Returns the offset on the x- and y-axis the center text has in dp.
-
setCenterTextColor
void setCenterTextColor(int color)
Sets the color of the center text of the PieChart.
-
setHoleRadius
void setHoleRadius(float percent)
sets the radius of the hole in the center of the piechart in percent ofthe maximum radius (max = the radius of the whole chart), default 50%
-
getHoleRadius
float getHoleRadius()
Returns the size of the hole radius in percent of the total radius.
-
setTransparentCircleColor
void setTransparentCircleColor(int color)
Sets the color the transparent-circle should have.
-
setTransparentCircleRadius
void setTransparentCircleRadius(float percent)
sets the radius of the transparent circle that is drawn next to the holein the piechart in percent of the maximum radius (max = the radius of thewhole chart), default 55% -> means 5% larger than the center-hole bydefault
-
getTransparentCircleRadius
float getTransparentCircleRadius()
-
setTransparentCircleAlpha
void setTransparentCircleAlpha(int alpha)
Sets the amount of transparency the transparent circle should have 0 = fully transparent,255 = fully opaque.Default value is 100.
- Parameters:
alpha- 0-255
-
setDrawSliceText
@Deprecated() void setDrawSliceText(boolean enabled)
Set this to true to draw the entry labels into the pie slices (Provided by the getLabel() method of the PieEntry class).Deprecated -> use setDrawEntryLabels(...) instead.
-
setDrawEntryLabels
void setDrawEntryLabels(boolean enabled)
Set this to true to draw the entry labels into the pie slices (Provided by the getLabel() method of the PieEntry class).
-
isDrawEntryLabelsEnabled
boolean isDrawEntryLabelsEnabled()
Returns true if drawing the entry labels is enabled, false if not.
-
setEntryLabelColor
void setEntryLabelColor(int color)
Sets the color the entry labels are drawn with.
-
setEntryLabelTypeface
void setEntryLabelTypeface(Typeface tf)
Sets a custom Typeface for the drawing of the entry labels.
-
setEntryLabelTextSize
void setEntryLabelTextSize(float size)
Sets the size of the entry labels in dp. Default: 13dp
-
setDrawRoundedSlices
void setDrawRoundedSlices(boolean enabled)
Sets whether to draw slices in a curved fashion, only works if drawing the hole is enabledand if the slices are not drawn under the hole.
- Parameters:
enabled- draw curved ends of slices
-
isDrawRoundedSlicesEnabled
boolean isDrawRoundedSlicesEnabled()
Returns true if the chart is set to draw each end of a pie-slice"rounded".
-
setUsePercentValues
void setUsePercentValues(boolean enabled)
If this is enabled, values inside the PieChart are drawn in percent andnot with their original value. Values provided for the IValueFormatter toformat are then provided in percent.
-
isUsePercentValuesEnabled
boolean isUsePercentValuesEnabled()
Returns true if using percentage values is enabled for the chart.
-
setCenterTextRadiusPercent
void setCenterTextRadiusPercent(float percent)
the rectangular radius of the bounding box for the center text, as a percentage of the pieholedefault 1.f (100%)
-
getCenterTextRadiusPercent
float getCenterTextRadiusPercent()
the rectangular radius of the bounding box for the center text, as a percentage of the pieholedefault 1.f (100%)
-
getMaxAngle
float getMaxAngle()
-
setMaxAngle
void setMaxAngle(float maxangle)
Sets the max angle that is used for calculating the pie-circle. 360f meansit's a full PieChart, 180f results in a half-pie-chart. Default: 360f
- Parameters:
maxangle- min 90, max 360
-
getMinAngleForSlices
float getMinAngleForSlices()
The minimum angle slices on the chart are rendered with, default is 0f.
-
setMinAngleForSlices
void setMinAngleForSlices(float minAngle)
Set the angle to set minimum size for slices, you must call notifyDataSetChanged and invalidate when changing this, only works if there is enough room for allslices to have the minimum angle.
- Parameters:
minAngle- minimum 0, maximum is half of setMaxAngle
-
getAccessibilityDescription
String getAccessibilityDescription()
-
-
-
-