Apply a programmatic pan with achartengine - android

Is there a way I can apply a pan from code? I want my pie chart to initially display a little off center (down a little bit). Can I do that?

Have a look at renderer API. I guess you should use setInitialRange(double[] range, int scale) function, but I can't be sure from your question: do you mean to 'offset' initially displayed data inside graph or to change whole chart position (a little below) ?
Maybe posting an image could help to understand your need

Related

Multicolored android slider

I want to create this type of slider
I don't want the code but the directions. what is the best thing todo this?
is there any similar library project available?
is there any similar view already available natively.
is this more easy to create in jetpack compose UI.
Thank you so much for your help.
Since you refer to the view you want as a "slider", I assume that you are thinking about using something from the Material Design library. My personal experience with the Material Design views are that they primarily enforce the MD guideline and are not very flexible although they may work for you in this case.
is there any similar library project available?
As for libraries, it looks like the other answers point to some that may be capable of what you are looking for.
is there any similar view already available natively.
I suggest that you take a look at using a SeekBar not because I think that it is necessarily better, but I believe that you can get the result you want with a little effort that would not have external dependencies other than the standard libararies.
Here is another answer of mine that explains how to build a SeekBar similar in structure that you are looking for. Your background would be the rounded rectangle with gradient shading. The background colors can be defined as explained here. Your seek bar can be built using a LayerList. The layer list can be defined in XML and modified in code. You can also forgo the layer list and draw that seek bar programmatically or fit everything into one drawable. Which you do will depends on your design constraints.
The thumb can easily be a custom thumb.
You will likely wind up with mostly XML but some code but not much. I would consider placing the code in a custom view that extends from a standard SeekBar.
You can edit the following resources.
https://github.com/divyanshub024/ColorSeekBar
custom scroll able multi color seek bar
I built something similar with Jetpack Compose, instead of using different colors with intervals it creates gradients from colors, but what you ask is a little work on current build and it can display anything as thumb. You can check source code and implement drawing over track section. If it's much work i can add similar features when i'm available.
The easiest way of doing this in Compose Canvas, for View it's a custom View that draws inside onDraw.
You basically draw a line with width and rounded cap or a rounded rectangle and draw border with a stroke around it. Do some interpolation for changing from your value range to pixels on screen and get the current value based on users touch position and interpolate it to range defined.
Let's say your Slider is 1000px wide. And your range is between 0f and 1f, you translate touch on 600px to 0.6 value and vice versa. For different colors you can pass a List<Pair<Color,Float> to divide slider between color based on float based stops.
For drawing lines you set 3 types of heights and use modulus to assign each height in every 1, 5 and 20 value. I have something similar for building Compass with View here
https://github.com/SmartToolFactory/Compose-Colorful-Sliders

Tap Target for rectangular shapes Android

I am trying to use the Tap Target View library from GitHub in an android app.
https://github.com/KeepSafe/TapTargetView
I was wondering if anyone knows if we can use this library to highlight a rectangular shape or if it is primarily for targets that can be surrounded by a circle. I like to highlight an entire row in a list view.
Thanks
This library when reviewing the codes you find out there is no arc or circle in this customView and is a Rect...
So how is this circle like? It cause the radius number it gets. so if you know you can change the code very easily and remove or make the radius to 0.
But my question is why? really is going to make a bad mess for rectangular things...

how to plot a graph from right hand side in android ,

I have to draw a graph on android with:-
X-axis's labels starting from the right-hand side of the graph and
ending to the left. (i.e; label with low value positioned on the
right while labels with higher values positioned left)
Y-axis positioned on the right side of the graph.
I have tried graphview (library) in android but could not find a way to plot x-axis from right to left manner. (As explained above) However, managed to plot Y-axis. (As managed above).
Tried MPChart (library as well) unfortunately that also did not work.
Any suggestion or idea will be a great help.
I am attaching the image as well for you to understand what exactly I want my graph to look like.SEE IMAGE HERE
If the input data is not dynamic you can always graph it it in reverse order by reversing the Array/List and plotting it normally. I've had to use some hack around code to rotate my Graph to make the x axis on the left and y axis on the bottom using MPAndroidChart. But it seems like you already tried attempted that solution, so I honestly would just reverse graph it.
Something like : Collections.reverse(Arrays.asList(a));
"For all my graphing needs I used: MPAndroidChart
This guy made a awesome library and so easy to implement it has really good doceumation to get started found here: MPAndroidChartDocumentation"

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

AchartEngine Android Special Pie Chart

I'm using the AchartEngine libraries to make a pie chart app. But I want to display two dimensional data like this
I can get nice standard pie charts but I know how to do the second dimension. Can anyone please help? The guys on the achartengine-google-support group say it's possible but I was redirected here for tech questions.
Many Thanks
If you take a look at the Budget Pie chart demo it shows you how to highlight a section of your pie chart (https://code.google.com/p/achartengine/source/browse/trunk/achartengine/demo/org/achartengine/chartdemo/demo/chart/BudgetPieChart.java). Take a look at "Project 1" below to see how this looks.
However there is no way to change the radius like you want to in your screenshot above. If you want to achieve this the easiest way would be to extend PieChart and copy over the draw method. In the draw method where it renders highlighted sections (if (seriesRenderer.isHighlighted()) ...) use a different radius instead of translating to an offset.

Categories

Resources