Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to solve draw gradient below line - PhilJay/MPAndroidChart/issues/104?

github link

I would like a gradient and, if possible, choose components colors and orientation.

is this issues solved?

enter image description here

like image 206
A.G.THAMAYS Avatar asked Aug 05 '16 11:08

A.G.THAMAYS


1 Answers

i found it's answer

LineDataSet set1 = new LineDataSet(values, "DataSet 1");
Drawable drawable = ContextCompat.getDrawable(this, R.drawable.fade_red);
set1.setFillDrawable(drawable);

fade_red.xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
    android:angle="90"
    android:startColor="#00ffffff"
    android:endColor="#6a64c7ff" />
</shape>

but fill drawable only supported on api level 18 and above

if (Utils.getSDKInt() >= 18) {
   // fill drawable only supported on api level 18 and above
   Drawable drawable = ContextCompat.getDrawable(this, R.drawable.fade_red);
   set1.setFillDrawable(drawable);
} else {
      set1.setFillColor(Color.BLACK);
}

reference MPAndroidChart - link

like image 106
A.G.THAMAYS Avatar answered Sep 19 '22 19:09

A.G.THAMAYS