首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Androidplot: Increment_by_vals

Androidplot: Increment_by_vals
EN

Stack Overflow用户
提问于 2012-05-10 17:06:32
回答 1查看 778关注 0票数 1

我正在使用Androidplot创建我的图表。

我想使用

代码语言:javascript
复制
oneChart.setDomainStep(XYStepMode.INCREMENT_BY_VAL, 1); 

命令,但每次我运行我的应用程序并想要绘制图形时,应用程序在黑屏后崩溃。如何解决这个问题?

在logcat中不会抛出异常或错误。

如果我使用SUBDIVIDE,一切工作正常。

更多代码:

代码语言:javascript
复制
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);
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-05-11 00:29:23

这句话似乎是对的。我已经测试过了。给我们提供更多的代码。

编辑:我已经使用一些随机值测试了您的代码,并包含了oneChart.setDomainStep(XYStepMode.INCREMENT_BY_VAL, 1);行。

一切看起来都很好。除了我改变的那件事

代码语言:javascript
复制
XYSeries[] series = new SimpleXYSeries(

代码语言:javascript
复制
SimpleXYSeries series = new SimpleXYSeries (

以下是main.xml布局:

代码语言:javascript
复制
<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。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/10530780

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档