Skip to content

Commit 0fdf6d5

Browse files
committed
Merge pull request #150 from driventokill/master
draw line by path to prevent thick line looks fractured
2 parents 45cdfca + 2e354e7 commit 0fdf6d5

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ && isOffContentBottom(valuePoints[j + 1]))
239239
mRenderPaint.setColor(dataSet.getColor());
240240

241241
float[] valuePoints = generateTransformedValuesLineScatter(entries);
242-
242+
Path path = new Path();
243243
for (int j = 0; j < (valuePoints.length - 2) * mPhaseX; j += 2) {
244244

245245
if (isOffContentRight(valuePoints[j]))
@@ -252,10 +252,13 @@ && isOffContentTop(valuePoints[j + 1])
252252
&& isOffContentBottom(valuePoints[j + 1]))
253253
continue;
254254

255-
mDrawCanvas.drawLine(valuePoints[j], valuePoints[j + 1],
256-
valuePoints[j + 2], valuePoints[j + 3], mRenderPaint);
255+
if (j == 0) {
256+
path.moveTo(valuePoints[j], valuePoints[j + 1]);
257+
} else {
258+
path.lineTo(valuePoints[j + 2], valuePoints[j + 3]);
259+
}
257260
}
258-
261+
mDrawCanvas.drawPath(path, mRenderPaint);
259262
// Path line = generateLinePath(entries);
260263
// transformPath(line);
261264
// mDrawCanvas.drawPath(line, mRenderPaint);

0 commit comments

Comments
 (0)