GraphView y-axis label flicker and space on top with empty title? - android

Two questions regarding the GraphView library.
1) With manual setNumVerticalLabels set when switching from scrolling to scaling and vice versa, that the labels for my y-Axis change it's position. In scrolling mode they are closer together and in scaling mode a bit further apart.
In case of having the number of labels set automatically, the number of labels also changes between the two modes.
Is this a known bug? Is there any way to get around that behavior?
2) Is it possible to claim the space above the graph for the graph if the title is left empty?
Thanks for any help!

1) that is because your labels could need more space. You have 2 options:
a) set a fixed width for the vertical labels
or b) make sure that the labels have a fixed/limited count of characters via custom label formatter.
2) this is not possible with GraphView 3.x, but in GraphView 4.0 this is be fixed.

Related

How to change position of y-axis label using mpandroidchart library?

I've searched the wiki, SO, the issues section of https://github.com/PhilJay/MPAndroidChart/issues, but have been unable to find an answer to my question.
I simply want to change the position of the y-axis values above the horizontal grid lines. I can move them into the graph with leftAxis.setPosition(YAxis.YAxisLabelPosition.INSIDE_CHART), but there doesn't seem to be any way to move their position vertically.
Here is what I am trying to achieve:yaxis_label_above
Here is what it currently looks like:
yaxis_label_on_line
Is it possible to move the position of the y-axis labels vertically either up or down?
The AxisValueFormatter interface (Link)
More details please refer to How can I alter the spacing for the Y-Axis Labels in MPAndroidchart?

MP charts RTL not working android

I am working with in a multilingual application where I am using MP charts(charting library) for statistics display. But in Rtl layouts its not mirroring to Rtl direction. Is there way I may get it working for Rtl layout?
It cannot be done but there is a way to implement that by inversing your values like add higher values first e.g if you are making graph on x-axis of values 1,2,3,4 just reverse the order add 4 on first index and 1 on last index. By doing this it will draw from left to right but it looks like from left to right also disable left axis and enable right axis so graph looks like it.

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

achartengine change location of origin

I'm drawing a BarChart with AChartEngine on Android.
I made the chart horizontal by changing the orientation of the XYMultipleSeriesRenderer:
mMSRenderer.setOrientation(Orientation.VERTICAL);
(it seems counter-intuitive that horizontal is set with Orientation.VERTICAL, but that's not the point of my question).
The origin of the plot is on the top left corner, while I would like it in the bottom left, so that values go increasing from the bottom to the top.
Is this possible?
This is not possible with AChartEngine as it is out of the box.
However, you can try to put your data in your dataset in a reversed order and add custom labels instead of the default ones.

Negative Barchart with Androidplot

I'm using the Androidplot library to plot a Barchart to display something.
The range of my values are -40 till +40.
How can I plot a bar to the negative side? I just want to center the zero on the y-axis in the middle and the bars should growing up or down, if the value is positiv of negativ. My bars are growing from the lower bound upwards. It should look like this:
That works for me:
plot.centerOnRangeOrigin(0);
plot.setRangeLowerBoundary(0,BoundaryMode.AUTO);
Where plot is a instance of XYPlot.
Negative bar support has recently been added to Androidplot 0.6.2; you'll need to use the latest development version to get it (it's very stable).
Once you have the correct version of Androidplot you can use Maria Reina's suggestion to enable the display of negative values. Here's how I'm doing it in the screenshot below:
plot.setUserRangeOrigin(0);
plot.setRangeBoundaries(0, BoundaryMode.AUTO, 0,BoundaryMode.AUTO);
Note : There is currently a bug where if you are using overlay mode with 2 or more series and have negative bars, the overlay order of negative bars is reversed, causing the smaller negative values in a bargroup to be obscured by the larger ones. If your goal is simply to reproduce the image above though then you should be fine.
That's a great question. I think there's no way to do that with the current version of AndroidPlot (0.6.0) with a single series of values.
I created a workaround in my project. I know it's not perfect, but it works: create two series that overlap, one in green and one in the background color. Suppose you have your currentValue to draw..
if (currentValue>=0) {
greenRes[i] = Float.valueOf(currentValue);
coverRes[i] = Float.valueOf(0);
}
else {
greenRes[i] = Float.valueOf(0);
coverRes[i] = Float.valueOf(currentValue);
}
In this way you always have the green bar starting from the zero axis and going up or down.

Categories

Resources