Android 优秀图标库MPAndroidChart之柱状图(适应百分之八十项目需求)

前言

在项目当中很多时候要对数据进行分析就要用到图表,在gitHub上有很多优秀的图表开源库,今天给大家分享的就是MPAndroidChart中的柱状图。简单介绍一下MPAndroidChart:他可以实现图表的拖动,3D,局部查看,数据动态展示等功能。

官方源码地址:github.com/PhilJay/MPA…

废话就不多说了,先给看大家看看效果图

操作步骤

第一步:需要将依赖的库添加到你的项目中

implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0-alpha'
implementation 'com.google.android.material:material:1.0.0'

第二步:xml中

   <com.github.mikephil.charting.charts.BarChart
    android:id="@+id/chart1"
    android:layout_width="match_parent"
    android:layout_height="300dp"
    />
复制代码

第三步:ValueFormatter.java

  /**
 * Class to format all values before they are drawn as labels.
 */
 public abstract class ValueFormatter implements IAxisValueFormatter, IValueFormatter {

/**
 * <b>DO NOT USE</b>, only for backwards compatibility and will be removed in future versions.
 *
 * @param value the value to be formatted
 * @param axis  the axis the value belongs to
 * @return formatted string label
 */
@Override
@Deprecated
public String getFormattedValue(float value, AxisBase axis) {
    return getFormattedValue(value);
}

/**
 * <b>DO NOT USE</b>, only for backwards compatibility and will be removed in future versions.
 * @param value           the v
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值