I am using centerViewTo method in MPandroid chart in which the chart centers itself to a bar on which the user clicks.
But the centering happens very fast . I want to slow down this process by using some kind of animation or some duration. So the transition becomes smooth.
How to do that?
Related
I have a horizontal bar chart using minimal code.
The problem is that when I am zooming in the values on the bars disappear.
Before:
After:
The values reappear if -while zoomed in- I drag the chart to the start of the Axis (and disappear again if I drag away).
Is this the expected behavior? Any way to change it?
edit: https://github.com/PhilJay/MPAndroidChart/issues/4131
I want to make the chart of achartengine to smoothly move while panning, and animate while I programmatically changes axis display range. Searching through the documents, there seems to be no provided function to achieve this. Is there a way to do this?
You can definitely do this by changing the display area in a separate thread than the UI one, calling mChartView.repaint(), waiting for 20 ms or so then repeat the above.
I use achartengine in a fragment with a view pager. It works great, but if I put a lot of value (100~200) into my series swiping is a bit slow. It's weird because, when I touch the page title, fragment changing is very fast, I only have this problem during slow swiping. How should I solve this?
Additional information:
- linechart with only one series
- y values from 0 to 100
- x values currentTimeInMillis
A solution we recently implemented is to save the view using the chart engine as a Bitmap and display the bitmap, only re-calculating the chart when values change.
Displaying a bitmap is much cheaper than displaying a chart, your swipe won't lag.
To do it, simply follow this thread.
I am interested in implementing a user interface navigation control mechanism based on a wheel shaped device (or pie chart shaped or circle shaped) in my Android app.
I would like only half of the wheel to be visible at any time. That is, only the top half of the wheel should be visible since the bottom half should be below the border of the screen. The user can then turn the 'half wheel' to show options hidden by the screen border. The visible top half should then be divided into three parts like a pie chart, so the user can press either one of them to invoke some action. The following pic should explain (it is an example with seven (A-G) options).
http://imgur.com/lNu1F
The rotation itself should not be hard, but I am having a hard time understanding how to position the wheel so that half of it is outside the actual screen. I am thinking that loading the entire wheel (but hiding half of it) is best, since that is that graphics I have and it will also allow a smooth animation when the user swipes to show some other options. How can I make Android show the wheel in this way?
Also. Any comment on how to implement the 'swipe along the wheel shape' would be appreciated.
Thank you.
So for the wheel - you are hving trouble knowing how to position the wheel because you are using XML to align you objects and would like to use something like "Align Object Center To Bottom" which does not exist.
Here is one approach that might work fine: Mask the wheel view.
Is it possible to mask a View in android?
As for swipe the wheel along, I would register the wheel to take touche events, and use only the horizontal componenet of move events to apply to the rotation of the wheel. This setup is common in audio software that uses knobs.
However if you want to have it stick to the users finger in a more realistic fashion, you will need to do the following:
When the user first touches the wheel, calculate the angle from the wheel center to the finger.
Every time the finger moves, check the angle from the wheel center to the finger - and rotate the wheel the amount that the angle has changed from the last touch event.
The formula for getting the angle between two points is this:
Float angleInRadians = Math.atan2(point1.y-point2.y, point1.x-point2.x);
I am developing an application which makes use of google map. I have some overlays added to show location of certain places. These overlay items can tap to get more information. I followed the link How to show a balloon above a marker in a MapActivity? Isn't there a widget? to achieve. Besides, I need to show some animation around the overlay item to show that it is being selected.
I have one idea which is to draw some circles(just stroke, without fill) simultaneously one after another. Start from small circle with thicker stroke to big circle with thinner stroke. When the second circle is drawn, the first circle should disappear. It would be like circle gradually growing (ripple effect) . Of course, it would disappear and start the process over again.
I am having trouble with drawing circles on the mapview. Is it just another overlay or something else? I would be grateful if anyone could show me similar thread or recommendation. Any suggestion are welcome too.