I'm using mpandroid barchart and I have set negative and positive value in it but I want to that in barchart values start from -100 to 0 and 0 to 10, 20 etc.
Not sure if this will help your issue, but try setAxisMinimum().
Also note, as per the documentation:
Do not forget to call setStartAtZero(false) if you use this method. Otherwise, the axis-minimum value will still be forced to 0.
Related
When I create a line chart with values for each point, the values on the chart overlap the line, as shown in the screenshot. Is there a function to add padding to the values to raise them up so that this doesn't happen? I've looked all over the place for an answer to this or even someone else having the same issue and haven't found what I'm looking for.
My current chart:
I figured it out.
Based on this line in the source code:
int valOffset = (int) (dataSet.getCircleRadius() * 1.75f);
The padding is calculated based on the radius of the circle on the line, so my solution is to increase the size of the circle, set the outer radius to be transparent, and set the hole color to be the same as the line, which accomplishes what I want. This may not work for everyone, depending on what you're trying to do, but it worked in my case.
I have 3 issue related to MPChartAndroid.
How to make chart to see selected values.
1. Add space to the left of LeftAxis and to the right of rightAxis to fully see the values.
2. how to make first and last chart value to fully see the values.
3. Add space under xAxis to see the cut text.
To overcome issue with cutoff x-Axis label, you need to set some extra space on bottom of your chart view.
mLineChart.setExtraOffsets(left,top,right,bottom); try code below
mLineChart.setExtraOffsets(0,0,0,10);
For overcome issue with overlapping value on axis line you need to set some spacing (start position of lines) on x-Axis, try code below
xAxis.setSpaceMax(0.01f);
xAxis.setSpaceMin(0.01f);
also try xAxis.setAvoidFirstLastClipping(true);
the default start value for seekbar is 0. Is it possible to change that value to 10? Please explain me how to set the value.
Thanks in advance.
change from XML : to change default value of seekbar use android:progress="" property of seekbar
android:progress="10"
android:max="100"
change from Java : to change default value of seekbar use setProgress(int progress) method
yourSeekbar.setProgress(10);
So I've been trying to do the same thing only for an arc progress bar. The way that I managed to achieve my desired results was by manipulating my .setProgress and .setMax values.
If you want to start at 10 and have a max of 100, your code should follow something like this:
progressBar.setProgress(_______-10);
progressBar.setMax(90);
For setProgress it should be the number you want minus 10.. this way if you have 10, then the calculation (10-10) would give you 0 which will not move your progress bar.
For setMax.. the reason why you need to subtract 10 is because if you put 100 as your max and say the progress is (100-90).. it will give you 90 (your max)... in other words if we weren't doing any calculations for setProgress, then your setMax should remain the same, but since we did a calculation for setProgress, you have to do the same calculation for your set max.
You can set it via xml, i dont know if you still need this but here is the answer:
android:min="10000" android:max="100000" android:progress="5000"
I am using MPAndroidChart library and have a set of data entries where the Y values are between 20 - 30 and I'm currently displaying it in a Line chart. However, I notice that there is a big gap because the Y-axis starts at 0 instead of 20.
How can I make Y-axis to start at the 20 instead of 0? Or even better the minimum of all y-values?
Thank you for your time!
You can find this in the documentation.
yAxis.setAxisMinValue(...)
allows you to adjust the lower limit of the axis to your needs.
The last version includes a left and right axis. You can set to zero like this (Kotlin):
chart.axisLeft.axisMinimum = 0f
chart.axisRight.axisMinimum = 0f
You can set zero in Bar Graph like this in Java
barChart.getAxisLeft().setAxisMinValue(0f);
barChart.getAxisRight().setAxisMinValue(0f);
Is there any way to show the last value of the xlabel at the end of the x-axis?
For example:
I want to put the value 20:01 at the end of the x-axis. Thanks in advance.