mpandroidchart

MPAndroidChart: Creating a closed chart (circular line chart)

跟風遠走 提交于 2019-12-12 18:26:42
问题 I need to draw a "closed chart" in my Android app, like this: The xIndex of the data first increases then decreases. Like in this example: [3,3],[4,4],[5,5],[6,4],[7,3],[6,2],[5,1],[4,2],[3,3] When I try drawing a LineСhart with this data in MPAndroidChart, it only renders the first half of data (prior to the fall of the xIndex). The other data is not shown. How can I draw this data correctly with MPAndroidChart ? 回答1: The sample app on the Google Play Store gives an example of every kind of

Set Specific Color to the Region Occupied by LineChart

为君一笑 提交于 2019-12-12 17:26:07
问题 I am able to plot Marks Dynamically and set Different Color to the LineChart.Now i am having issue of, not able to fill the Color in the Region where the LineChart occupies.I have used setS.setDrawFilled(true); but it Fill with only one Color.How can this issue be Solved? int getColorRandom() { Random rand = new Random(); int r = rand.nextInt(255); int g = rand.nextInt(255); int b = rand.nextInt(255); int randomColor = Color.rgb(r, g, b); return randomColor; } ArrayList<ILineDataSet>

MpAndroidChart Piechart legends cutting issue at the bottom center

為{幸葍}努か 提交于 2019-12-12 15:57:06
问题 I have attached the screenshot of my usage chart. In red box display the legends and they are cutting in pie chart. Below is my code: pieChart.setUsePercentValues(false); pieChart.getDescription().setEnabled(false); pieChart.setDragDecelerationFrictionCoef(0.95f); pieChart.setDrawHoleEnabled(true); pieChart.setHoleColor(Color.WHITE); pieChart.setTransparentCircleColor(Color.WHITE); pieChart.setTransparentCircleAlpha(110); pieChart.setHoleRadius(55f); pieChart.setTransparentCircleRadius(57f);

How to set colors in MPAndroidChart?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-12 08:26:31
问题 I'm using MPChartlib for a basic "Barchart" (3 bars and values between 0 and 100). the background of the app is dark so I'd like to put the text in white but when I set the text with color code "FFFFFF" in chart_color stored in string.xml but the text appear in dark blue. //Axe X XAxis x = barchart.getXAxis(); x.setPosition(XAxisPosition.BOTTOM); x.setTextColor(R.color.chart_color); x.setAxisLineColor(R.color.chart_color); // Design barchart.setDragEnabled(false); barchart

Getting duplicate values at xAxis MPChart

℡╲_俬逩灬. 提交于 2019-12-12 07:17:37
问题 Right Now I am facing this issue. I am getting repeated values in xAxis the first one and the last one.And graph values are not according to the values at respective x-axis values. and the second issue is if I want to display the values not in float but in int Rounded and change the their color to white. ArrayList<String> xlabels = new ArrayList<String>(); xlabels.add("Jan"); xlabels.add("Feb"); xlabels.add("Mar"); xlabels.add("Apr"); xlabels.add("May"); xlabels.add("Jun"); ArrayList<String>

Passing dataset between activity in MPAndroidChart

女生的网名这么多〃 提交于 2019-12-12 06:49:51
问题 I want to display barchart in full screen after clicking on a button but I got an error when passing BarEntry class between activities. android.os.ParcelFormatException: Cannot parcel an Entry with non-parcelable data my code : ArrayList<BarEntry> barEntries = new ArrayList<>(); barEntries.clear(); barEntries.add(new BarEntry(0, new float[]{8f, 9f, 10f}, "Jan")); barEntries.add(new BarEntry(1, new float[]{11f, 9f, 5f}, "Feb")); barEntries.add(new BarEntry(2, new float[]{8f, 3f, 4f}, "Mar"));

How do i add X-axis lables in Mpcharts for barcharts

喜欢而已 提交于 2019-12-12 04:19:30
问题 I was using an older version of MPCharts and in that it was working fine,but in 3.0.2,it seems to be a bit diferent,their wiki page isn't helping much. this is what i have ArrayList<BarEntry> entries = new ArrayList(); entries.add(new BarEntry(0,125f)); entries.add(new BarEntry(1,233f)); entries.add(new BarEntry(2,318f)); entries.add(new BarEntry(3,12f)); entries.add(new BarEntry(4,92f)); entries.add(new BarEntry(5,72f)); entries.add(new BarEntry(6,11f)); entries.add(new BarEntry(7,456f));

MPAndroidChart Entry cannot be cast to BarEntry

我只是一个虾纸丫 提交于 2019-12-12 03:27:51
问题 I want to create a BarChart using MPAndroidChart but I get the following error java.lang.ClassCastException: com.github.mikephil.charting.data.Entry cannot be cast to com.github.mikephil.charting.data.BarEntry I first get the data from a different activity and use that. First activity: ArrayList<BarEntry> temperature = new ArrayList<>(); for (int i = 0; i < temp.length(); i++) { float temp_data = Float.parseFloat(temp.getJSONObject(i).getString("value")); float humid_data = Float.parseFloat

NegativeArraySizeException adding Scatter Data to a CombinedChart

大憨熊 提交于 2019-12-12 03:18:40
问题 I use MPAndriodChart and I want to combine multiple ScatterDataSet with one LineDataSet CombinedChart chart = (CombinedChart) findViewById(R.id.chart); CombinedData chartData = new CombinedData(); ScatterData scatterData = data.getScatterData(); chartData.setData(scatterData); chartData.setData(data.getLineData()); chart.setData(chartData); chart.invalidate(); The Line just works fine but on the ScatterData I get a NegativeArraySizeException: java.lang.NegativeArraySizeException: -10 at com

Show different datasets with an MPAndroidChart pie chart

淺唱寂寞╮ 提交于 2019-12-12 03:08:59
问题 In my application I want to display some data on a pie chart. I'm using the MPAndroidChart library and following the documentation I managed to program a nice looking chart with all my data correctly displayed. Now, I'd like to improve my chart, but I'm having some trouble. My data refers to a single day, but there are two categories: incomes and revenues. Until now I've handled them as a single PieDataSet (they have labels, so it is quite easy to distinguish among them). Now I'd like to