mpandroidchart

Plot Multiple Charts in one in MPAndroidChart

与世无争的帅哥 提交于 2019-11-29 14:09:08
I have to plot two different dataSets in a single graph. DataSet-1 String[] xAxisOne = new String[] { "0", "1", "2", "3", "4", "5", "6" }; float[] dataInput = { 1f, 2f, 3f, 4f, 5f, 6f, 7f }; DataSet-2 String[] xAxisTwo = new String[] { "0", "2", "4", "5", "6", "8", "9" }; float[] dataIn = { 3f, 4f, 5f, 6f, 7f, 8f, 9f }; In the above data, DataSet-1 is reference by which graph is created. DataSet-2 has to be plotted in the same with different set of X-Values {xAxisTwo} . In existing Implementation, first 6 values {dataInput} are plotted & next 6 values {dataIn} are plotted with reference to

MPAndroidChart How to represent multiple dataset object with different number of points in the same chart line

隐身守侯 提交于 2019-11-29 12:12:09
I am using MPAndroidChart for charting. I am building a line chart which has multiple dataset objects. From the examples provided by MPAndroidChart I can observe that multiple dataset objects can be drawn in the same line chart but with the same number of points (y-values) and those y-values referenced to the same x-values. What happens if I want to draw multiple dataset objects in the same line chart with different number of points (y-values) referenced to different x-values for each one? How can I get rid of this? I cannot be able to do it. For example: Dataset object 1 Y-values: 0, 12, 23,

MPAndroidChart v3.x.x: upgraded from 2.x.x labels

若如初见. 提交于 2019-11-29 11:25:56
As mentioned in the title, I am working on a project where MPAndroidChart version 2.2.3 is used. In this project, Bar chart is currently used. I am doing the version upgraded to 3.0.1. After the upgrade, few things below does not work anymore: 1. mBarChart.setDescription(""); 2. xAxis.setSpaceBetweenLabels(1); 3. BarData barData = new BarData(ArrayList<String>, ArrayList<IBarDataSet>); I looked around but seems like there is no explanation for those issue, even in the release note. David Rawson First question mBarChart.setDescription(); doesn't work anymore As per this answer here the correct

MPAndroidChart with null values

こ雲淡風輕ζ 提交于 2019-11-29 11:25:19
I'm using the MPAndroidChart and am really enjoying it. A 'little' need I have is that I can put null values to the 'entrys'. I'm monitoring the apache conections on servers of my system, and I would to see if they is down (where I put the null value) or if they just no conections (0). I tried, but the Entry class don't accept 'null' as value showing the message: 'The constructor Entry(null, int) is undefined' Thanks! A possible solution for you could be to check weather the object you received is null , or not. If the object is null, you don't even create an Entry object instead of just

Is it possible to create a multiple color (stacked) bar chart using MPAndroidChart?

夙愿已清 提交于 2019-11-29 08:45:32
I have below data to represent in chart format using MPAndroidChart library: Subject Marks Needs Attention Average Outstanding Hindi 1/5 2/5 2/5 English 2/7 3/7 2/7 Maths 1/3 1/3 1/3 Science 2/7 2/7 3/7 Physics 2/9 4/9 4/9 Sanskrit 3/7 3/5 0 And I want a chart like below: The above chart is only sample, I want three colours in each bar (stacked). I have already made a bar chart with separate colors, but can't make such multiple coloured chart. Is it possible in MPAndroidChart? David Rawson This is called a "stacked bar chart" and it is possible in MPAndroidChart. There is an example Activity

MPAndroidChart - Change message “No chart data available”

佐手、 提交于 2019-11-29 06:25:24
问题 Is there any way to change the message "No chart data available" when the chart is not populated? Edit: Found the answer chart.setNoDataText("Description that you want"); 回答1: update answer chart.setNoDataText("Description that you want"); 回答2: If you also want to customize look & feel, you can do it through Paint object: mChart.setNoDataText("Description that you want"); Paint p = mChart.getPaint(Chart.PAINT_INFO); p.setTextSize(...); p.setColor(...); p.setTypeface(...); ... 回答3: The Correct

MPAndroidChart: Have one graph mirror the zoom/swipes on a sister graph

◇◆丶佛笑我妖孽 提交于 2019-11-29 05:09:05
I have two line graphs that show complementary data over the same time period. Is there any way to send any touch events received by one graph to the other? I essentially want it so that the graphs always show the same viewing rectangle (at least on horizontally). So if a user swipes left 'n' units on the top graph, the bottom graph will automatically scroll left 'n' units to match. Zooms can be done with the current MPAndroidChart release, for scrolling check out or wait for my extension to be merged: https://github.com/PhilJay/MPAndroidChart/pull/545 You need to set up an

How to remove description from chart in MPAndroidChart?

梦想的初衷 提交于 2019-11-29 00:59:28
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. 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 slice values inside the pie-slices? pieData.setDrawValues(false); Or are you talking about the Legend

How to hide legends and axis in MPAndroidChart?

那年仲夏 提交于 2019-11-28 19:06:05
Is their any possibility to hide all rounded items from this picture. I have used the following code, public void setDataList(List<HorizontalBarChartData> dataList, Resources resources) { ArrayList<String> categories = new ArrayList<String>(); ArrayList<BarEntry> values = new ArrayList<BarEntry>(); ArrayList<BarDataSet> dataSets = new ArrayList<BarDataSet>(); BarDataSet set1; for (int i = 0; i < dataList.size(); i++) { categories.add(dataList.get(i).getName()); values.add(new BarEntry(dataList.get(i).getValue(), i)); } /*set1 = new BarDataSet(values, "Income, Expense, Disposable Income");*/

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

女生的网名这么多〃 提交于 2019-11-28 12:07:11
问题 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<>();