1

I need to hide the domain values in a linegraph. Could someone please help me?

    plot0.setDomainBoundaries(0, windowsize, BoundaryMode.FIXED);
    plot0.addSeries(series0, formatter);
    plot0.setDomainStepMode(XYStepMode.INCREMENT_BY_VAL);
    plot0.setDrawRangeOriginEnabled(true);
    plot0.setTicksPerRangeLabel(5);
    plot0.getLegendWidget().setVisible(false);
    plot0.getGraphWidget().getBackgroundPaint().setColor(Color.BLACK);
    plot0.getGraphWidget().getGridBackgroundPaint().setColor(Color.BLACK);
    plot0.setTicksPerDomainLabel(5);
    plot0.centerOnRangeOrigin(0);
    plot0.setRangeBottomMax(-20);
    plot0.setRangeTopMin(20);
    plot0.setRangeLowerBoundary(-75, BoundaryMode.FIXED);
    plot0.setRangeUpperBoundary(75, BoundaryMode.FIXED);
    plot0.setRangeStep(XYStepMode.INCREMENT_BY_VAL, 25);
    plot0.setDomainStep(XYStepMode.INCREMENT_BY_VAL, 240);

UPDATE:-

Library version

compile 'com.androidplot:androidplot-core:0.9.7'

I have modified the XML with as below. But the changes are not reflecting unless I modify it inside the code.

                <com.androidplot.xy.XYPlotZoomPan
                android:id="@+id/dynamicXYPlot0"
                androidplot.renderMode="use_background_thread"
                android:layout_width="match_parent"
                android:layout_height="150dp"
                android:layout_marginTop="20dp"
                android:background="@android:color/black"
                ap:backgroundColor="#000000"
                ap:borderColor="#000000"
                ap:label="Lead I"
                ap:domainTickLabelTextColor="#00000000"
                ap:domainOriginTickLabelTextColor="#00000000"
                ap:gridPaddingBottom="1dp"
                ap:labelTextSize="10sp" />
Community
  • 1
  • 1
somia
  • 611
  • 5
  • 22

2 Answers2

1

I'd suggest trying to do it in XML by adding these params:

ap:domainTickLabelTextColor="#00000000"
ap:domainOriginTickLabelTextColor="#00000000"
ap:gridPaddingBottom="1dp"

This basically sets the tick label color to be completely transparent and removes the extra padding needed to display those labels below the grid.

Before:

enter image description here

After:

enter image description here

Nick
  • 8,181
  • 4
  • 38
  • 63
  • 1
    Thank Nick! But it didn't work setting the parameters in XML. adding these 2 lines did work. But I dont understand why it didn't work when with XML configuration. plot0.getGraphWidget().getDomainTickLabelPaint().setColor(Color.TRANSPARENT); plot0.getGraphWidget().getDomainOriginTickLabelPaint().setColor(Color.TRANSPARENT); – somia May 10 '16 at 09:25
0

Got the solution. Adding these 2 lines worked.

plot0.getGraphWidget().getDomainTickLabelPaint().setColor(Color.TRANSPARENT);
plot0.getGraphWidget().getDomainOriginTickLabelPaint().setColor(Color.TRANSPARENT);
somia
  • 611
  • 5
  • 22
  • which version of the library are you using? the xml method should be equivalent to the above. – Nick May 10 '16 at 16:31
  • I have modified the question with the version and the xml declaration!! – somia May 10 '16 at 21:35
  • I was using 0.9.8 when I tested the solution above. If it's an option, might be worth upreving. – Nick May 10 '16 at 23:10