Java 如何自定义XYPlot属性-添加X&;Y轴标签和更改图例文字大小?
我尝试的内容:我正在使用XYPlot作为我的动态图,它运行良好。我试图在我的Java 如何自定义XYPlot属性-添加X&;Y轴标签和更改图例文字大小?,java,android,linegraph,androidplot,Java,Android,Linegraph,Androidplot,我尝试的内容:我正在使用XYPlot作为我的动态图,它运行良好。我试图在我的initplot()函数中自定义它。我尝试使用getLegendWidget(),getDomainLabelWidget()和getRangelWidget()函数(如下所示) 我在找什么:但我不确定 如何添加X&Y轴标签,如下图所示 如何增加图例项的文本大小 我要使用哪个参数?我的尝试如下所示。我真的很感激任何关于这方面的建议 -多谢各位- plot.xml: <FrameLayout
initplot()函数中自定义它。我尝试使用getLegendWidget()
,getDomainLabelWidget()
和getRangelWidget()
函数(如下所示)
我在找什么:但我不确定
如何添加X&Y轴标签,如下图所示李>
如何增加图例项的文本大小
我要使用哪个参数?我的尝试如下所示。我真的很感激任何关于这方面的建议
-多谢各位-
plot.xml:
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.androidplot.xy.XYPlot
android:id="@+id/dynamicPlot"
title="Data Plot"
android:layout_width="wrap_content"
android:layout_height="530dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"
android:background="#FFFFFF" />
</FrameLayout>
private void initPlot() {
plot = (XYPlot) getView().findViewById(R.id.dynamicPlot);
//..LPF formatting here
plot.getLegendWidget().setTableModel(new DynamicTableModel(1,3));
Display display = getActivity().getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
int width = size.x;
int height = size.y;
plot.getLegendWidget().setSize(new SizeMetrics(width/3, SizeLayoutType.ABSOLUTE, height/4, SizeLayoutType.ABSOLUTE));
//..domain/range color formatting here
plot.getGraphWidget().getDomainLabelPaint().setTextSize(40);
plot.getDomainLabelWidget().pack();
outlinePaint = plot.getGraphWidget().getDomainOriginLinePaint();
outlinePaint.setStrokeWidth(3);
plot.getGraphWidget().setClippingEnabled(false);
plot.getGraphWidget().getRangeLabelPaint().setTextSize(30);
plot.getRangeLabelWidget().pack();
outlinePaint = plot.getGraphWidget().getRangeOriginLinePaint();
outlinePaint.setStrokeWidth(3);
//plot.getLayoutManager().remove(plot.getRangeLabelWidget());
//plot.getLayoutManager().remove(plot.getDomainLabelWidget());
plot.getDomainLabelWidget().setVisible(true);
}