具有以下样式的MPAndoid图表 [英] MPAndoid Chart with following styling

查看:66
本文介绍了具有以下样式的MPAndoid图表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为我的项目使用MPAndroid图表. 我要按以下方式制作LineChart的样式.基本上,我要所有4个象限以及其他样式(例如渐变色等).

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.

推荐答案

首先通过执行以下操作使其填充颜色:

First make it to fill color behind line by doing this:

dataset.setDrawFilled(true);

之后,您必须为此提供渐变,然后在drawables中将这样的xml文件制作为gradient_chart_color:

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);

这篇关于具有以下样式的MPAndoid图表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆