I have a date-based graph with x-axis as dates. By default, I populate the graph with a data set of past 6 months. I would like to change the graph to show:
Last one week,
Last one month,
Last 3 months etc.
I looked at the API documentation for modifying the viewport here: https://github.com/PhilJay/MPAndroidChart/wiki/Modifying-the-Viewport
And tried playing around with:
graph.setVisibleXRangeMaximum(100);
graph.moveViewToX(50);
graph.invalidate();
I tried various different parameters, but nothing happens when the above code is executed. My graph already has data filled and is displaying correctly.
Am I looking in the right direction for what I want to achieve? How can I debug my issue?
For those interested, I found the solution.
TL;DR: There is no in-built functionality to change the granularity of the data shown. You need to set the chart's data-set accordingly.
Here is the example from samples: https://github.com/PhilJay/MPAndroidChart/blob/master/MPChartExample/src/main/java/com/xxmassdeveloper/mpchartexample/LineChartTime.java
Related
I am making an attendance app i want to highlight multiple dates where student is absent and also make calendar view not clickable.
only want to show calendar.
This question doesn't look, you have done any research.
However, you can use https://github.com/Applandeo/Material-Calendar-View
Pros:
Easily customizable. [I have used in 3-4 projects so far]
Fits in requirement like range picker, one-day selection (event based)
Lightweight library, few files/ less code. You can also strip off the unnecessary code of range picker and other if you want. As for me, the requirement was only One-day-picker
i want to highlight multiple dates where student is absent
You can create a list of object of EventDay which take the Calendar instance. You can pass it to the CalendarView. It will show the different event aka absentees in your case.
make calendar view not clickable
That's not the big deal, You can easily do that as CalendarView is a custom view itself.
This is my latest screenshot from one of my project. It work really well.
I have added the following 4 dates in my Chart View, in TimeSeries.
2-Jan-2013
3-Jan-2013
4-Jan-2013
7-Jan-2013
When I see the result in the emulator, the graph shows 5th and 6th Jan also. How do I remove the dates which I have not included?
I am preparing a chart to show traffic during working days. So, I want to add the next Monday immediately after this Friday. Please suggest any solution.
You can fix the behavior by calling:
renderer.setXRoundedLabels(false);
I have a calendar view and I want to customize individual days (say change color) under specific condition that I have. For example change the color of days if day is odd number or even number. Is there a way to do that?
I think maybe you can just modify android calender source code from here : https://github.com/android/platform_packages_apps_calendar
As I know, if you use calenderview, you can just use it, not modify it
I am working on app which have data entry form which have
Some fields with 3 drop down associated to it.
More then 25 input fields (input box, radio button, drop downs etc)
All input fields are grouped into 3 categories
My question are:
How to display field with 3 drop downs associated with it ? Because of a small screen size it cannot be displayed horizontally.
What is the best way to represent 25+ fields ? I tried scroll view and tabs but don't find it so pleasing.
For example if you consider date then it may have three drop downs for date , month and year. (Its just example I have fields different than date)
What is the good way to have fields in a category together with appealing UI.
PS: My app is related to Hospital so it has to be pleasant .Which also means I cannot use glossy background or image.
You might want to check this site for general Android UI design ideas. Here are some for your particular cases:
re-design your UI to only show what is needed. It's unlikely that all 25 fields are used all of the time. Consider separate screens for different use cases, and/or some sort of wizard-like UI (fill in the basics, press next, fill in details, etc.)
if you really need to display all of this, consider using a tablet, not a phone to run the app (assuming this is to be used in the field, and you have some control over devices).
instead of tabs, you might want to try something like ViewPager. It doesn't take as much space as tabs, and the number of views is practically unlimited.
Maybe like this...
You can use the library QuickAction which allows to create some kind of context menu.
To keep a simple screen view, you can only display the current values. Several on the same lines for the same category.
Then, if the user click on a value or category, you trigger a QuickAction with the actions available for the category or values: Edit, clear, ...
For each action, you can also show a dialog to update/fill the field which has triggered the action...
I have a range say,1-100 and i want the user to select a value from this range.Ofcourse showing this with a spinner will be awful.I want to use the functionality of date widget,where we can pick a date by pressing a +/- sign,the longer the press ,higher the iteration speed.
I found numberpicker.java that has the code the date widget uses to get this functionality, but do i have to paste that entire code to achieve this functionality!
Here is a tutorial on how to pull out NumberPicker; I've followed it myself: http://www.quietlycoding.com/?p=5
I found numberpicker.java that has the
code the date widget uses to get this
functionality, but do i have to paste
that entire code to achieve this
functionality!
Unfortunately, yes, plus perhaps some resources as well (I have not looked at that code recently). I am not aware of anyone who has pulled that out to make a reusable component, and it is not a widget in the SDK.
Sorry!