MP charts RTL not working android - android

I am working with in a multilingual application where I am using MP charts(charting library) for statistics display. But in Rtl layouts its not mirroring to Rtl direction. Is there way I may get it working for Rtl layout?

It cannot be done but there is a way to implement that by inversing your values like add higher values first e.g if you are making graph on x-axis of values 1,2,3,4 just reverse the order add 4 on first index and 1 on last index. By doing this it will draw from left to right but it looks like from left to right also disable left axis and enable right axis so graph looks like it.

Related

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"

androidplot dual data-series legends with range legends on both sides (left, right)

while i really appreciate the new 1.4.x androidplot release for it's ability to provide range legends on both sides (left and right), this would now ask for being able to provide 2 visually separable data series legend blocks instead of one or a similar setup
back in the 0.9.8 days i created 2 independent plots being overlayed ... this allowed a range legend on the left with one plot and one on the right with the second one ... now i was able to place one data series legend inside the graph in the upper left corner and the other one in the upper right corner
this visually linked the left and right range legends to it's data series legends
upon a touch in the either left or right range legend screen areas would scroll (change) through the various data series linked to each plot and the data series legends on each side would provide a visual help which series are linked to each side (back then plots)
i also changed the grid params and domain label color to indicate which range legend is the one applied to the grid setup
i prefer not to use the dual plot approach for performance reasons over a faster single plot setup
i can accomplish most of the above described functionality with the 1.4.3 rev of androidplot, except i have no means to provide 2 visually separated data series blocks legends relating to the 2 range legends on the left and right
i hope this was not a too complicated description to my desired setup
sine test data screenshot showing 2 data series legends with dual plot implementation on 0.9.8
thanks for your suggestion
yes, i could live with it for now ... actually i took the default horizontal legend position at the bottom and moved it into the graph area at the bottom to provide a bigger graph area and the legend still goes from left to right, and it's not too likely that this will be mostly overwritten with the plots
i'm already adding the left plots 1st and the right ones after, so i have some sort of visual left and right separation
it would be nice to maybe later have some sort of ability of physical separation for the data series legends, like with the left and right range legends
the issue seems to be the automatic legend data generation based upon the plot.addseries function ... if this automation is removed and a solution in concept similar to below
XYLegendWidget lw = Plot.getLegend (right ? XYLegendWidget.Edge.RIGHT
: XYLegendWidget.Edge.LEFT) :
lw.addSeries (LineAndPointFormatter reference or similar ) ;
lw.setPadding (1, 1, 1, 1) ;
lw.setIconSize (new Size (isz, SizeMode.ABSOLUTE, isz, SizeMode.ABSOLUTE)) ;
lw.getTextPaint ().setTextSize (txtsz) ;
lw.getTextPaint ().setTextAlign (Paint.Align.RIGHT) ;
lw.getTextPaint ().setColor (ContextCompat.getColor (this, R.color.gray)) ;
lw.position (spc, HorizontalPositioning.ABSOLUTE_FROM_RIGHT,
bot, VerticalPositioning.ABSOLUTE_FROM_BOTTOM, Anchor.RIGHT_BOTTOM) ;
the above code is taken from my setup, except for the lw.addSeries (LineAndPointFormatter reference) or similar
use the LineAndPointFormatter data already available from the 2nd param in the plot.addseries and use it for an addseries call in the XYLegendWidget setup
just a thought ... this would now provide 2 legends ... of course the automated legend data generation based upon plot.addseries is now gone and the legend, even one needs to be setup manually
but you are the expert Nick, and thanks for the nice work with 1.4.x, despite some growing (upgrade) pains for some less experienced users like myself

How to add entries starting from right axis (right to left ) in PhilJay/MPAndroidChart, instead of left

I'm creating a line chart where I have to add entries from right to left.
This is one of the mentioned issues in the library. But the simplest way you can do is by reversing the order of your entries.
If you want axis inverted you can try something like this - https://github.com/PhilJay/MPAndroidChart/issues/2715 . Simply use set inverted method.

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

GraphView y-axis label flicker and space on top with empty title?

Two questions regarding the GraphView library.
1) With manual setNumVerticalLabels set when switching from scrolling to scaling and vice versa, that the labels for my y-Axis change it's position. In scrolling mode they are closer together and in scaling mode a bit further apart.
In case of having the number of labels set automatically, the number of labels also changes between the two modes.
Is this a known bug? Is there any way to get around that behavior?
2) Is it possible to claim the space above the graph for the graph if the title is left empty?
Thanks for any help!
1) that is because your labels could need more space. You have 2 options:
a) set a fixed width for the vertical labels
or b) make sure that the labels have a fixed/limited count of characters via custom label formatter.
2) this is not possible with GraphView 3.x, but in GraphView 4.0 this is be fixed.

Categories

Resources