File tree Expand file tree Collapse file tree 6 files changed +193
-119
lines changed
java/com/xxmassdeveloper/mpchartexample
MPChartLib/src/main/java/com/github/mikephil/charting Expand file tree Collapse file tree 6 files changed +193
-119
lines changed Original file line number Diff line number Diff line change @@ -210,6 +210,18 @@ public boolean onOptionsItemSelected(MenuItem item) {
210210 chart .invalidate ();
211211 break ;
212212 }
213+ case R .id .actionToggleCurvedSlices : {
214+ boolean toSet = !chart .isDrawRoundedSlicesEnabled () || !chart .isDrawHoleEnabled ();
215+ chart .setDrawRoundedSlices (toSet );
216+ if (toSet && !chart .isDrawHoleEnabled ()) {
217+ chart .setDrawHoleEnabled (true );
218+ }
219+ if (toSet && chart .isDrawSlicesUnderHoleEnabled ()) {
220+ chart .setDrawSlicesUnderHole (false );
221+ }
222+ chart .invalidate ();
223+ break ;
224+ }
213225 case R .id .actionDrawCenter : {
214226 if (chart .isDrawCenterTextEnabled ())
215227 chart .setDrawCenterText (false );
Original file line number Diff line number Diff line change @@ -205,6 +205,18 @@ public boolean onOptionsItemSelected(MenuItem item) {
205205 chart .invalidate ();
206206 break ;
207207 }
208+ case R .id .actionToggleCurvedSlices : {
209+ boolean toSet = !chart .isDrawRoundedSlicesEnabled () || !chart .isDrawHoleEnabled ();
210+ chart .setDrawRoundedSlices (toSet );
211+ if (toSet && !chart .isDrawHoleEnabled ()) {
212+ chart .setDrawHoleEnabled (true );
213+ }
214+ if (toSet && chart .isDrawSlicesUnderHoleEnabled ()) {
215+ chart .setDrawSlicesUnderHole (false );
216+ }
217+ chart .invalidate ();
218+ break ;
219+ }
208220 case R .id .actionDrawCenter : {
209221 if (chart .isDrawCenterTextEnabled ())
210222 chart .setDrawCenterText (false );
Original file line number Diff line number Diff line change 2525 android : id =" @+id/actionToggleHole"
2626 android : title =" @string/actionToggleHole" >
2727 </item >
28+ <item
29+ android : id =" @+id/actionToggleCurvedSlices"
30+ android : title =" @string/actionToggleCurvedSlices" >
31+ </item >
2832 <item
2933 android : id =" @+id/actionDrawCenter"
3034 android : title =" @string/actionDrawCenterText" >
Original file line number Diff line number Diff line change 4141
4242 <string name =" actionTogglePercent" >Toggle Percent</string >
4343 <string name =" actionToggleHole" >Toggle Hole</string >
44+ <string name =" actionToggleCurvedSlices" >Toggle Curved Slices</string >
4445 <string name =" actionDrawCenterText" >Draw Center Text</string >
4546 <string name =" actionToggleHighlightCircle" >Toggle Highlight Circle</string >
4647 <string name =" actionToggleRotation" >Toggle Rotation</string >
Original file line number Diff line number Diff line change @@ -650,6 +650,16 @@ public void setEntryLabelTextSize(float size) {
650650 ((PieChartRenderer ) mRenderer ).getPaintEntryLabels ().setTextSize (Utils .convertDpToPixel (size ));
651651 }
652652
653+ /**
654+ * Sets whether to draw slices in a curved fashion, only works if drawing the hole is enabled
655+ * and if the slices are not drawn under the hole.
656+ *
657+ * @param enabled draw curved ends of slices
658+ */
659+ public void setDrawRoundedSlices (boolean enabled ) {
660+ mDrawRoundedSlices = enabled ;
661+ }
662+
653663 /**
654664 * Returns true if the chart is set to draw each end of a pie-slice
655665 * "rounded".
You can’t perform that action at this time.
0 commit comments