mpandroidchart

How to set String value of date time on xAxis BarChart MPAndroidChart

霸气de小男生 提交于 2020-05-24 05:31:33
问题 I'm trying to show date time on X-Axis for my bar chart. I got this data from my UNIX timestamp firebase database. I have been trying to convert this UNIX timestamp to a human-readable date and then show this on my Axis. From what I know, BarEntry constructor doesn't support data type like String. So, I should use xAxis.setValueFormatter() to show the date. I have tried to use a formatter but it seems wrong like overlaps chart and the X-Axis showing incorrect results. Here is my formatter:

MPAndroidChart: how to change the alignment of Y axis labels

坚强是说给别人听的谎言 提交于 2020-04-17 22:14:33
问题 I'm trying to align the labels of the left axis to the left side(by default they are aligned to the right). The first image shows the desired result(with labels aligned to left) and the second one - the actual result(labels aligned to right) So, is there a way to change the alignment of Y-axis labels with MPAndroidChart? 来源: https://stackoverflow.com/questions/60654471/mpandroidchart-how-to-change-the-alignment-of-y-axis-labels

MPAndroidChart: how to change the alignment of Y axis labels

久未见 提交于 2020-04-17 22:13:10
问题 I'm trying to align the labels of the left axis to the left side(by default they are aligned to the right). The first image shows the desired result(with labels aligned to left) and the second one - the actual result(labels aligned to right) So, is there a way to change the alignment of Y-axis labels with MPAndroidChart? 来源: https://stackoverflow.com/questions/60654471/mpandroidchart-how-to-change-the-alignment-of-y-axis-labels

How to refresh android mpchart graph without refreshing whole activity

邮差的信 提交于 2020-04-07 10:34:38
问题 Hello i am using android MPAndroidChart library in my project. I want to refresh chart without refreshing activity page. Thanks in advance. 回答1: Where ever upon button click or spinner selection you need to update your graph just call a method: chartView.notifyDataSetChanged(); chartView.invalidate(); 来源: https://stackoverflow.com/questions/47303952/how-to-refresh-android-mpchart-graph-without-refreshing-whole-activity

How to refresh android mpchart graph without refreshing whole activity

穿精又带淫゛_ 提交于 2020-04-07 10:34:34
问题 Hello i am using android MPAndroidChart library in my project. I want to refresh chart without refreshing activity page. Thanks in advance. 回答1: Where ever upon button click or spinner selection you need to update your graph just call a method: chartView.notifyDataSetChanged(); chartView.invalidate(); 来源: https://stackoverflow.com/questions/47303952/how-to-refresh-android-mpchart-graph-without-refreshing-whole-activity

How to set margin/padding for x-axis values in MPAndroidChart?

和自甴很熟 提交于 2020-03-21 20:21:34
问题 I built a graph using MPAndroidChart, but there is a problem - values on x-axis overlap. Is there a way to fix it? Something like a margin between x-axis values? 回答1: It's been a while since you've posted your question and probably by now you found your way around this problem, however, I'm posting this answer for anyone else who has faced this issue. Setting chart.getXAxis().setSpaceMin(0.5f); would add space between the X-axis line and the chart itself. you can also use chart.getXAxis()

How to set margin/padding for x-axis values in MPAndroidChart?

。_饼干妹妹 提交于 2020-03-21 20:21:25
问题 I built a graph using MPAndroidChart, but there is a problem - values on x-axis overlap. Is there a way to fix it? Something like a margin between x-axis values? 回答1: It's been a while since you've posted your question and probably by now you found your way around this problem, however, I'm posting this answer for anyone else who has faced this issue. Setting chart.getXAxis().setSpaceMin(0.5f); would add space between the X-axis line and the chart itself. you can also use chart.getXAxis()

MPAndroidChart的详细使用——ViewPortHandler(视图控制器)

烈酒焚心 提交于 2020-03-12 13:59:23
这个ViewPortHandler类负责处理图表的视图端口。这意味着它负责图表视图中可见的内容,它在平移和缩放级别、图表的大小以及绘图区域和当前偏移量方面都是当前状态。这个ViewPortHandler允许直接访问上述所有属性并修改它们。 上一篇: MPAndroidChart的详细使用——DataSet类以及DataSet子类 下一篇: MPAndroidChart的详细使用——FillFormat接口 建议:这方面的设置最好是有一定水平且熟悉API的人来进行操作,否则可能会出现很多意外错误。 获取对象 ViewPortHandler handler = chart.getViewPortHandler ( ) ; 缩放和平移 getScaleX() 返回x轴上的当前缩放级别。 getScaleY() 返回y轴上的当前缩放级别。 getTransX() 返回X轴上的平移距离 。 getTransY() 返回Y轴上的平移距离。 图表尺寸和内容 getChartWidth() 返回图表的宽度。 getChartHeight() 返回图表的高度。 getContentRect() 返回图表当前的RectF对象. Tip:更多方法可在 官方JavaDocs 或者通过研究API获取。 来源: CSDN 作者: Android_YU 链接: https://blog.csdn.net/qq

MPAndroidChart简单使用

六眼飞鱼酱① 提交于 2020-03-01 09:47:38
所有演示都采用 MPAndroidChart v3.1.0 官方地址: https://github.com/PhilJay/MPAndroidChart 首先要感谢作者写出这么强大的图表控件让我们免费使用,如果您条件匀许可以a coffee (or some beer) for him。 工作中,经常会用到图表控件,以直观的方式来给用户感性的认识,可以是门店销量比对,可以是门店的日月报表,也可以是会员消费的排行等等。 工欲善其事,必先利其器。 好的工具,不会用,也是枉然。 然而,好的东西肯定有它一定的使用方法,如何简单的使用,那就需要有人尝试,有人研究。 然后结果证明,使用往往是简单的,但是不了解的时候,会花费大量的时间与精力,到最好可能也就是一行代码的事。 这也是我来写这个的初衷吧。 这里我来讲一下我们在工作中实际业务中,是如何来处理这个报表控件的。 1、先来了解下它 以上的截图是官方提供的例子,这个很重要,因为他给我们提供了很大的帮助,好多都可以直接搬过来用,不需要再去看文档。 其中包括: Line Charts折线图 Bar Charts柱状图 Pie Charts饼图 Other Charts其它…… 1)如何打开这个例子: 我使用的是 Android Studio 3.5.3 , 前段时间刚刚升级,其实如果是维护产品的话,升级不升级,还要看情况。 有个前提

概述

落爺英雄遲暮 提交于 2020-02-27 13:50:38
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-qpipmRHd-1582779511035)(https://camo.githubusercontent.com/b4854180e5d01005bf22e7f97b0ca4b9d514c03a/68747470733a2f2f7261772e6769746875622e636f6d2f5068696c4a61792f4d5043686172742f6d61737465722f64657369676e2f666561747572655f677261706869632e706e67)] MPAndroidChart [外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-kGqOc7mg-1582779511036)(https://assets-cdn.github.com/images/icons/emoji/unicode/26a1.png)] 是一个功能强大且易于使用的Android图表库。支持 API 8 及以上。 作为附加的功能,这个库允许在Android和iOS上进行跨平台开发,这个库的iOS版本已经实现: Charts [外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-Qqufr9W7-1582779511037)(https:/