我正在使用Androidplot创建我的图表。
我想使用
oneChart.setDomainStep(XYStepMode.INCREMENT_BY_VAL, 1); 命令,但每次我运行我的应用程序并想要绘制图形时,应用程序在黑屏后崩溃。如何解决这个问题?
在logcat中不会抛出异常或错误。
如果我使用SUBDIVIDE,一切工作正常。
更多代码:
XYPlot oneChart = (XYPlot) findViewById(R.id.oneChart);
XYSeries[] series = new SimpleXYSeries(
Arrays.asList(nX),
Arrays.asList(nY),
getTitle);
oneChart.disableAllMarkup();
oneChart.getGraphWidget().setMarginTop(10);
oneChart.getGraphWidget().setMarginRight(30);
oneChart.getGraphWidget().getGridBackgroundPaint().setColor(Color.LTGRAY);
oneChart.getGraphWidget().getGridLinePaint().setColor(Color.BLACK);
oneChart.getGraphWidget().getDomainOriginLinePaint().setColor(Color.BLACK);
oneChart.getGraphWidget().getRangeOriginLinePaint().setColor(Color.BLACK);
oneChart.getGraphWidget().getGridLinePaint().setPathEffect(new DashPathEffect(new float[]{1,1}, 1));
oneChart.getBorderPaint().setStrokeWidth(1);
oneChart.getBorderPaint().setAntiAlias(true);
oneChart.getBorderPaint().setColor(Color.LTGRAY);
LineAndPointFormatter seriesFormat = new LineAndPointFormatter(
Color.rgb(0, 0, 200), // line color
Color.rgb(0, 0, 100), // point color
Color.rgb(100, 100, 240)); // fill color (optional)
Paint lineFill = new Paint();
lineFill.setAlpha(200);
lineFill.setShader(new LinearGradient(0, 0, 0, 250, Color.WHITE, Color.BLUE, Shader.TileMode.CLAMP));
seriesFormat.setFillPaint(lineFill);
oneChart.addSeries(series, seriesFormat);发布于 2012-05-11 00:29:23
这句话似乎是对的。我已经测试过了。给我们提供更多的代码。
编辑:我已经使用一些随机值测试了您的代码,并包含了oneChart.setDomainStep(XYStepMode.INCREMENT_BY_VAL, 1);行。
一切看起来都很好。除了我改变的那件事
XYSeries[] series = new SimpleXYSeries(至
SimpleXYSeries series = new SimpleXYSeries (

以下是main.xml布局:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#FFFFFF">
<com.androidplot.xy.XYPlot android:id="@+id/oneChart"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:layout_marginTop="0px" android:layout_marginLeft="0px"
android:layout_marginRight="0px" title="My Plot" />
</LinearLayout>延迟响应的P.S.Sorry。
https://stackoverflow.com/questions/10530780
复制相似问题