You can enter:
aHistoryPlot.getGraphWidget().getDomainLabelPaint.setColor(Color.TRANSPARENT);
Вопрос
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!
Решение 2
You can enter:
aHistoryPlot.getGraphWidget().getDomainLabelPaint.setColor(Color.TRANSPARENT);
Другие советы
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());
}
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());