1

I'm using graph view to draw an inputted quadratic function. I'd like to only include numbers on the axes where the curve intercepts them. Here is my code:

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);
}

I understand that I can remove all labels on the axes using:

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

If this isn't possible, I don't mind leaving the regular labels on but I need to label the intercepts. My application already calculates the intercepts so I have all the values, I just need to display them.

Example of when I run it:
Example of when I run it

Tom Luther
  • 11
  • 5

0 Answers0