Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Drawing a cubic line chart using MPAndroid chart

I was trying to draw a cubic line graph such as this:

enter image description here

using the MPAndroid chart library.

I am able to draw the line but not the fill between the X Axis and the line as shown in the picture.
Have gone through library and many SO questions.

like image 661
Yash Ladia Avatar asked Dec 09 '15 14:12

Yash Ladia


Video Answer


1 Answers

I think you need this:

LineDataSet dataset = new LineDataSet(vals, null);

dataset.setDrawFilled(true); 

setDrawFilled(boolean filled)

Set to true if the DataSet should be drawn filled (surface), and not just as a line, disabling this will give great performance boost! default: false

You can also control the transparency:

setFillAlpha(int alpha)

sets the alpha value (transparency) that is used for filling the line surface (0-255), default: 85

And color:

setFillColor(int color)

sets the color that is used for filling the line surface

like image 109
Lidenbrock Avatar answered Sep 20 '22 14:09

Lidenbrock