问题
I am using MPAndroid Chart for my project. I want to make the styling of LineChart as follows. Basically I want all 4 Quadrants and other styling like gradient colors etc.
回答1:
First make it to fill color behind line by doing this:
dataset.setDrawFilled(true);
After that you have to give gradient for that you have make an xml file like that in drawables as gradient_chart_color:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="90"
android:startColor="#FFF300"
android:endColor="#F5F094" />
</shape>
After that you have to do this :
Drawable drawable = ContextCompat.getDrawable(this, R.drawable.fade_red);
dataset.setFillDrawable(drawable);
来源:https://stackoverflow.com/questions/47052515/mpandoid-chart-with-following-styling