Deepak Sharma
Deepak Sharma

Reputation: 417

How to enable cubic lines in MPAndroidChart library?

I am using MPAndroidChart library for a project of mine to integrate charts in my app. I know how to use LineCharts but I couldn't figure out a way to use the Cubic Lines feature of the LineCharts. The image below shows the kind of graph i want, please let me know how to solve this issue. enter image description here

Upvotes: 12

Views: 7541

Answers (2)

Youssef Amine AMIMI
Youssef Amine AMIMI

Reputation: 81

Try to add set mode of LineData set, enable draw filled and set the fill color

    lineDataSet.setMode(LineDataSet.Mode.CUBIC_BEZIER)
    lineDataSet.setDrawFilled(true)
    lineDataSet.setFillColor(ContextCompat.getColor(context,R.color.green))

Upvotes: 1

DCoder
DCoder

Reputation: 246

Try using something like this

lineDataSet.setDrawCubic(true);

It worked for me, here lineDataSet is your LineDataSet instance.

Update for v3.0.0 and onwards:

lineDataSet.setMode(LineDataSet.Mode.CUBIC_BEZIER);

Upvotes: 23

Related Questions