0
votes

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

sine test data screenshot showing 2 data series legends with dual plot implementation on 0.9.8

1
One approach that comes to mind would be to stretch the legend across the full width of the screen, constrain it's dimensions to 2x3 and then ensure that the left side series are added to the plot before the right side series. I believe this would address the visual aspect, however this would still be a single legend implementation so it would break the ability to click the legends individually. Is that something you could work around? - Nick

1 Answers

0
votes

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