3

I have a plot setup like this:

aHistoryPlot = (XYPlot) findViewById(R.id.plot);
    aHistoryPlot.setRangeBoundaries(0, 255, BoundaryMode.FIXED);
    aHistoryPlot.setDomainBoundaries(0, HISTORY_SIZE, BoundaryMode.FIXED);
    aHistoryPlot.addSeries(YHistorySeries, new LineAndPointFormatter(Color.rgb(100, 200, 100), Color.TRANSPARENT, null));
    aHistoryPlot.getGraphWidget().setMarginTop(10);
    aHistoryPlot.setDomainStepValue(5);
    aHistoryPlot.setTicksPerRangeLabel(3);
    aHistoryPlot.setDomainLabel(getResources().getString(R.string.string_time));
    aHistoryPlot.getDomainLabelWidget().pack();
    aHistoryPlot.setRangeLabel(getResources().getString(R.string.string_value));
    aHistoryPlot.getRangeLabelWidget().pack();
    aHistoryPlot.disableAllMarkup();

How can I remove the domain values from the plot?

Thanks in advance!

Nithin Michael
  • 2,166
  • 11
  • 32
  • 56
amp
  • 11,754
  • 18
  • 77
  • 133

3 Answers3

8

Setting the paint to null I belive is a bit better you also get the space back that the lables take up. Here is the code I have in my speed test code for switching all of these bits on and off.

    if (!mBackgroundOn) {
        // remove the background stuff.
        mDynamicPlot.setBackgroundPaint(null);
        mDynamicPlot.getGraphWidget().setBackgroundPaint(null);
        mDynamicPlot.getGraphWidget().setGridBackgroundPaint(null);
    }

    if (!mKeyOn)
        mDynamicPlot.getLayoutManager()
                .remove(mDynamicPlot.getLegendWidget());
    if (!mDomainLabelOn)
        mDynamicPlot.getLayoutManager().remove(
                mDynamicPlot.getDomainLabelWidget());
    if (!mDomainAxisOn) {
        mDynamicPlot.getGraphWidget().setDomainLabelPaint(null);
        mDynamicPlot.getGraphWidget().setDomainOriginLabelPaint(null);
    }
    if (!mBoarderOn){
        //mDynamicPlot.setDrawBorderEnabled(false);
        mDynamicPlot.setBorderPaint(null);
    }if (!mRangeLabelOn)
        mDynamicPlot.getLayoutManager().remove(
                mDynamicPlot.getRangeLabelWidget());
    if (!mRangeAxisOn) {
        mDynamicPlot.getGraphWidget().setRangeLabelPaint(null);
        mDynamicPlot.getGraphWidget().setRangeOriginLabelPaint(null);
        //mDynamicPlot.getGraphWidget().setRangeLabelVerticalOffset(rangeLabelVerticalOffset);
    }
    if (!mGridOn) {
      //mDynamicPlot.getGraphWidget().setGridLinePaint(null);
        mDynamicPlot.getGraphWidget().setDomainOriginLinePaint(null);
        mDynamicPlot.getGraphWidget().setRangeOriginLinePaint(null);
    }
    if (!mTitleOn) {
        mDynamicPlot.getLayoutManager().remove(mDynamicPlot.getTitleWidget());
    }
Matt Clark
  • 27,671
  • 19
  • 68
  • 123
Ifor
  • 2,825
  • 1
  • 22
  • 25
  • Is it working now your code? I would like to remove the ``RangeLabelWidget`` and the ``DomainLabelWidget`` to set the ``GraphWidget`` at full screen.. – optimusfrenk Apr 19 '16 at 16:23
  • I have not updated to the vary latest version so there is a danger that things have changed if the structure has changed but I do not know. Try it and see. – Ifor Apr 20 '16 at 09:22
6

You can enter:

aHistoryPlot.getGraphWidget().getDomainLabelPaint.setColor(Color.TRANSPARENT);
Maxi
  • 979
  • 10
  • 16
  • Thanks! I just added `aHistoryPlot.getGraphWidget().getDomainOriginLabelPaint().setColor(Color.TRANSPARENT);` and it made what I was looking for. – amp Dec 07 '12 at 15:27
2

Setting this, will enable you to get rid of all the grid/border stuff, and enable you to have a transparent graph style.

aprHistoryPlot.setPlotMargins(0, 0, 0, 0);
aprHistoryPlot.setPlotPadding(0, 0, 0, 0);
aprHistoryPlot.setDomainLabelWidget(null);
aprHistoryPlot.setRangeLabelWidget(null);

aprHistoryPlot.setBackgroundPaint(null);
aprHistoryPlot.getGraphWidget().setBackgroundPaint(null);
aprHistoryPlot.getGraphWidget().setGridBackgroundPaint(null);
aprHistoryPlot.setBorderPaint(null);

//aprHistoryPlot.setDomainLabel( null ); // crash
//aprHistoryPlot.setRangeLabel( null );

aprHistoryPlot.getGraphWidget().setDomainLabelWidth(0.0f);
aprHistoryPlot.getGraphWidget().setRangeLabelWidth(0.0f);

aprHistoryPlot.getGraphWidget().setDomainLabelPaint(null);
aprHistoryPlot.getGraphWidget().setDomainOriginLabelPaint(null);

aprHistoryPlot.getGraphWidget().setRangeLabelPaint(null);
aprHistoryPlot.getGraphWidget().setRangeOriginLabelPaint(null);

aprHistoryPlot.getGraphWidget().setDomainOriginLinePaint(null);
aprHistoryPlot.getGraphWidget().setRangeOriginLinePaint(null);

aprHistoryPlot.getLayoutManager().remove(aprHistoryPlot.getTitleWidget());

aprHistoryPlot.getGraphWidget().getDomainGridLinePaint().setColor(Color.TRANSPARENT);
aprHistoryPlot.getGraphWidget().getRangeGridLinePaint().setColor(Color.TRANSPARENT);
aprHistoryPlot.getGraphWidget().getRangeSubGridLinePaint().setColor(Color.TRANSPARENT);

aprHistoryPlot.getLayoutManager().remove(aprHistoryPlot.getLegendWidget());
aprHistoryPlot.getLayoutManager().remove(aprHistoryPlot.getDomainLabelWidget());
aprHistoryPlot.getLayoutManager().remove(aprHistoryPlot.getRangeLabelWidget());