Skip to content

Commit 5fcdda2

Browse files
committed
Fixed issue concerning static Resources reference (issue PhilJay#145).
2 parents e2413a4 + 0fdf6d5 commit 5fcdda2

File tree

1 file changed

+25
-21
lines changed

1 file changed

+25
-21
lines changed

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

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -238,27 +238,10 @@ && isOffContentBottom(valuePoints[j + 1]))
238238

239239
mRenderPaint.setColor(dataSet.getColor());
240240

241-
float[] valuePoints = generateTransformedValuesLineScatter(entries);
242-
243-
for (int j = 0; j < (valuePoints.length - 2) * mPhaseX; j += 2) {
244-
245-
if (isOffContentRight(valuePoints[j]))
246-
break;
247-
248-
// make sure the lines don't do shitty things outside
249-
// bounds
250-
if (j != 0 && isOffContentLeft(valuePoints[j - 1])
251-
&& isOffContentTop(valuePoints[j + 1])
252-
&& isOffContentBottom(valuePoints[j + 1]))
253-
continue;
254-
255-
mDrawCanvas.drawLine(valuePoints[j], valuePoints[j + 1],
256-
valuePoints[j + 2], valuePoints[j + 3], mRenderPaint);
257-
}
258-
259-
// Path line = generateLinePath(entries);
260-
// transformPath(line);
261-
// mDrawCanvas.drawPath(line, mRenderPaint);
241+
Path line = generateLinePath(entries);
242+
transformPath(line);
243+
244+
mDrawCanvas.drawPath(line, mRenderPaint);
262245
}
263246

264247
mRenderPaint.setPathEffect(null);
@@ -320,6 +303,27 @@ private Path generateFilledPath(ArrayList<Entry> entries, float fillMin) {
320303

321304
return filled;
322305
}
306+
307+
/**
308+
* Generates the path that is used for drawing a single line.
309+
*
310+
* @param entries
311+
* @return
312+
*/
313+
private Path generateLinePath(ArrayList<Entry> entries) {
314+
315+
Path line = new Path();
316+
line.moveTo(entries.get(0).getXIndex(), entries.get(0).getVal() * mPhaseY);
317+
318+
// create a new path
319+
for (int x = 1; x < entries.size() * mPhaseX; x++) {
320+
321+
Entry e = entries.get(x);
322+
line.lineTo(e.getXIndex(), e.getVal() * mPhaseY);
323+
}
324+
325+
return line;
326+
}
323327

324328
@Override
325329
protected void drawValues() {

0 commit comments

Comments
 (0)