I have a problem using MPChart :
x axis couldn't display the first date,could someone help me?thanks!
You can use the setAvoidFirstLastClipping(Boolean) from your chart to avoid your first and last labels to be truncated.
From the doc:
setAvoidFirstLastClipping(boolean enabled): If set to true, the chart will avoid that the first and last axis label entry in the x-axis "clip" off the edge of the chart or the screen.
Related
I want to set a label in the x-axis for every y-value I have in my LineChart. I want to obtain this result:
Can someone help me in finding the correct way of doing this in MPAndroidChart?
You may be looking for granularity - see the wiki page for the axis and the javadoc.
Calling like this:
mChart.getXAxis().setGranularity(0.3f);
mChart.getXAxis().setGranularityEnabled(true);
will ensure that 0.3 is the minimum interval on the axis when you are zoomed in. Apart from that you may have to tweak the the scale of the x-axis by calling:
mChart.getXAxis().setAxisMinValue(10.01f); //experiment with these values
mChart.getXAxis().setAxisMaxValue(10.14f);
mChart.getXAxis().setLabelCount(5);
How to make graphview background completely blank, not even show x axis and y axis.
couldn't find anything on web
I got my solution by adding these lines
mygraphview.getGridLabelRenderer().setGridStyle(GridLabelRenderer.GridStyle.NONE);// It will remove the background grids
mygraphview.getGridLabelRenderer().setHorizontalLabelsVisible(false);// remove horizontal x labels and line
mygraphview.getGridLabelRenderer().setVerticalLabelsVisible(false);
// remove vertical labels and lines
I have the whole line chart working. However the fonts are really small for the labels in x axis and y axis and also on the points where it is plotted. I've circled them in the picture in order to let you know what labels I am talking about.
Also I have disabled the zoom buttons, however we can still zoom using our fingers on the screen. When I zoom in the chart gets messed up. How do I not allow any kind of zooming?
You can set labels size in pixels for 2 axis together
renderer.setLabelsTextSize(float textSize)
Also you can set label color, align gor X and Y axis, for example:
renderer.setXLabelsColor(Color color);
renderer.setYLabelsAlign(Paint.Align.RIGHT);
This is how any maximum value is being displayed on the graph. How can i ensure that the full point is shown?
Set the Y axis maximum visible value manually:
renderer.setYAxisMax(10.5);
I have set min max range for y-axis values but graph can scroll beyond those values which hampers the look and feel of graph. I wish to control/stop scrolling of graph along the y-axis. How can I do that?
What you need is specify which axis panning is available for: mRenderer.setPanEnabled(boolean enabledX, boolean enabledY)
Click here for more
use the following for locking both x and y axis scrolling, based on our need boolean values can be specified
render.setPanEnabled(false, false);
use setPanLimits method.
mRenderer.setPanLimits(new double[]{0,10,0,5});
this code will disable panning beyond 0 to the left,10 to the right on X axis,and beyond 0 down and 5 up on Y axis.