GraphView仅绘制特定点处的特定轴标签

时间:2017-07-23 16:26:27

标签: android android-graphview

我使用图表视图绘制输入的二次函数。 我想只在曲线截取它们的轴上包含数字。 这是我的代码:

private GraphView graph;
protected void Solve(View view)
{
    graph = (GraphView) findViewById(R.id.graph);
    graph.removeAllSeries();

    double x,y;

    LineGraphSeries<DataPoint> curve = new LineGraphSeries<DataPoint>();
    for(x=-10; x<10; x+= 0.1) {
        y = (A*x*x)+(B*x)+C; // A B and C are values input by the user.
        curve.appendData(new DataPoint(x, y), false, 200);
    }
    graph.addSeries(curve);
}

我知道我可以使用以下方法删除轴上的所有标签:

graph.getGridLabelRenderer().setVerticalLabelsVisible( false );
graph.getGridLabelRenderer().setHorizontalLabelsVisible( false );

如果这是不可能的,我不介意留下常规标签,但我需要标记拦截。我的应用程序已经计算了截距,所以我有所有的值,我只需要显示它们。

我运行它的例子:
Example of when I run it

0 个答案:

没有答案
相关问题