class ScatterPlotPoint { private float sLength; // value private float sWidth; // dates private float pLength; // l1 private float pWidth; // l2 private String countries; // countries: seitosa, versicolor, virginica private int graphX; // x of graph private int graphY; // y of graph private float graphW; // width of graph private float graphH; // height of graph private String xAxis; // x Axis data private String yAxis; // y Axis data private float shapeSize; // shape size of dots private float changeSize;// change size of dots ScatterPlotPoint(float sWidth, float sLength, float pWidth, float pLength, String countries, String xAxis, String yAxis, float changeSize, float shapeSize) { this.sLength = sLength; // make variables that are called equal the variables here this.sWidth = sWidth; this.pLength = pLength; this.pWidth = pWidth; this.countries = countries; this.xAxis = xAxis; this.yAxis = yAxis; this.changeSize = changeSize; this.shapeSize = shapeSize; } //grab graph data and assign to graphX, graphY, graphW and graphH variables void getGraphData(int x, int y, float w, float h) { graphX = x; graphY = y; graphW = w; graphH = h; } void plot(int xscaleFactor, int yscaleFactor) { pushMatrix(); translate(graphX, graphY); // push graph to start at graphX, graphY stroke(255); // white stroke around ellipses to distinguish them if (changeSize == 1){ shapeSize = 0.75; //make small size }else if (changeSize == 2){ shapeSize = 1; //make medium size }else { shapeSize = 1.5; //make large size } if (countries.equals("setosa")) { fill(50, 205, 50, 128); //dark green } else if (countries.equals("versicolor")) { fill(160, 82, 45, 128); //dark orange } else if (countries.equals("virginica")) { fill(138, 43, 226, 128); // dark purple } float x = 0; float y = 0; if (xAxis.equals("dates")) { x = sWidth; } else if (xAxis.equals("value")) { x = sLength; } else if (xAxis.equals("l2")) { x = pWidth; } else if (xAxis.equals("l1")) { x = pLength; } if (xAxis.equals("dates")) { x = sWidth; } else if (xAxis.equals("value")) { x = sLength; } else if (xAxis.equals("l2")) { x = pWidth; } else if (xAxis.equals("l1")) { x = pLength; } //plotting data on Y Axis if (yAxis.equals("dates")) { y = sWidth; } else if (yAxis.equals("value")) { y = sLength; } else if (yAxis.equals("l2")) { y = pWidth; } else if (yAxis.equals("l1")) { y = pLength; } if (yAxis.equals("dates")) { y = sWidth; } else if (yAxis.equals("value")) { y = sLength; } else if (yAxis.equals("l2")) { y = pWidth; } else if (yAxis.equals("l1")) { y = pLength; } if(xAxis.equals("dates")) { xscaleFactor=60; } if(yAxis.equals("dates")) { yscaleFactor=60; } if(xAxis.equals("l2")) { xscaleFactor=90; } if(yAxis.equals("l2")) { yscaleFactor=90; } // scalefactor of 30 and set size of 10x10 but if user changes size, multiply it by that factor ellipse(x*xscaleFactor, -y*yscaleFactor, 10*shapeSize, 10*shapeSize); /* fill(0); // black dot test where (4, -3) is on graph as black dot ellipse(4*scaleFactor, -3*scaleFactor, 10, 10);*/ popMatrix(); // clear previous matrix } }