Questions tagged [mpandroidchart]

MPAndroidChart is a powerful open-source Android chart view / graph view library. Use this tag if your question is specific to this library.

MPAndroidChart (https://github.com/PhilJay/MPAndroidChart) is a powerful open-source Android chart view / graph view library, supporting line- bar- pie- radar- bubble- and candlestick charts as well as scaling, dragging and animations.

Core features:

  • LineChart, BarChart (vertical & horizontal), PieChart, ScatterChart, CandleStickChart, RadarChart (spider web chart), BubbleChart
  • Scaling on both axes (with touch-gesture, axes separately or pinch-zoom)
  • Dragging / Panning (with touch-gesture)
  • Separate (dual) y-axes
  • Highlighting values (with customizeable popup-views)
  • Save chart to SD-Card (as image)
  • Predefined color templates
  • Legends (generated automatically, customizeable)
  • Customizeable Axes (both x- and y-axis)
  • Animations (build up animations, on both x- and y-axis)
  • Limit lines (providing additional information, maximums, ...)
  • Fully customizeable (paints, typefaces, legends, colors, background, gestures, dashed lines, ...)
  • Available as .jar file
  • Available as gradle dependency and via maven: Usage
  • Detailed documentation
  • Example Project (code for demo-application)
  • Google-PlayStore Demo Application
1939 questions
13
votes
2 answers

How to set colors in MPAndroidChart?

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…
Alexandre
  • 143
  • 1
  • 1
  • 7
12
votes
1 answer

MPAndroidChart define exact/fixed interval between values on x-axis (time)

I'm using in the app MPAndroidChart library and I have line graph like this now: On X axis I have seconds and I want to have the same interval between values on X axis. Now I have 19:03 and 19:20 but I want 19:05, 19:10, 19:15 (so have 300 seconds…
Pepa Zapletal
  • 2,879
  • 3
  • 39
  • 69
12
votes
1 answer

How to create a long red line (limit line) in MPAndroidChart

I am using MPAndroidChart library version 2.2.4. My requirement is I want to set three marker lines in a BarChart with values "Minimum", "Average" and "Maximum" like in the image below, but I can't find any solution for this.
Neha Shukla
  • 3,572
  • 5
  • 38
  • 69
12
votes
2 answers

How to enable cubic lines in MPAndroidChart library?

I am using MPAndroidChart library for a project of mine to integrate charts in my app. I know how to use LineCharts but I couldn't figure out a way to use the Cubic Lines feature of the LineCharts. The image below shows the kind of graph i want,…
Deepak Sharma
  • 417
  • 3
  • 9
12
votes
3 answers

MPAndroidChart set center vertical line

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…
ductran
  • 10,043
  • 19
  • 82
  • 165
12
votes
4 answers

MPAndroidChart remove legend

I am using MPAndroidChart library and I want to remove the values in in the top right corner of the PieChart, how can I do this ?
Russell Ghana
  • 2,963
  • 3
  • 20
  • 31
12
votes
1 answer

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

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…
Mohammed Ali
  • 2,758
  • 5
  • 23
  • 41
11
votes
4 answers

Scroll finish listener of Line chart in mpandroidchart

How to listen to the scroll finish event in mpandroidchart. I overrided the OnChartGestureListener and OnChartValueSelectedListener but it does not seems to work. onChartTranslate() method gets callback even after the scroll gets…
Kanagalingam
  • 2,096
  • 5
  • 23
  • 40
11
votes
3 answers

How to set margin/padding for x-axis first/last point in MPAndroidChart?

I need some space before the first point and after the last point in the line chart showing below (red rectangle area). How do I achieve that in MPAndroidChart?
Hengstar
  • 180
  • 2
  • 13
11
votes
3 answers

MPAndroidChart: add custom image inside bars

I am using MPAndroidChart and I want to show a custom drawable inside this CombinedChart like in below image: If bar value is >= a goal value, say, 50, then I would like to add a star image inside the bar. Can any one help me for customise the…
Sanjay Kakadiya
  • 1,596
  • 1
  • 15
  • 32
11
votes
5 answers

MPAndroidChart bar chart how to change color of each label

This is a bar chart that i build using MPAndroidChart library. Now I have to change the color of each label and I can't find the solution through searching over the internet.
user2273146
  • 1,602
  • 2
  • 14
  • 27
11
votes
2 answers

Custom view of Limit Line in MPAndroidChart

Is it possible to replace LimitLine with custom layout? So it looks something like this: I see few solutions for that: Perhaps there're methods inside library for customizations like this, are there any? Get coordinates of TextView where the…
AnZ
  • 1,040
  • 24
  • 54
11
votes
4 answers

MPAndroidChart: Rotate Labels of X-Axis by 90 degrees in BarChart

My text in xAxes of BarChart from MPAndroidChart is too long. How I can rotate label of xAxes by 90 degrees?
mbagher
  • 387
  • 4
  • 14
10
votes
0 answers

MPAndroidChart - Round corners on stacked bars

I need to create a chart with stacked bars and the bars need to be rounded. So far, I've succeeded in making the bars rounded, but if they're not stacked. If stacked, then each bar is rounded, which is something I don't need. I need the bar to be…
jlively
  • 735
  • 2
  • 9
  • 29
10
votes
2 answers

Customize the marker - MPAndroidChart

I've created a Simple Bar Chart using MPAndroidChart. For the purpose of Marker I'm extending MarkerView. I need a marker as shown in the git hub, like this: But I'm not getting that arrow. So it is not looking like a comment, it's a rectangular…
Prabs
  • 4,923
  • 6
  • 38
  • 59