-1

I have two double ArrayList (ArrayList) how can I pass these arrayLists to GraphView to draw my linear chart? for limited points we can use these codes :

GraphView graph = (GraphView) findViewById(R.id.graph);
LineGraphSeries<DataPoint> series = new LineGraphSeries<DataPoint>(new   DataPoint[] {
      new DataPoint(0, 1),
      new DataPoint(1, 5),
      new DataPoint(2, 3),
      new DataPoint(3, 2),
      new DataPoint(4, 6)
});

but my ArrayLists have thousands points!

Sathish Kumar J
  • 4,280
  • 1
  • 20
  • 48

2 Answers2

0

You can do like,

LineGraphSeries<DataPoint> series = new LineGraphSeries<DataPoint>(new   DataPoint[] {
  new DataPoint(X[0], Y[0]),
  new DataPoint(X[1], Y[1]),
  new DataPoint(X[2], Y[2]),
  new DataPoint(X[3], Y[3]),
  new DataPoint(X[4], Y[4])
});

OR

If u have bulk of data means use `for loop`

this may helps you.

Sathish Kumar J
  • 4,280
  • 1
  • 20
  • 48
0

If you want to populate the LineGraphSeries with 1000 point then you should consider to define a list and pass this when you construct the object of the LineGraphSeries class

Example

List<DataPoint> myPointList = ....
LineGraphSeries<DataPoint> series = new LineGraphSeries<DataPoint>(Arrays.asList(myPointList));
....
Community
  • 1
  • 1
ΦXocę 웃 Пepeúpa ツ
  • 47,427
  • 17
  • 69
  • 97