0

In my application, I have been wanting to curve the lines connecting my datapoints using the GraphView library to give it a parabolic look. Currently, they are all sharp straight lines.

Is there any method in the GraphView library that allows curving the lines.

Or am I better off manually creating curved lines using Android SurfaceView and draw tools to overlay the GraphView?

All advice is appreciated, thanks.

CodeWizard
  • 128,036
  • 21
  • 144
  • 167
redlime9
  • 53
  • 1
  • 10

1 Answers1

0

I had a similar problem because my application plots quadratics, which as you know are curved. I ended up just creating a data set with data points that were very close to one another so the curve appeared to be curved even though it is just a sum of tiny little straight lines. Here is how you would generate that data set:

            double f, x = -1000;
            double iterations = 1000000;
            for (int i = 0; i < iterations; i++) {
                x = x + 0.1;
                f = Math.pow(x,2);
                series.appendData(new DataPoint(x, f), true, 1000000);
            }
            graph.addSeries(series);

If you can find a better way I would like to know because this is quite memory intensive.

mitch
  • 797
  • 8
  • 14
  • Thanks for the answer, I was wondering where I would input the x and y coordinates into this. In my program, the plot is not created at a single moment rather is created in real time while calculations are still going on. How could I implement this in such a case? Thanks again – redlime9 Apr 23 '16 at 21:40