mpandroidchart

java.lang.RuntimeException: Parcelable encountered IOException writing serializable object in Android passing ArrayList object

倾然丶 夕夏残阳落幕 提交于 2019-11-30 18:40:13
I want to pass my ArrayList object to another activity, using a DataWrapper that implements Serializable . I followed the answer provided here: Pass arraylist of user defined objects to Intent android . I am starting the another Activity from MPAndroidChart library PieChart 's OnChartGestureListener() . This is how I passed my ArrayList object threadList : mChart.setOnChartGestureListener(new OnChartGestureListener() { @Override public void onChartSingleTapped(MotionEvent me) { Intent intent = new Intent(MainActivity.this, TextersSmsActivity.class); intent.putExtra("threadList", new

How can I draw a circle on highlight point in line chart?

 ̄綄美尐妖づ 提交于 2019-11-30 17:40:39
问题 I'm using mpchart to draw my charts.I wanted to increase the circle size of intersection point of highlighter and line dataset. How can I achieve this? I read somewhere that we can add another dataset with highlighted point and increase its circle size. Is that really a good approach if my highlighter will be dragged back and forth and I'll have to update the new dataset very frequently? 回答1: When using the MpChart Library, the library contains a MarkerView class that helps us to insert the

MPAndroidChart - Legend labels are being cut off

主宰稳场 提交于 2019-11-30 13:42:39
问题 I am using MPAndroidChart library. Anybody has this problem? When I put the labels in BOTTOM position, these are cut. Thank you 回答1: They are cut because your text is too long and the library does not support "wrapping" of the labels to a new line. You will either have to shorten your legend labels or implement the desired functionality yourself. UPDATE: Word wrapping for the Legend is now supported. chart.getLegend().setWordWrapEnabled(true); 回答2: This seems to be a new feature since June

MPAndroidChart fill color gradient

白昼怎懂夜的黑 提交于 2019-11-30 09:27: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> You can use the following two methods: LineRadarDataSet#setDrawFilled(boolean isFilled); LineRadarDataSet#setFillDrawable(Drawable d); Here's a link to the

MPAndroidChart - Legend labels are being cut off

故事扮演 提交于 2019-11-30 08:15:07
I am using MPAndroidChart library . Anybody has this problem? When I put the labels in BOTTOM position, these are cut. Thank you They are cut because your text is too long and the library does not support "wrapping" of the labels to a new line. You will either have to shorten your legend labels or implement the desired functionality yourself. UPDATE: Word wrapping for the Legend is now supported. chart.getLegend().setWordWrapEnabled(true); Aksel Willgert This seems to be a new feature since June (2015): chart.getLegend().setWordWrapEnabled(true); Javadoc: /** * Should the legend word wrap? /

How to remove description from chart in MPAndroidChart?

和自甴很熟 提交于 2019-11-30 07:02:56
问题 I am using MPAndroidChart. How can I remove the description from PieChart ? I can remove the Legend with chart.setDrawLegend(false) , but I couldn't find anything regarding the chart description in the documentation. 回答1: Do you mean the description which is in the bottom right corner (default) of the Chart ? If so, simply call: chart.getDescription().setEnabled(false); Or did you mean the textual description inside the pie-slices? pieChart.setDrawSliceText(false); Or did you mean the actual

How to create a BarChart with grouped bars with MPAndroidChart?

…衆ロ難τιáo~ 提交于 2019-11-30 06:30:25
How can i compare two set of data using BarChart of MPAndroidChart . It should look like this image below: I edited a code, I get from a sample project in github. how can I put together 100f and 110f value in one Xaxis label Whole Number Score score1 = new Score(100f, 0, "Whole Number"); mRealm.copyToRealm(score1); Score score2 = new Score(110f, 0, "Whole Number"); mRealm.copyToRealm(score2); Yes, that can be done quite easily. What you need is a BarChart with multiple BarDataSets where each set (in your case) represents one sex (men or women). Here is an example of how to create a BarChart

How to change dot colors if value is higher than constant in MPAndroidChart

余生颓废 提交于 2019-11-29 17:59:05
I need to draw red circles if value higher than 3. How to realize that? I've read that I should override method drawCircles but I dont understand where I should do this. LineDataSet set1; set1 = new LineDataSet(entries, ""); chart.getLegend().setEnabled(false); set1.setColor(Color.WHITE); set1.setCircleColor(Color.WHITE); set1.setLineWidth(2f); set1.setCircleRadius(4f); set1.setValueTextSize(9f); set1.setValueTextColor(Color.WHITE); ArrayList<ILineDataSet> dataSets = new ArrayList<>(); dataSets.add(set1); // add the datasets // create a data object with the datasets LineData data = new

MPAndroidChart fill color gradient

巧了我就是萌 提交于 2019-11-29 14:56:50
问题 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:

MPAndroidChart: Can I set different colours for the x-axis labels?

风格不统一 提交于 2019-11-29 14:53:19
So I want to be able to select a bar in my bar chart, and when I select a bar, it changes the colour of the bar (which I know how to do), but also change the colour of the corresponding x-axis label. Is there a way to do this, if so, can someone help me please? Yes it is possible to set different colors for the xAxis labels. You will have to use a custom renderer, something like below: import android.graphics.Canvas; import com.github.mikephil.charting.components.XAxis; import com.github.mikephil.charting.renderer.XAxisRenderer; import com.github.mikephil.charting.utils.MPPointF; import com