# I need help with a table of dots

**URL:** <https://discourse.processing.org/t/i-need-help-with-a-table-of-dots/10063>\
**Category:** Coding Questions\
**Created:** [April 7, 2019, 11:27pm UTC](https://discourse.processing.org/t/i-need-help-with-a-table-of-dots/10063 "2019-04-07T23:27:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![chaps421](https://avatars.discourse-cdn.com/v4/letter/c/ed8c4c/32.png) [@chaps421](https://discourse.processing.org/u/chaps421)\
**Post date:** [April 7, 2019, 11:27pm UTC](https://discourse.processing.org/t/i-need-help-with-a-table-of-dots/10063/1 "2019-04-07T23:27:18Z")

</div>

i want to make a chart of dots with PGraphics but the last colum and row always disapear.

i want it to be dinamic and varieate the ise of the grid depending on the size of the window  
but it always seem to eat the last colum and row

any change i can do jut to make it apear? it doesnt have to be exactly the distance in that las one, just make it apear

```auto
PGraphics pg;
float origin=0;//just if i want to change the start of the grid
float dotx=origin;
float doty=origin;

//where i gues is the roblem
int col=int (width/100); //=6 colums 7 dots 
int row=int (height/100); //=6 rows 7 dots
float dx= width/col; //distance between point in x axis
float dy= height/row; //distance between point in y axis

void setup() {
  size(600, 600);
  pg = createGraphics(600, 600);
  pg.beginDraw();
  pg.background(100);
  pg.stroke(255);
  pg.endDraw();
  noLoop();
  
}

void draw() {
  
  pg.beginDraw();
  pg.strokeWeight(4);
  
  
  //table creation
  for (doty=origin;doty<height;doty+=dy){
    for(dotx=origin;dotx<width;dotx+=dx){
      pg.point(dotx,doty);
    }
  }
}

```

PD: i guess its because the point ends outside of the window and doesnt bother to draw it

---

<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:** [April 8, 2019, 4:18am UTC](https://discourse.processing.org/t/i-need-help-with-a-table-of-dots/10063/2 "2019-04-08T04:18:16Z")

</div>

pls format your above code posting  
using the

```auto
</> code formatter

```

* * *

i skip your

```auto
PGraphics pg;

```

way, but no problem with that.

pls find the optional AUTO adjustment to any area ( or canvas size )

```auto
// smart grid of points ( or rectangles), fit to area / canvas
int x = 20, y = x, w = x, h = w, offset = 0;
int grid = 7, many = grid*grid;
boolean auto = true;

void setup() {
  size(500, 300); // 
  stroke(0, 0, 200);
  fill(0, 200, 0);
  auto_scale(auto, width, height); // true / false / canvas or any aerea to fit in
}

void auto_scale(boolean scale, int wide, int high) { // autoscale w h
  if ( scale ) {
// w = (wide - 2*x)/grid - offset;
// h = (high - 2*y)/grid - offset;
    w = (wide - 2*x)/(grid-1) - offset; // only for the DOT version
    h = (high - 2*y)/(grid-1) - offset;
  }
  println("x "+x+" y "+y+" w "+w+" h "+h+" offset "+offset+" grid "+grid+" many "+many);
}

void draw() {
  background(200, 200, 0);
  for (int i = 0; i < many; i++) // rect(x+(i%grid)*(w+offset), y+(floor(i/grid))*(h+offset), w, h); // or any other shape/text on that position
// circle(x+(i%grid)*(w+offset), y+(floor(i/grid))*(h+offset),5);
      point(x+(i%grid)*(w+offset), y+(floor(i/grid))*(h+offset));
}

```

![SNAG-0063](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/7/75bba66664ac5c9ae8bd75d34d43bc47daf91d9e.jpeg)
