Skip to content

Commit bfcfafe

Browse files
committed
merge master
2 parents c6e6499 + dd9aa1a commit bfcfafe

File tree

9 files changed

+22
-27
lines changed

9 files changed

+22
-27
lines changed

MPChartLib/src/com/github/mikephil/charting/charts/BarChart.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ protected void calcMinMax() {
9090
@Override
9191
public Highlight getHighlightByTouchPoint(float x, float y) {
9292

93-
if (mDataNotSet || mData == null) {
93+
if (mData == null) {
9494
Log.e(LOG_TAG, "Can't select by touch. No data set.");
9595
return null;
9696
} else

MPChartLib/src/com/github/mikephil/charting/charts/BarLineChartBase.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ protected void init() {
188188
protected void onDraw(Canvas canvas) {
189189
super.onDraw(canvas);
190190

191-
if (mDataNotSet)
191+
if (mData == null)
192192
return;
193193

194194
long starttime = System.currentTimeMillis();
@@ -315,7 +315,7 @@ protected void prepareOffsetMatrix() {
315315
@Override
316316
public void notifyDataSetChanged() {
317317

318-
if (mDataNotSet) {
318+
if (mData == null) {
319319
if (mLogEnabled)
320320
Log.i(LOG_TAG, "Preparing... DATA NOT SET.");
321321
return;
@@ -653,7 +653,7 @@ public Transformer getTransformer(AxisDependency which) {
653653
public boolean onTouchEvent(MotionEvent event) {
654654
super.onTouchEvent(event);
655655

656-
if (mChartTouchListener == null || mDataNotSet)
656+
if (mChartTouchListener == null || mData == null)
657657
return false;
658658

659659
// check if touch gestures are enabled
@@ -1154,7 +1154,7 @@ public void setMinOffset(float minOffset) {
11541154
*/
11551155
public Highlight getHighlightByTouchPoint(float x, float y) {
11561156

1157-
if (mDataNotSet || mData == null) {
1157+
if (mData == null) {
11581158
Log.e(LOG_TAG, "Can't select by touch. No data set.");
11591159
return null;
11601160
} else

MPChartLib/src/com/github/mikephil/charting/charts/Chart.java

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,6 @@ public abstract class Chart<T extends ChartData<? extends IDataSet<? extends Ent
116116
*/
117117
protected String mDescription = "Description";
118118

119-
/**
120-
* flag that indicates if the chart has been fed with data yet
121-
*/
122-
protected boolean mDataNotSet = true;
123-
124119
/**
125120
* the number of x-values the chart displays
126121
*/
@@ -309,7 +304,6 @@ public void setData(T data) {
309304
}
310305

311306
// LET THE CHART KNOW THERE IS DATA
312-
mDataNotSet = false;
313307
mOffsetsCalculated = false;
314308
mData = data;
315309

@@ -334,7 +328,6 @@ public void setData(T data) {
334328
*/
335329
public void clear() {
336330
mData = null;
337-
mDataNotSet = true;
338331
mIndicesToHighlight = null;
339332
invalidate();
340333
}
@@ -420,11 +413,7 @@ protected void calculateFormatter(float min, float max) {
420413
protected void onDraw(Canvas canvas) {
421414
// super.onDraw(canvas);
422415

423-
if (mDataNotSet || mData == null || mData.getYValCount() <= 0) { // check
424-
// if
425-
// there
426-
// is
427-
// data
416+
if (mData == null) {
428417

429418
// if no data, inform the user
430419
canvas.drawText(mNoDataText, getWidth() / 2, getHeight() / 2, mInfoPaint);

MPChartLib/src/com/github/mikephil/charting/charts/HorizontalBarChart.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ public PointF getPosition(Entry e, AxisDependency axis) {
220220
@Override
221221
public Highlight getHighlightByTouchPoint(float x, float y) {
222222

223-
if (mDataNotSet || mData == null) {
223+
if (mData == null) {
224224
Log.e(LOG_TAG, "Can't select by touch. No data set.");
225225
return null;
226226
} else

MPChartLib/src/com/github/mikephil/charting/charts/PieChart.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ protected void init() {
112112
protected void onDraw(Canvas canvas) {
113113
super.onDraw(canvas);
114114

115-
if (mDataNotSet)
115+
if (mData == null)
116116
return;
117117

118118
mRenderer.drawData(canvas);
@@ -136,7 +136,7 @@ public void calculateOffsets() {
136136
super.calculateOffsets();
137137

138138
// prevent nullpointer when no data set
139-
if (mDataNotSet)
139+
if (mData == null)
140140
return;
141141

142142
float diameter = getDiameter();

MPChartLib/src/com/github/mikephil/charting/charts/PieRadarChartBase.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public void computeScroll() {
8787

8888
@Override
8989
public void notifyDataSetChanged() {
90-
if (mDataNotSet)
90+
if (mData == null)
9191
return;
9292

9393
calcMinMax();

MPChartLib/src/com/github/mikephil/charting/charts/RadarChart.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ protected float[] getMarkerPosition(Entry e, Highlight highlight) {
161161

162162
@Override
163163
public void notifyDataSetChanged() {
164-
if (mDataNotSet)
164+
if (mData == null)
165165
return;
166166

167167
calcMinMax();
@@ -183,7 +183,7 @@ public void notifyDataSetChanged() {
183183
protected void onDraw(Canvas canvas) {
184184
super.onDraw(canvas);
185185

186-
if (mDataNotSet)
186+
if (mData == null)
187187
return;
188188

189189
mXAxisRenderer.renderAxisLabels(canvas);

MPChartLib/src/com/github/mikephil/charting/data/DataSet.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,11 @@ public void calcMinMax(int start, int end) {
8989
}
9090
}
9191

92-
@Override
92+
/**
93+
* returns the number of y-values this DataSet represents
94+
*
95+
* @return
96+
*/
9397
public int getEntryCount() {
9498
return mYVals.size();
9599
}

MPChartLib/src/com/github/mikephil/charting/renderer/PieChartRenderer.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -309,8 +309,10 @@ protected void drawCenterText(Canvas c) {
309309

310310
float radiusPercent = mChart.getCenterTextRadiusPercent();
311311
if (radiusPercent > 0.0) {
312-
boundingRect.inset((boundingRect.width() - boundingRect.width() * radiusPercent) / 2.f,
313-
(boundingRect.height() - boundingRect.height() * radiusPercent) / 2.f);
312+
boundingRect.inset(
313+
(boundingRect.width() - boundingRect.width() * (radiusPercent / 100.f)) / 2.f,
314+
(boundingRect.height() - boundingRect.height() * (radiusPercent / 100.f)) / 2.f
315+
);
314316
}
315317

316318
if (!centerText.equals(mCenterTextLastValue) || !boundingRect.equals(mCenterTextLastBounds)) {
@@ -408,7 +410,7 @@ public void drawHighlighted(Canvas c, Highlight[] indices) {
408410
else
409411
angle = rotationAngle + absoluteAngles[xIndex - 1];
410412

411-
angle *= mAnimator.getPhaseY();
413+
angle *= mAnimator.getPhaseX();
412414

413415
float sliceDegrees = drawAngles[xIndex];
414416

0 commit comments

Comments
 (0)