mpandroidchart

Force BarChart Y axis labels to be integers?

孤街浪徒 提交于 2019-12-03 16:07:09
问题 I've created a BarChart using MPAndroidChart and I'm entering the data dynamically. This means that I need my Y axis to also be determined dynamically. All of my data is represented as integers, however the Y axis is sometimes displaying the legend as decimal values with 1 decimal point. I've attempted to use a ValueFormatter to round the values, but the problem is that sometimes the Y values aren't at integer value locations (ex. 0.8,1.6,2.4,etc). Therefore, if I just edit these to be

MPAndroidChart RadarChart collapses itself

匿名 (未验证) 提交于 2019-12-03 08:46:08
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have some problems with RadarChart labels. Specifically, if I use long texts (e.g. 15-20 chars), and the available space is not too big, the chart gets collapsed and the labels are positioned inside the collapsed chart (but there is clearly more space available). I tried to use ValueFormatter for the label axis that truncates labels if they are longer than 5 chars, but as I see, the chart size calculaction is based on the full label text, as the chart got collapsed the same way I described before. XAxis xAxis = radarChart.getXAxis(); xAxis

Force BarChart Y axis labels to be integers?

风格不统一 提交于 2019-12-03 05:33:35
I've created a BarChart using MPAndroidChart and I'm entering the data dynamically. This means that I need my Y axis to also be determined dynamically. All of my data is represented as integers, however the Y axis is sometimes displaying the legend as decimal values with 1 decimal point. I've attempted to use a ValueFormatter to round the values, but the problem is that sometimes the Y values aren't at integer value locations (ex. 0.8,1.6,2.4,etc). Therefore, if I just edit these to be integers they won't be in the right location. Is there anyway that I can force the BarChart to only display

MPAndroidChart - Why BarData constructor not work?

匿名 (未验证) 提交于 2019-12-03 02:30:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: My code: public BarData getBarData ( String fieldName ) { ArrayList < BarEntry > entries = new ArrayList <>(); entries . add ( new BarEntry ( this . house . Population , 0 )); entries . add ( new BarEntry ( this . currentStore . Population , 1 )); ArrayList < String > labels = new ArrayList < String >(); labels . add ( "house" ); labels . add ( "store" + this . currentStore . StoreName ); List < BarDataSet > dataSets = new ArrayList <>(); dataSets . add ( new BarDataSet ( entries , fieldName )); return new BarData ( labels ,

Failed to resolve: com.github.PhilJay:MPAndroidChart:v2.1.4

匿名 (未验证) 提交于 2019-12-03 01:52:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am using MPAndroidChart libarary in android studio.But when i am trying to sync gradle which given an error as below image. Gradle text is here to compile MPAndroidChart libarary. compile 'com.github.PhilJay:MPAndroidChart:v2.1.4' Please help to resolve this problem. Thanks in advance 回答1: Add maven { url "https://jitpack.io" } to repositories under allprojects not under buildscript see screenshot: 回答2: Putting repositories { maven { url "https://jitpack.io" } } in build.gradle in app folder fixed my issue! 回答3: The problem was solved

MPAndroidChart fill color gradient

匿名 (未验证) 提交于 2019-12-03 01:03:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Is it possible with MPAndroidChart (or any other Android chart library) to fill the chart under the draw line with a gradient color? Something like this: set1.setFillColor(getResources().getColor(R.drawable.chart_fill)); then in chart_fill.xml : <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <gradient android:angle="90" android:endColor="#FF207a54" android:startColor="#FFffffff" /> </shape> 回答1: You can use the following two methods: LineRadarDataSet#setDrawFilled(boolean isFilled);

一行代码 实现 MPAndroidChart 柱状图

匿名 (未验证) 提交于 2019-12-03 00:19:01
导入 implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3' 调用 public class DayReportActivity extends AppCompatActivity { private BarChart chart1 ,chart2; @Override protected void onCreate (Bundle savedInstanceState) { super .onCreate(savedInstanceState); setContentView(R.layout.activity_day_report); initView(); } private void initView () { chart1 = findViewById(R.id.chart1); chart2 = findViewById(R.id.chart2); //x 周默认输值 可用下面的x_value代替 List<Float> x_number = new ArrayList<>(); for ( int i = 0 ; i < 10 ; i++) { x_number.add(( float )i); } //y的值 List<Float> y_value = new ArrayList<>(); y_value

MPAndroidChart 项目实战 Demo

匿名 (未验证) 提交于 2019-12-02 23:36:01
MPAndroidChartDemoByJin 项目地址: 简介:MPAndroidChart 项目实战 Demo 更多: 作者 提 Bug 标签: MPAndroidChart 常见设置属性(一)――应用层 MPAndroidChart 项目实战(一)――实现对比性柱状图 MPAndroidChart 项目实战(二)――双平滑曲线(双折线图)和 MarkView 实现 MPAndroidChart 项目实战(三)――饼状图实现和文字重合问题解决 MPAndroidChart 项目实战(四)――柱状图实现及 X 轴文字不显示问题和柱状图上显示文字 MPAndroidChart X 轴文字斜着显示 MPAndroidChart 项目实战(五)――组合图实现趋势图 MPAndroidChart 项目实战(六)――自定义 1MPAndroidChart 滑动冲突解决(搞不定产品设计师就只能搞自己) MPAndroidChart 项目实战(七)――自定义横向柱状图 MPAndroidChart 项目实战(八)――自定义分段堆积柱状图 MPAndroidChart 项目实战(九)――自定义带文字分段堆积柱状图 文章来源: https://blog.csdn.net/u014608640/article/details/90719770

Updating a chart from an ArrayList over time?

梦想与她 提交于 2019-12-02 22:20:36
问题 I have an ArrayList of values, and I would like to iterate through the ArrayList. For every new value, I would like to update the chart with that value, and then wait a set amount of time before doing the same thing to the next value. At the moment, my log says that all of the values are being iterated over. However, on my testing device, the chart does not update until the very end; at that point, all of the values are loaded at once, so there is no desired "slideshow" effect. When I want to

How to set custom color for Piechart element

坚强是说给别人听的谎言 提交于 2019-12-02 17:42:05
问题 I am using MPChart libarary in my android project. I have Json which contain label,value and color for pie chart generation. I want to set same color from json to piechart element. I followed MPChart documentation,But not found any solution for piechart color setting. 回答1: You did not find a solution in the documentation? I suggest you take a closer look. There are many other ways for setting colors for a DataSet : setColors(int [] colors, Context c) : Sets the colors that should be used fore