MPAndoid Chart with following styling

馋奶兔 提交于 2019-12-22 20:28:13

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!