MPAndroidChart Line Cap / End Style

If you draw a thick line in MPAndroidChart, then it looks like this

enter image description here

Is there a line join or line cap style that I can set to make the lines look like this?

enter image description here

NOTE: I do not want cubic or spline interpolation, just a nice join for thick lines

Upvotes: 4

Views: 1075

Answers (2)

M Shaban Ali
M Shaban Ali

Reputation: 357

I might be late but certainly will help others

    lineDataSet.setDrawCircles(true);
    lineDataSet.setDrawCircleHole(false);
    lineDataSet.setCircleRadius(YOUR_RADIUS);

YOUR_RADIUS here will be your radius according to line width and it will create a effect like edges are rounded.

Upvotes: 1

web dever
web dever

Reputation: 196

I haven't worked with the LineChart, but maybe you could use the circles that act as the data points to your advantage.

You might be able to get away with setting the circle color to match your line color, and then adjust the circle size to match your line size, as you said it's thicker than the default value.

In looking at the MPAndroidChart github files (the LineDataSet.java file to be specific), I'd try setCircleColors(List colors), and then setCircleRadius(float radius) to get the desired results.

Here's a link to that file as a reference; https://github.com/PhilJay/MPAndroidChart/blob/master/MPChartLib/src/com/github/mikephil/charting/data/LineDataSet.java

Upvotes: 4

Related Questions