# ArrayList of ellipses only draws the last ellipses to canvas

**URL:** <https://discourse.processing.org/t/arraylist-of-ellipses-only-draws-the-last-ellipses-to-canvas/8618>\
**Category:** Coding Questions\
**Created:** [February 22, 2019, 5:03am UTC](https://discourse.processing.org/t/arraylist-of-ellipses-only-draws-the-last-ellipses-to-canvas/8618 "2019-02-22T05:03:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bandit0311](https://avatars.discourse-cdn.com/v4/letter/b/e9bcb4/32.png) [@bandit0311](https://discourse.processing.org/u/bandit0311)\
**Post date:** [February 22, 2019, 5:03am UTC](https://discourse.processing.org/t/arraylist-of-ellipses-only-draws-the-last-ellipses-to-canvas/8618/1 "2019-02-22T05:03:06Z")

</div>

Im attempting to make a parallel coordinates plot. I have so far created the vertical axis for the graph and I have a class that each individual line is object of. I have all my line objects in an ArrayList container and iterate over the container and call the draw function for each object. My problem is that only the last object in the list is showing up on the canvas. I’ve debugged using println to see that the array does contain more than 1 object. I believe my problem lies within the array itself and how im trying to use it, since it the class objects functions are to simply just draw their points on the screen.  
I have called noloop() in the setup as well.

I fill the array like this  
the mapper utility is just a helper function that maps the value from the data from that min and max range to the height range of he canvas.

```auto
for(int i=0; i < myTable.getRowCount(); i++){
      
       TableRow row = myTable.getRow(i);
       
       for(int j=0; j < myTable.getColumnCount(); j++){
         float temp = mapperUtility(row.getFloat(j),minArray[j],maxArray[j]);
         tmp[j] = temp;     
       }
      
      lineList.add(new Coordinate_Line(x,tmp));
      //print the first value in the y array
      println(lineList.get(i).y[0]);
    }

```

then iterate over it like so

```auto

for(Coordinate_Line line : lineList){
        line.draw(); 
       }

```

Finally the class draw function iterates over the x&y coordinates and draws an ellipse like this:

```auto
void draw(){
    
    for(int i=0; i < x.length; ++i){
      fill(255,0,0);
      text(y[i],x[i],y[i] - 20);
      ellipse(x[i],y[i],radius,radius); 
   }
   
  }

```

**EDIT** i have created a wrapper class that is essentially an ArrayList class that processes my objects, this has fixed my problem as all the lines no are drawn, but im not entirely sure why this has fixed my problem.

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [February 22, 2019, 9:36am UTC](https://discourse.processing.org/t/arraylist-of-ellipses-only-draws-the-last-ellipses-to-canvas/8618/2 "2019-02-22T09:36:39Z")

</div>

how you call the class draw function?  
put in some println  
to know how the for loop is running ( how big x.length is )
