@@ -57,12 +57,29 @@ public void drawData(Canvas c) {
5757
5858 for (IRadarDataSet set : radarData .getDataSets ()) {
5959
60- if (set .isVisible () && set .getEntryCount () > 0 )
61- drawDataSet (c , set );
60+ if (set .isVisible () && set .getEntryCount () > 0 ) {
61+
62+ int mostEntries = 0 ;
63+
64+ for (IRadarDataSet radarSet : radarData .getDataSets ()) {
65+ if (set != radarSet && radarSet .getEntryCount () > mostEntries ) {
66+ mostEntries = radarSet .getEntryCount ();
67+ }
68+ }
69+
70+ drawDataSet (c , set , mostEntries );
71+ }
6272 }
6373 }
6474
65- protected void drawDataSet (Canvas c , IRadarDataSet dataSet ) {
75+ /**
76+ * Draws the RadarDataSet
77+ *
78+ * @param c
79+ * @param dataSet
80+ * @param mostEntries the entry count of the dataset with the most entries
81+ */
82+ protected void drawDataSet (Canvas c , IRadarDataSet dataSet , int mostEntries ) {
6683
6784 float phaseX = mAnimator .getPhaseX ();
6885 float phaseY = mAnimator .getPhaseY ();
@@ -100,7 +117,15 @@ protected void drawDataSet(Canvas c, IRadarDataSet dataSet) {
100117 surface .lineTo (p .x , p .y );
101118 }
102119
103- surface .close ();
120+ // if this is the largest set, close it
121+ if (dataSet .getEntryCount () >= mostEntries ) {
122+ surface .close ();
123+ } else {
124+
125+ // if this is not the largest set, draw a line to the center and then close it
126+ surface .lineTo (center .x , center .y );
127+ surface .close ();
128+ }
104129
105130 final Drawable drawable = dataSet .getFillDrawable ();
106131 if (drawable != null ) {
0 commit comments