android - How to change text colour for AndroidPlot domain and range labels? -


hi trying out simple xy plot androidplot. having trouble figuring out how change label colours domain , range. examples online use:

plot.getgraphwidget().getdomainlabelpaint().setcolor(my_colour); plot.getdomainlabelwidget().getlabelpaint().setcolor(my_colour);

however not compile me. can suggest need use? (i have tried using getgraph() instead of getgraphwidget() )

i'm trying set margin space between graph , domain labels, , space between graph , range labels if has suggestion that.

    plot = (xyplot) findviewbyid(r.id.plot);     plot.setplotmargins(0, 0, 0, 0);     plot.getbackgroundpaint().setcolor(color.white);     plot.setborderstyle(xyplot.borderstyle.none, null, null);     plot.getgraph().getbackgroundpaint().setcolor(color.white);     plot.getgraph().getgridbackgroundpaint().setcolor(color.white);     plot.getgraph().getdomainoriginlinepaint().setcolor(color.transparent);     plot.getgraph().getrangeoriginlinepaint().setcolor(color.transparent);       // create couple arrays of y-values plot:     final number[] domainlabels = {1, 10, 20, 6, 7, 8, 9, 10, 13, 14};     number[] series1numbers = {1, 4, 2, 8, 4, 16, 8, 32, 16, 64};      // turn above arrays xyseries':     // (y_vals_only means use element index x value)     xyseries series1 = new simplexyseries(             arrays.aslist(series1numbers), simplexyseries.arrayformat.y_vals_only, "series1");       // create formatters use drawing series using lineandpointrenderer     // , configure them xml:     lineandpointformatter series1format = new lineandpointformatter();     series1format.setpointlabelformatter(new pointlabelformatter());     series1format.configure(getapplicationcontext(),             r.xml.line_point_formatter_with_labels);      lineandpointformatter series2format = new lineandpointformatter();     series2format.setpointlabelformatter(new pointlabelformatter());     series2format.configure(getapplicationcontext(),             r.xml.line_point_formatter_with_labels_2);      // add "dash" effect series2 line:     series2format.getlinepaint().setpatheffect(             new dashpatheffect(new float[]{                      // use dp when specifying pixel sizes, keep things consistent across devices:                     pixelutils.dptopix(20),                     pixelutils.dptopix(15)}, 0));      plot.addseries(series1, series1format);     plot.getgraph().getlinelabelstyle(xygraphwidget.edge.bottom).setformat(new format() {         @override         public stringbuffer format(object obj, stringbuffer toappendto, fieldposition pos) {             int = math.round(((number) obj).floatvalue());             return toappendto.append(domainlabels[i]);         }          @override         public object parseobject(string source, parseposition pos) {             return null;         }     }); 

looks found answer text color problem.

as far adjusting spacing between graph , domain / range labels, of androidplot 1.x that's controlled graph's line label insets. example, adjust relative positioning of range labels on left edge of graph:

programmatically:

// move line labels away graph 5dp: plot.getgraph().getlinelabelinsets().setleft(pixelutils.dptopix(-5)); 

xml param:

ap:linelabelinsetleft="-5dp" 

Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -