I'm using AChartEngine in my Android app.
In the line graph the default value of the difference between numbers on
y-axis numbers is always 500 or higher. How can I change this number?
For Example:
the values on the left side start at 500 then 1000 then 1500 and I would like to set the
first number to for example 100, then 200 etc. I can't find a good method in the library.
Kind regards!
Try this in your XYMultipleSeriesRenderer .. It's not enough means increase the value...
renderer.setYLabels(10);
Related
I'm trying to make a chart with dates on x-axis and consumption per time month/day etc. on y-axis.
I have database of actual states of energy meters in specific datetime:
1.1.2014 - 150 kWh
5.1.2014 - 200 kWh
So I can get consumption/time like - 50/5 => 10 kWh/day for time from 1.1. to 5.1.
I guess I need some resolution, for every day for example (better for every hour), and add the value of consumption in every hour from 1.1. to 5.1.. But then I need to have that resolution on x-axis labels, 1,2,3...31 day of month etc. But I want to achieve that on zoom out I would have another resolution, means another labels on x-axis. Months. Like 1,2,3..12 And values of consumption with lower resolution, rounded in specific months.
I really don't know how to do that, if it's even possible?
I would like to achieve X-axis label in zoom (better for hours in higher zoom):
And X-axis labels for zoomed out, like on this graph:
Do I need to make my map of x-axis labels for whole times (where I have data of consumption) and then fill it with counted values somehow?
PS: I want to achieve this X-axis labels with Bar chart or Cubic line (cube) chart.
Thanks for any tips
I recently update the MPAndroidChart library from 1.7.4 to 2.0.9 and I forgot what I did to customize the linechart to make the data displaying from right to left. Does anyone know? I am wondering if there is a method to call to do that.
There is no method. But it can still be done because it only depends on how you add the data.
Just add values at higher x-indices first.
Say you got a chart with x-axis labels from January to December with an x-axis range from 0 - 11 (12 values).
Now add the december value at index 11, and so on.
If you want to set the first data point other than zero and have the data display in left to right manner use moveViewToX(float xValue).
moveViewToX(float xValue): Moves the left side (edge) of the current viewport to the specified xValue.
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.
I've been working with Androidplot library for generating line plots and be able to do zoom and pan, so I'm using a modified version of XYPlotZoomPan class.
My current chart is showing some values per day, in a range of dates, so if I'm showing 7 days the domain axis is readable but if I'm trying to show 30 days it turns into a mess.
My goal is to show 7 days and have the option of scrolling through the rest of the chart that is not shown.
The only function that handles boundaries is setDomainBoundaries, currently I've tried this:
setDomainBoundaries(min, max, BoundaryMode.FIXED);
But it lets me show values inside this range and I'm loosing the ability for panning through the rest of the days.
Does someone have an a idea how I can do that? Thanks.
You can create your own domain value format with myplot.setDomainValueFormat(Format f). From here you can create your own formatter.
Another option you can look at is setDomainStep, a good example of that can be found here
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