FAQ Database Discussion Community


How add float x and float y values in MPAndroidChart

android,scatter-plot,mpandroidchart
I am trying to use MPAndroidChart in my app but my dataset series contains float values (x and y data) and the library use ArrayList<Entry> that need float and int values...

MPAndroidChart - drawing a circle in the last entry only

android,charts,mpandroidchart
Using MPAndroidChart, Is there a way to draw only one circle in line chart?, this means that only the end of the line will be represented be a circle as shown in this image: @PhilJay...

MPAndroidChart Labels displays all in one line - Need to wrap

android,mpandroidchart
I am creating a chart using MPAndroidChart with 10 data sets using one of the examples provided. My labels are displaying all on one single line and are not wrapping. They are getting chopped off on the right. Legend l = mChart.getLegend(); l.setForm(Legend.LegendForm.SQUARE); l.setPosition(Legend.LegendPosition.BELOW_CHART_LEFT); I would like to display the...

MPAndroidGraph How to make the graph auto-scroll

android,mpandroidchart
I am using MPAndroidChart in my application and I am generating points in real-time and adding them to the graph. How do I make the view "follow" the graph and move as new values are added ? In the sense, that once the graph reaches the right end of the...

MPAndroidChart 2.1 so many things changed

android,mpandroidchart
Until now i used MPAndroidChart 1.7 and everything was great. Now i need to use a Combined Chart so i needed to use the new version (2.1). However... so many things changed that i cant resolve all the errors now. I used simple things like: chart.setDrawUnitsInChart(false); chart.setStartAtZero(false); chart.setDrawYValues(true); chart.setDrawXLabels(true); chart.getXLabels().setPosition(XLabelPosition.BOTTOM);...

Show image instead of text in MPAndroidChart pie chart

android,charts,mpandroidchart
I have a pie chart in my android application that i draw with MPAndroidChart. <com.github.mikephil.charting.charts.PieChart android:id="@+id/chart" android:layout_width="400dp" android:layout_height="400dp" android:layout_centerInParent="true" /> PieDataSet pieDataSet = new PieDataSet(entries, "expenses"); pieDataSet.setColors(ColorTemplate.PASTEL_COLORS); pieDataSet.setDrawValues(false); PieData data = new PieData(xValues, pieDataSet); chart.setData(data); chart.getLegend().setEnabled(false); chart.setDescription("");...

How can I wire together this Custom ListView ArrayAdapter?

java,android,listview,android-listview,mpandroidchart
This question isn't specific to the MPAndroidChart lib, but I'm expanding on the MPAndroidChart example app's ListViewMultiChartActivity ChartDataAdapter, and it abstracts out the RowItems (ChartItems in this case). Now, I'm used to holding all of my logic in the ArrayAdapter's getView(), but in this case, it seems to be abstracted...

MPAndroidChart: LineChart Fill does not stop at x-axis

android,linechart,mpandroidchart
When I use the LineChart setDrawFilled() method to fill in the space between the line and the x-axis, and manually adjust the range to be bigger than the default, the filled in portion will go past the x-axis as seen in this screenshot: The blue fill should stop at the...

Force BarChart Y axis labels to be integers?

android,mpandroidchart
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...

MPAndroidChart compiling error with Proguard

gradle,proguard,mpandroidchart
When I include the latest library (2.0.7) using gradle and try to compile I get a warning from proguard, so I can't complie any more: Warning:com.github.mikephil.charting.charts.LineChart$DefaultFillFormatter: can't find referenced field 'boolean mStartAtZero' in program class com.github.mikephil.charting.charts.LineChart According to docs this is often an inconsistency while compiling, and I've tried to...

Android Studio Build fail - Execution failed for task ':app:dexDebug'

android,android-studio,gradle,mpandroidchart,nineoldandroids
I am a new Android Developer and build files always scare me. :D I am using some third part libraries in the project dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') compile 'com.android.support:appcompat-v7:21.0.+' compile 'com.android.support:support-v4:21.0.3' compile 'com.android.support:cardview-v7:21.0.+' compile 'com.android.support:recyclerview-v7:21.0.+' compile 'de.hdodenhof:circleimageview:1.2.1' compile 'com.github.flavienlaurent.datetimepicker:library:0.0.2' } In addition to this I am also...

How MPAndroidChart display all xaxis values

android,mpandroidchart
I'm developing some chart features using MPAndroidChart library. Is there any way to display all the xaxis values I added? Seems that the library will auto calculate on xaxis, some of values will be hidden. ex. display date: 05-17 05-17 05-15 .... the same day 05-17 will not shown. thanks!...

MPAndroidChart - How to add Annotations or images to the chart

android,mpandroidchart
I am currently working with the latest MPAndroidChart Library and am looking for a way to add annotations or images that would be clickable. Example: once data reaches a certain value an event occurs that I want to be able to display to the user - there a multiple events...

MPAndroidChart PieChart position of x-values

android,mpandroidchart
Is it possible to change the xValues of a MPAndroidChart PieChart?` It looks like that by default: But i want it to look like that: So how can i change the position of the xValues?...

Set pie chart to non touchable

mpandroidchart,ios-charts
I'm using this awesome plotter framework ios-charts. The documentation for the android version states that one can disable touch events on the charts with "setTouchEnabled(false). However I can't find this function in the iOS version. "touchesBegan" might the way to go here? I'm new to iOS programming so I'm not...

Hide border using mpandroidchart 2.0.7

android,mpandroidchart
I'm using MPAndroidChart library 2.0.7. How can I hide the border ? In the version 1.7.4, the method setDrawBorder(boolean) was available, it is not the case anymore :( Thanks a lot !...

Hide legends in MPAndroidChart

android,mpandroidchart
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();...

MPAndroidChart: Chart Not Displaying

android,mpandroidchart
I added a BarChart into my project XML (snippet of layout below): <RelativeLayout android:id="@+id/relative_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" > <com.github.mikephil.charting.charts.BarChart android:id="@+id/chart"...

Is it possible to have two different charts on one graph?

android,mpandroidchart
I want to have a LineChart and a BarChart on the same graph, both with MarkerViews. I can get them to draw on the same chart just by adding a LineChart on top of a view with a BarChart However, the LineChart markerview overrides the bar chart's markerview. Is this...

MPAndroidChart - issues with setVisibleYRange, does not work for setting higher values

android,view,charts,mpandroidchart
Working with MPandroiChart i have encounterd a problem, i am adding dynamical data and am trying to have the chart fit the highest data at all times, using "setVisibleYRange()" seems to work fine when i need to narrow down the view but does not seem to work when i need...

How would I update a chart within a multi-chart listview?

android,mpandroidchart
I've extended the example app ChartDataAdapater and ChartItems extensively, but am running into a small issue when it comes to updating already created charts in my listview. For example, one of the charts in my listview is a linechart with multiple series. I give the user the option to modify...

Saving a chart as an image in MPAndroidChart

android,mpandroidchart,save-image
I am using the MPAndroidChart to render various charts. I wanted to add the functionality of saving the charts as images to the gallery. I added an icon to the action bar to use this functionality, but the image does not save to the gallery. The code is given below...

MPAndroidChart - How to set range values from BarChart at 2.0.9v?

android,mpandroidchart
I´m using MPAndroidChart 2.0.9 version. I would like to set labels on y-axis from 0 to 100 and display always this range, but i can´t find the chart.setYRange() method.

How to center the chart vertically (using LineChart from mpandroidchart)?

android,android-layout,mpandroidchart
I am using mpandroidchart library to generate a chart but when drawn, it always appears more towards the top of the layout leaving a blank area below it. Is there a way to draw it to the center of the layout? (see image) Also, another question: I have another chart...

How to draw all XLabels in a BarChart

android,mpandroidchart
I'm using the great mpandroidchart libs for drawing various graph in our apps and first of all I'm deeply sorry if this question will be redundat or stupid. Anyway, I have this BarChart which is drawing great except to the fact that i can't find a way to force the...

How do you change the inner circle color of a LineGraph in MPAndroidChart?

android,mpandroidchart
I am using MPAndroidChart to make charts in Android app. I need to make circle blue with just white border of that circle, like this on the image below. This is my code: LineDataSet set1 = new LineDataSet(yVals,"DataSet"); set1.setFillAlpha(65); set1.setFillColor(Color.RED); set1.setColor(Color.WHITE); set1.setCircleColor(Color.BLUE); set1.setLineWidth(2f); set1.setCircleSize(5f); set1.setDrawValues(false); And this is the result:...

MPAndroidChart Logarithmic Y Axis

android,charts,mpandroidchart
I need to implement a line chart inside my application and I would like to make use of MPAndroidChart. The problem is that the value on the y axis will be somewhere between 1 and 1x10^-12. Thats why i need an Logarithmic view on that axis. Is there any way...

How to customize MPAndroidChart library according to custom design requirements

android,charts,mpandroidchart
I am creating an application and I want to customize some existing android pie chart library according to custom design needs. I am using MAPAndroidChart Library and successfully created initial Pie Design as follows But when it comes to design implementation, it requires some design customizations in design, Required designs...

How to prevent the TextView from being cutoff by the parent container?

android,textview,mpandroidchart
I'm using mpandroidchart to generate a chart on one-third of my device screen. As I move towards the edge of the screen the TextView gets cutoff by the padding on the sides on the parent container. Is there a way to fix it without changing my UI? Towards the edge:...

MPAndroidChart PieChart is not showing Markerview

android,pie-chart,mpandroidchart
I am implementing Piechart where I want to show Markerview on slice selection, as it is in Barchart. So I set a Markerview for Piechart. mChart = (PieChart) findViewById(R.id.chart1); MyMarkerView mv = new MyMarkerView(this, R.layout.custom_marker_view); mChart.setMarkerView(mv); mChart.getMarkerView().setEnabled(true); I don't want to customize Markerview. I am using the same Markerview as...

MPAndroidChart BarChart horizontal / vertical

android,mpandroidchart
I am using the MPAndroidChart library. In BarChart by-default all the bars are vertical (bottom-up), how to display it in horizontally?

MPAndroidChart - CustomValueFormatter renders values out of the Viewport

android,mpandroidchart
I've been working with HorizontalBarChart MPAndroidChart a few days ago, and ran into an issue while trying to use a custom ValueFormatter which converts the time from milliseconds into 12h format time. (08:50 AM) But as you can see in the picture below, the value gets clipped... Is there any...

Can't optimize line chart using MPAndroidChart library

android,graph,android-graphview,mpandroidchart
I am trying to make a good looking line chart iwht MPAndroidChart, but I am having some problems. Here is what I got now and here is the code for it public void createGraph() { chart.setTouchEnabled(false); chart.setDragEnabled(false); chart.setHighlightEnabled(false); chart.setDrawYLabels(true); chart.setDrawXLabels(true); chart.animateXY(2000, 2000); chart.setDrawBorder(true); chart.setPadding(30, 30, 30, 30); setData(); } private...

How to move Date under X axis?

android,mpandroidchart
I am using PhilJay/MPAndroidChart library in my app and I'd like to know if 2 things are possible: to show the last 14 days and then scroll for previous days? Can the dates (currently on the top of the graph) be moved to the bottom, along the x axis? Here...

How to increase horizontal chart value text size in MpChart

android,mpandroidchart
I want to set the barchart values in center of the bar and with bigger font. mChart.setDrawValueAboveBar(false); By using the above the value is shown inside the bar but not at the center.I am using MpChart Thanks in advance...

MPAndroidChart how to set a dual-background color on the chart

android,bitmap,mpandroidchart
I am using the latest MPAndroidChart library, and I was wondering if there is way to set a dual-background color on the chart. I need the colors to match a certain number of days that will be displayed on the x-axis. I would like to be able to do this...

How to set increment value for Y axis in MPAndroidChart

android,mpandroidchart
I need to change increment value for Y axis. I'm using this code to set min and max: YAxis rightYAxis = chart.getAxisRight(); rightYAxis.setAxisMaxValue(180); rightYAxis.setAxisMinValue(0); It gives me this view of the right Y axis: Y axis shows [0, 30, 60, ..., 180] so increment here is 30. But I need...

How to set legend labels MPChart

android,mpandroidchart
I am trying to customize legend but not able to do so.My purpose is to give different legend labels.I ma using MPChart library to do so. ArrayList<BarEntry> entries = new ArrayList<>(); entries.add(new BarEntry(4f, 0)); entries.add(new BarEntry(8f, 1)); entries.add(new BarEntry(6f, 2)); entries.add(new BarEntry(12f, 3)); entries.add(new BarEntry(18f, 4)); mColors.add(R.color.red); mColors.add(R.color.text_color_gray); mColors.add(R.color.text_color_blue); mColors.add(R.color.green);...

Get which chart is selected on activity

android,mpandroidchart
I am using latest release of mpandroidchart library. I have 2 bar charts on single activity. chart1 & chart2 are the id's in XML (I don't want to use barchart list view). chart1 cosnist Counts value & chart2 consist dollars value. I am getting the values already. But I want...

Tool tip for Stacked Bar Chart using MarkerView & Issues in Legends

android,mpandroidchart
I want to Display a Stacked Bar Chart in my Android Application with tooltip functionality. I used the MarkerView to display it but no Success. Here is the sample code. Also I am facing issues in Legends..! As text wrapping is not supported by the Library the legends are not...

change text of yAxis labels in MPAndroidChart

android,charts,mpandroidchart
This line chart is drawn using MPAndroidChart. Is there any possibility to change text of labels here, ex: (69.0, 69.5, 70.0) to (bad, average, good). Or is it possible in any other chart....

Error generating final archive: Found duplicate file for APK: AndroidManifest.xml when I imported MPAndroidChart's jar file into my project

android,jar,android-manifest,mpandroidchart
I have a android application that needs a chart, and I got the MPAndroidChart in GitHub. But according to the documents, I just copy the jar file to the libs folder,and then I got the error. I have searched some solutions in the cite,such as change androidsdkversion ,project->clean your project,...

Pass BarEntry through intent

android,mpandroidchart
I am using MPAndroidChart I'm using BarEntry in a service and I need to push yvalues through an intent to a fragment. Since BarEntry don't implements Parcelable I don't know how can I handle this. Thanks a lot !...

MPAndroidChart XY plot - independent X values?

scatter-plot,mpandroidchart
I'm using the MPAndroidChart library to plot some data from a few sensors. I've found similar questions on SO, but no solutions: Plot Multiple Charts in one in MPAndroidChart MPAndroidChart How to represent multiple dataset object with different number of points in the same chart line The sensors create data...

MPAndroidChart - Remove top border / axis since v2

android,mpandroidchart
I upgraded MPAndroidChart from v1.7 to v2 and had to change a couple things. One of the new things is that i now appear to have a top border for the maximum value. My code trying to hide all borders is like this: LineChart graph = (LineChart) connectionView.findViewById(R.id.graph); graph.setDrawGridBackground(false); graph.setDrawBorders(false);...

MPAndroidChart - Is it possible to set different markerViews for different dataSets?

android,mpandroidchart
I have a BarChart with two sets of data. One is blue and one is green. Is it possible to have a blue Marker View for the blue dataset and a green Marker View for the other?...

MPAndroidChart method setWordWrapEnabled() not found

android,mpandroidchart
I am displaying BarChart using mpandroidchart. The Legend is displayed below the chart. But when the number of Labels increases, it goes off the boundaries of the chart. I am trying to use the below according to what is specified in the documentation, Legend l = barchart.getLegend(); l.setWordWrapEnabled(true); But i...

MPAndroidChart is there a way to set different colors for different bars?

android,view,graph,charts,mpandroidchart
I am using MPAndroidChart in my app and i was wondering if there is a way to set a diferent color for the first bar in a dynamically moving bar chart, like this: The bars are added dynamically while the whole stack is being moved to the left as the...

MPAndroidChart changing data values while zooming

android,mpandroidchart
I would like to ask if in MPAndroidChart there is a way to change the values of the chart while zooming, For example the first Bar chart view the values in by month when zoom in the value will change to by weeks then when zoom in again the value...

How to get bar click event from horizontalbar charts of MPcharts in android?

java,android,design,mpandroidchart
I am using MPAndroidChart library. I have used Horizontal bar charts in my dashboard. I want to navigate to another activity by clicking particular bar of that chart. How can i do this??...

Animations in MPAndroidChart

android,animation,mpandroidchart
I am using the MPAndroidChart library for rendering of charts. While using i came across this piece of code : public void animateY(int durationmillis, Easing.EasingOption option); What is animation easing? What is the use of Easing.EasingOption?...

mpandroidchart invisible dataset can still be highlighted

android,mpandroidchart
I'm using MPAndroidChart library version 2.1.0 and I have a line chart with 8 or so Datasets and it works great. Now I'm trying to temporary hide all Datasets except the one selected/highlighted by the user and show them again once the selection is cleared. For this I'm using the...

mpandroidchart pie chart(highlights slides disappear)

android,pie-chart,mpandroidchart
I'm new at using MPAndroidChart and I'm stuck with this problem. When I draw a PieChart with my values and highlight one of the slices, the color of the other slices disappear. This is the pie chart before selecting a slice(I cannot post pictures because I just created an account):...

ios-charts How to invalidate/redraw after setting data

mpandroidchart,ios-charts
See Updates At Bottom (4/30/2015) I'm implementing a Pie Chart in Swift for iOS using ios-charts, and have chosen to customize the legend. Of note, the chart is displayed within a cell of a UICollectionView. The problem is that on first display, the custom legend content is not being displayed....

MPAndroidChart BarChart xValues Issue

android,mpandroidchart
i noticed an issue with the BarChart of MPAndroidChart and need a fix. First my code: this.barChart = (BarChart) view.findViewById(R.id.bar_fragment_bar_chart); this.barChart.setDrawYValues(true); this.barChart.setDrawXLabels(false); this.barChart.setDrawValueAboveBar(true); this.barChart.setDrawBorder(false); this.barChart.setDrawGridBackground(false); this.barChart.setDrawHorizontalGrid(true); this.barChart.setDrawVerticalGrid(false); this.barChart.setDrawBarShadow(false); this.barChart.setDescription("");...

MPAndroidChart - Animating a single entry

android,charts,mpandroidchart
Using MPAndroidChart I am trying to animate a single entry like this: is there a way to do that or at least access the single entry view so that i can animate it myself? @PhilJay...