mpandroidchart

MPAndroidChart set center vertical line

会有一股神秘感。 提交于 2019-12-23 07:20:13
问题 I want to set a vertical line in center of LineChart like this: When scrolling to each point, it can notify to change the date below (the orange date field). And it can move left or right programmatically by click on arrow button. Currently, I can set viewport and allow moving to center with this code: LineData data = new LineData(xVals, dataSets); mChart.setScaleMinima((float) data.getXValCount() / 7f, 1f); mChart.moveViewTo(0, 7, YAxis.AxisDependency.LEFT); And get the result: How can I

MPAndroidChart Pie Chart is not generated with only one value?

旧街凉风 提交于 2019-12-23 05:36:13
问题 I'm working with the PieChart of the MPAndroidChart library. I'm trying to generate the chart with data from my SQLite database but I have a problem. If my data have only one value, the chart is not generated, like in the image: See that the colors not appear. The only thing that appear is the ValueText and the Legend in red circles. However, if my data have more than one value, the chart is generated successfully, like in the image: With two data values the chart is generated. This is my

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

Adding Axis Titles to mpandroidchart

强颜欢笑 提交于 2019-12-22 06:40:27
问题 I am trying to add axis titles to the bar chart created using mpandroid chart library. I am using more than one fragments in my activity and the bar chart is a fragment. I am adding data dynamically and everything is working fine. I want to add titles to x and y axis and when I searched I found that it is not supported by the library. They suggest we add the textview in chart or edit the library. I know this issue is same as this post but they don't have the answer. How to add String Label to

MPAndroidChart RadarChart collapses itself

喜夏-厌秋 提交于 2019-12-22 05:09:30
问题 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

MpChart Draw icons as labels in Xaxis of bar chart

旧城冷巷雨未停 提交于 2019-12-21 05:25:06
问题 Hi I would like to draw icons in xaxis of the bar chart instead of values. Like the chart below 回答1: you have to create your own custom renderer and apply it to your chart. Here's a rough implementation. XML <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/activity_main" android:layout_width="match_parent" android:layout_height="250dp" android:paddingBottom="@dimen

MPAndroidChart Bar chart start from non zero Y or Column Range chart

随声附和 提交于 2019-12-20 07:26:36
问题 I am using MPAndroidChart for drawing a Combined graph (with a bar chart and line chart). I want to display a "Column Range Chart" - a bar chart whose starting point will be variable for each entries, as shown in the below image, How is it possible to achieve this using MPAndroidChart. 回答1: Try with CandleStickChart . It's main purpose it to show financial data. Your problem might be with highest/lowest (shadow) open or closing values, it might require to play with them to achieve what you

Setting the pie slice colors in MPAndroidChart

人盡茶涼 提交于 2019-12-19 19:28:32
问题 I need to define specific hex values for each slice in my pie chart. I'm following the wiki but the method doesn't seem to be working for PieDataSet PieDataSet dataSet = new PieDataSet(entries, "Fuel"); dataSet.setColors(new int[] { R.color.green1, R.color.green2, R.color.green3, R.color.green4 }, Context); These errors are shown: Cannot resolve symbol 'green1' Expression expected <-- At the 'Context' Is there an alternate way to set the pie slice color? This seems to work for Line charts but

Android Stacked Bars Chart

眉间皱痕 提交于 2019-12-19 17:44:21
问题 I'm using the MPAndroidChart library, trying to customize the Stacked Bars. The objective is to display the differences between 2 currencies. So suppose this example for January. Currency #1 = 8; Currency #2 = 12 The idea is to show in the same bar both values, but instead of sum the 2 values ( 8 + 12) to have the value 8 "in front" and the value 12 "behind". So the total high of the bar is the max value. I tried to do that, extending the BarEntry class, and instead of calculate the sum, just

MPAndroid Group bar chart is not showing [duplicate]

≯℡__Kan透↙ 提交于 2019-12-19 13:48:26
问题 This question already has answers here : How to check if activity is in foreground or in visible background? (22 answers) Closed 2 years ago . Here is the code i used for group bar_chart using MPAndroid library version 3. I've tried group bar chart in lower version and it works fine but the BarData constructor is changed in latest version. And this code doesn't works. There is no crashes and error logs, still graph is loading and no data shows in it. Help me to find ma flaws List<BarEntry>