How to set maximum x-axis value for HorizontalBarChart? - android

I am working with the MPAndroidChart library and I am trying to produce a Horizontal Bar Chart with only one item in the data set. The issue I am running into is setting the max value for the x-axis. I would like to say the max X value is 1000 and if the value in the data set is 500 then the bar chart would only go 1/2 way across the screen. My issue is that I can't seem to find a way to set the max value of the x axis for the Horizontal Bar Chart in the MPAndroidChart library.

I know this is kind of misleading, but for the HorizontalBarChart, this needs to be set via the y-axis :-)
Here is the full documentation of the YAxis.
Check out the setAxisMaxValue(float max) method.

Related

Android MP Chart lib scroll bar indicator on X and Y axis

com.github.mikephil.charting.charts.LineChart
not able to add the scroll bar on x and y-axis
can anyone help me out?
setVisibleXRangeMaximum(float maxXRange): Sets the size of the area (range on the x-axis) that should be maximum visible at once. If this is e.g. set to 10, no more than 10 values on the x-axis can be viewed at once without scrolling.
setVisibleXRangeMinimum(float minXRange): Sets the size of the area (range on the x-axis) that should be minimum visible at once. If this is e.g. set to 10, it is not possible to zoom in further than 10 values on the x-axis.
setVisibleYRangeMaximum(float maxYRange, AxisDependency axis): Sets the size of the area (range on the y-axis) that should be maximum visible at once. You also need to provide the axis this constraint should apply to.
After that u will get scrolling in your chart on both of the axis. Question is not very clear but I think you are looking for that by fixing number of entries on a view and by scrolling user can see other values present in chart. If that is the case then use above methods. Hope It helps :) Happy Coding :). Do let me know if it works or if your requirement is different please do elaborate.

MpChart Combined chart auto scroll option

I am using MP chart lib for my android project. I am creating CombinedChart(Bar chart & Line chart) with negative values. Charts is coming up, But when I increase the number of values across X axis, bar width decreases in order to accommodate the values.
screen shot
How can I include values along X axis without shrinking the bar width and when graph comes up user can scroll horizontally to see all the values.
I am setting
Try this it will work :
combinedChart.setMaxVisibleValueCount(10);
give your number instead of ten

Make limit line always visible on mpandroidchart

I am making an app which retrieves data from a database and shows it on a barchart. I have defined a limit line using the provided methods at 30f (on the Y axis).
The problem is, that I want that limit line to be always shown and it only becomes visible when one of the Graph's Bars raises above that value (30f).
Is there a way to always show it?
I have tried with the zoom functions with no luck.
Modify the YAxis display range to your needs: https://github.com/PhilJay/MPAndroidChart/wiki/YAxis-(YLabels)
Especially those methods should help:
setAxisMaxValue(float max): Set a custom maximum value for this axis. If set, this value will not be calculated automatically depending on the provided data.
setAxisMinValue(float min): Set a custom minimum value for this axis. If set, this value will not be calculated automatically depending on the provided data.

AChartEngine does not display the maximum chart value - Bar Chart

I am working on Achart Engine and i am facing 2 issues
Issue
1) i am facing exactly same problem as posted in the screen shot here displaying max chart values on Y axis
2) suppose in the 3 bars if i one among the bar is 0 say middle one then the bar will not be drawn and shows blank between the two bars, but i dont want to show some space.
On Issues what i want to acheive:
Issue 1) My Ymax value is 50 ,i can make the Y max value to 60 so that the max value is displayed and will not cut.But what happens is now its display 10,20,30,40,50 in Y axis but if i make it 60 it displays 20,40,60 but i want it to display 10,20,30,40,50,60.
Issue 2) If the middle bar value is 0 or any other bar value which is draw is 0 then i dont want to show a space there or dont draw the bar at all.
Please help me to acheive this.
EDIT:
SCREEN SHOT :
I cannot post a screen shot here lack of reputation so i am posting it here please see to it
IMAGE
Just set the Y axis maximum value to something that is higher than the biggest value.
Bar charts with value of zero must be displayed. If there isn't any value to be added than just use MathHelper.NULL_VALUE.
There are two ways to solve this problem.
One of the ways is to set the margin color to transparent in the renderer
renderer.setMarginsColor(Color.argb(0x00, 0xff, 0x00, 0x00));
This solution works unless your series have values that are outside the range of the chart. You can either recreate your series so all values are inside the range, or go for solution 2.
Solution 2 is to multiply the max Y value of your chart by 1.1, and set it as the Y max
mRenderer.setYAxisMax(maxvalue*1.1);

LineGraph Using Android plot

I have create simple line chart using Android Plot library.
what i want to do is:
set X range Upto Seven results(I have done this).
and set max value of Y is 100.
currently it takes max value of array as max Y value.
i want like this:
any suggetion?
Thanks...
I think the answer is that you are confusing the number of data points with the maximum value of the axis. Your x-axis is just the number of data points, it has not value as such. The y-axis will contain the same number of points - however I believe you want to set the maximum value of the y-axis to 100 because it is a percentage. You can do this by using setRangeBoundaries

Categories

Resources