3

我有一个这样的情节设置:

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

如何从图中删除域值?

提前致谢!

4

3 回答 3

8

我相信将油漆设置为 null 会更好一些,您还可以获得标签占用的空间。这是我在速度测试代码中的代码,用于打开和关闭所有这些位。

    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());
    }
于 2012-12-08T12:50:13.637 回答
6

您可以输入:

aHistoryPlot.getGraphWidget().getDomainLabelPaint.setColor(Color.TRANSPARENT);
于 2012-12-07T13:18:55.447 回答
2

设置此项,将使您摆脱所有网格/边框的东西,并使您拥有透明的图形样式。

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());
于 2014-07-09T09:40:29.327 回答