Make the miniature squares under a barGraph scrollable using mpandroidchart - android

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.

Related

How to change position of y-axis label using mpandroidchart library?

I've searched the wiki, SO, the issues section of https://github.com/PhilJay/MPAndroidChart/issues, but have been unable to find an answer to my question.
I simply want to change the position of the y-axis values above the horizontal grid lines. I can move them into the graph with leftAxis.setPosition(YAxis.YAxisLabelPosition.INSIDE_CHART), but there doesn't seem to be any way to move their position vertically.
Here is what I am trying to achieve:yaxis_label_above
Here is what it currently looks like:
yaxis_label_on_line
Is it possible to move the position of the y-axis labels vertically either up or down?
The AxisValueFormatter interface (Link)
More details please refer to How can I alter the spacing for the Y-Axis Labels in MPAndroidchart?

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

AChartEngine Graph's View Empty Legend Area Wasted

That orange area is also given to AchartEngine to draw its graph. Achartengine occupies that area for it's legend. But even i have done dr.setShowLegend(false); , achart does not occupy or adjust it's graph location according to that area. Also i can not shrink the graph view because the reason above, pie chart would also shrink. What i ask is, is there any way to customize there (custom legend) or make pie fill up almost all area?
You can Use setMarginsmethod to set Some margin of PieChart .
mRenderer.setMargins(new int[] {top, left, bottom, right});

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.

Have achartengine draw on top of the axis

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.

Categories

Resources