So I have this code which takes data from an array and draws a curve:

- void drawDataLine(int row) {
- beginShape();
- for (int col = 0; col < colCount; col++) {
- if (data.isValid(row, col)) {
- float value = data.getPoint(row, col);
- float x = map(years[col], yearMin, yearMax, plotX1, plotX2);
- float y = map(value, dataMin, dataMax, plotY2, plotY1);
- //vertex(x,y) ;
- curveVertex(x, y);
- // Double the curve points for the start and stop
- if ((col == 0) || (col == colCount-1)) {
- curveVertex(x, y);
- }
- }
- }
- endShape();
- }

- for (int col = 0; col < colCount; col++) {
- if (data.isValid(row, col)) {
- float radVal = ratio[col];
- float value = data.getPoint(row, col);
- float compareValue = compare.getPoint(row, col);
- float x = map(years[col], yearMin, yearMax, plotX1, plotX2);
- float y = map(value, dataMin, dataMax, plotY2, plotY1);
- float ellipse1MapVal = map(value, ellipse1Min, ellipse1Max, 10, 80);
- float ellipse2MapVal = map(compareValue, ellipse1Min, ellipse1Max, 10, 80);
- radVal = map(radVal, radMin, radMax, 1, 7);
- if (dist(mouseX, mouseY, x, y) < 3) {
- if (drawCirclesPrimary || drawCirclesSecondary) {
- noStroke();
- if (drawCirclesPrimary) {
- fill(0, 255, 0, 100);
- ellipse(x, y, ellipse1MapVal, ellipse1MapVal);
- }
- if (drawCirclesSecondary) {
- fill(255, 0, 0, 100);
- ellipse(x, y, ellipse2MapVal, ellipse2MapVal);
- }
- fill(0);
- stroke(0);
- pushMatrix();
- translate(x, y);
- rotate(radians(radSec));
- line(0, -ellipse1MapVal/2, 0, ellipse1MapVal/2);
- popMatrix();
- radSec += radVal;
- textSize(10);
- textAlign(CENTER);
- text(nf(value, 0, 2) + " (" + years[col] + ")"+nf(compareValue, 0, 2), x, y-8);
- }
- else
- text(nf(value, 0, 2) + " (" + years[col] + ")", x, y-8);
- }
- if ((mouseX < x+3)&&(mouseX > x-3))
- {
- stroke(150);
- strokeWeight(1);
- line(x, plotY1, x, plotY2);
- } } }}

Regards

1