How to generate a polygonal chart - android

I'm developing an android application in which I want to show a set of aptitude's person and a numeric rating associated to each one of them.
Currently, my approach is a ListView where each row shows a TextView with the name of the aptitude and a RatingBar representing its value. The problem is, I have to show around 6-10 rows which in most cases fills the screen and from my point of view, it's not an elegant solution.
I came out with the idea of representing the info as a key-value set in a polygonal chart. Something like this:
I'm guessing I will need to be working with Canvas, which I have never did before. I would like to ask for a first steps of how would you get into this approach (if there's models to be defined, which android apis to use) or even better, if there's any library to get something like this.

Checkout MPAndroidChart
it has Radar Chart (spider web chart) which is highly customizable.
you get something like this

Related

How to implement multiple highlight line sliders in line chart

I want to implement single and multiple highlight line sliders in line chart. I am able to get only single highlight line slider with MPAndroidChart (https://github.com/PhilJay/MPAndroidChart) library. But I also need two highlight line sliders to allow the user to select range of values(min and max values) on the chart. Please refer the below image for more information:
Can we achieve the above requirement with any library or we need to draw a custom view?
Any help or guidance will be well appreciated.
In terms of shinobicharts, while the Crosshair could be easily customised to act like one of sliders, in order to have the two sliders you'd probably want to make use of the Annotations feature.
You can create Annotations with custom Views and add them at any X, Y point (in data terms). You can also convert between data values and pixel values via the Axes. It is therefore possible to make the Annotation follow the user's finger as they drag across the screen.
The trickiest part would be placing the circle on the LineSeries at the right Y-value. As I mentioned above you can convert pixel values (e.g. from a user gesture) to data values so you could easily get the X value but the API would leave quite a bit of work up to you in order to get the correct Y value.
This kind of feature is something that is requested quite often and is certainly something we are looking at providing in the future but for now, while possible, it isn't available out-of-the-box.
Disclaimer: I work for shinobicontrols

Statistics curve on android app

I'm trying to make an app where I can show some statistics.
I have some data that I collect from an STM microcontroller each 5 minutes, and with those data, i want to be able to draw a curve with this data, something like this :
https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcQ56Bh-zxV5SZ0OYfaO0sLlxYCuZG0PbDtRR95opMtU80SPDx2r
So, what element in android can allow me to do so and how should i process the data i have ? I thought about using canvas, and making point then drawing the curve using those points, is that a valid method ?
And thanks
You can implement your own CustomView, which allows you to draw, like in a canvas. You can draw lines, curves and charts, but you must implement it manually, by extending and overriding View class method. But it isn't hard. The abilities of the CustomView is wide, you can even use it for simple games. So check this tutorial, if you want to know more.
But if you haven't time for it, you can use libraries, that do all work for you, just like this.
find some components to try in the Graphics section https://android-arsenal.com/free
william chart looks really cool!

[Android]min3d -collision detection and some stuff

I,m using min3d framework on my device to make some car game, so i created some simple car model and simple and its moving, but i want to create ''physics'' and i need the collision detection which isn't provided in min3d (i won't change framework because i have android 2.1 without possibility to upgrade) i want to create it by my self but the problem is that i don,t know how to check if the plane collides with anything what i want to do is:
-create simple flat rectangle (not cube) and i want to place it in front of ''car'' and check if something gets inside of this rectangle and something does i want the car to bounce of it in reversed direction (the problem isn't to bounce but: how to check if something gets through my rectangle)
I have some other problem too:/
When i enclose my ''game''(haha) with a LinearLayout in xml everythong is going fine till i use the command to set the text with the value of rotation of a car for example -then is force close:/ I'm doing it form my class from which i load my objects (i'm providing my classes too)
I was searching for tutorials on the web but none of them was tlaking about 3d collision and even if it was about 3d there was too much code that wasnt need and i was loast in it so i dont get anything
I ask you royal users from stackoverflow to provide me example for creating the rectangle(if needed, because i can laod model from .3ds and .obj)and check if something gets through it(intersects?) not for entire code but just for the method how to do that, and how to refrsh the value of a car, in layout without a crash
By the way: my ''game'' is using qwerty keyboard as input (i,o,p,l keys)
Wanted to post my class here but its to much of lines and was getting erros so grab it on free hosting site, its scanned by avast already on my pc, it contains my entire project with min3d too.
My sources ready to compile and run are(with min3d -which isn't mine):
http://odsiebie.pl/ax1v1p5tam8i/KRL044.7z.html
thanks in advice:)
an approach is to break it down to two dimensions (xy). imagine that your cars are 2D-Rectangles. in the moment you want to check collision, just check if any of the four corners of your "car" is within the rectangle of another car. might be not best practise but works for me.
instead of this you could use r-tree sqlite to check collision.

AChartEngine - read y values by x

I'm currently working on my first android application and now use the achartengine library.
My question: Is there a function to read out y-values from a chart by passing an x-value as a parameter?
I have a line chart using a TimeSeries with several custom dates (for example 07/24/12 and 07/29/12). Now I want to pass another date (for example 07/25/12) and get the corresponding y-value - even though it is not stored in the TimeSeries.
I just wanted to ask, if there is a simple way like a single function to achieve this aim, otherwise I'll think about a more complicated solution on my own. In my above example, of course, it sounds quite easy to calculate the demanded y-value, but in practice it is going to be more difficult I guess.
Thank you.
No, there isn't such thing in AChartEngine.

Custom layout in Android: scrollable graphic with selectable elements over top

I'm fairly new to the Android platform and was wondering if I could get some advice for my current head scratcher:
I'm making an app which in one view will need an image, which can be scrolled on one axis, with a load of selectable points over the top of it. Each point needs to be positionable on the x and y (unlikely to change once the app is running, but I'll need to fine tune the positions whilst I'm developing it).
I'd like to be able to let the user select each point and have a graphic drawn on the point the user has selected or just draw a graphic on one/more points without user intervention.
I though for the selectable points I could extend the checkbox with a custom image for the selected state - does that sounds right, or is there a better way of doing this? Is there any thing I can read up on doing this, I can't seem to find anything on the net about replacing the default images?
I was going to use the absolute layout, but see that it's been depreciated and I can't find anything to replace it.
Can anyone give me some code or advice on where to read up on what I need to do?
Thank you in advance
This really feels like something you should be doing with the Canvas and 2D graphics, rather than trying to twist the widget framework to fit.

Categories

Resources