我正在使用 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);