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" />

2 Answers 2

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

Sign up to request clarification or add additional context in comments.

1 Comment

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);
0

Got the solution. Adding these 2 lines worked.

plot0.getGraphWidget().getDomainTickLabelPaint().setColor(Color.TRANSPARENT);
plot0.getGraphWidget().getDomainOriginTickLabelPaint().setColor(Color.TRANSPARENT);

3 Comments

which version of the library are you using? the xml method should be equivalent to the above.
I have modified the question with the version and the xml declaration!!
I was using 0.9.8 when I tested the solution above. If it's an option, might be worth upreving.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.