Have achartengine draw on top of the axis - android

As of right now if I have a line chart value that is straight horizontal or vertical and happens to be the exact value as one of the grid lines, then it becomes really tough to see. Is there any way to change the Z order of how things are drawn such that everything draws over the grid lines?

No, there isn't such API.
However, you can play with the colors, for instance set some transparency level of the grid lines color, axes color.

Related

MPAndroidChart with two charts value padding

I'm using MPAndroidChart in order to draw two charts however when the two values are close they overlap like the picture
is there a way to solve this for example by setting padding on values on the red chart to be drawn on top of the green one?

Draw text on oval path in the centre

I'm trying to draw some text on path using the canvas in Android. I can successfully get the text to draw on the top oval line. What i'm struggling to do is make sure that the text is centered.
The problem is that while i can measure the text before it gets drawn round the top line of the oval, i cannot measure it after. This makes estimating where the text should be drawn on the top oval line problematic as it's always a little bit out. This is because when i measure the text to be drawn initially it is measured in a straight line and not as presented on the top line of the oval.
I've tried applying setTextAlign(Paint.Align.CENTER) but this makes the text get drawn about 3/4's of the way round and not what i want.
Does anyone have any ideas how i could calculate the point to draw the text so it is drawn dead centre of the top oval line or any alternative method that may help?
This has to be drawn using the canvas. It can't be done using XML TextViews etc.
Thanks.
You can check how this library done it: https://github.com/amulyakhare/TextDrawable
Its using the same approach. But for multiple lines its almost impossible, theres an issue on this library where me and other developers tried to implement it, and we end up using just xml (a round drawable as a linearLayout view background and one textView inside it).

Make the miniature squares under a barGraph scrollable using mpandroidchart

I have a barGraph similar to the one below.
I was wondering if the miniature ( maybe the word is not accurate, I'm talking about the little coloured squares under the x axis, on the left of the word "Company" on the picture ) can be set to scrollable when the graph contains a lot of datas.
If so, is there as well a way to set those squares touchable and on touch, to center the view on the corresponding element of a barGraph?
I add that the graph itself is and has to be scrollable.
Thanks in advance.
The little squares you are talking about represent the Legend which shows the different datasets used.
It is not possible to make this scrollable by default.
What you could do is create your own miniature BarChart below your actual barchart and use that one.

How can i create a border on custom view with many drawing shapes

I want to apply the border to this custom view shape
which created by many canvas.draw...() in onDraw()
The border that i want to create and apply to my custom view should have equal range all the way with some distance from the custom view and it should also cover small circle in each slice.
Any idea how to make this?
Thanks.
This isn't so much an answer, but more of a recommendation. Take a look at the Porter-Duff modes available to you. Worst case you may need to do some per pixel image manipulation which should be fine as long as the view isn't animated.
On second thought, here's an idea: why not create two images: one large circle which will always draw behind everything and a second which will always draw behind the small circles. The large circle would just be the complete border you want displayed, whereas the small circles would actually only be a semi circle border, which would render on top of the large circle (covering the large circle border under it). The key would then be to rotate the small border circle depending on where it's located. I hippie that makes sense, but it should work and be very efficient too.
Another option would be to separate the rendering into white circles and slightly larger border color circles. If you render the slightly larger (border color) circles first, then render the normal circles (white) on top, then you won't have to worry about any rotations and it will render correctly if the small outer circles begin to overlap.
So the idea is similar to the first suggestion. You'll still need a large circle and small circle (both white), but in addition, you'll need slightly larger border colored large and small circles.
I hope this description is a little clearer, but I assume that you are comfortable enough with compound drawables to figure out the rest, given that you've gotten this far in making your view.
All the best implementing it, and feel free to ask for any clarification! :)

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.

Categories

Resources