Need help with solving ArrayIndexOutOfBoundsException:-1
in
Contributed Library Questions
•
2 years ago
I am trying to create a scatter plot diagram but I am stuck half way through. The error message(
ArrayIndexOutOfBoundsException:-1) seems to arise from the line in 30.
I cant seem to figure out what the problem is, any help would be much appreciated.
- import org.gicentre.utils.stat.*; // For chart classes.
- import org.gicentre.utils.colour.*; // For colour tables.
- XYChart scatterplot; // The data chart.
- float[] colours; // Point colours.
- void setup()
- {
- size(400,400);
- smooth();
- scatterplot = new XYChart(this);
- readData(2,3,scatterplot); // Read data from columns 1 and 3.
- // Set up scatterplot's appearance.
- scatterplot.setMinX(0);
- scatterplot.setMinY(0);
- scatterplot.showXAxis(true);
- scatterplot.showYAxis(true);
- scatterplot.setXAxisLabel(">15");
- scatterplot.setYAxisLabel("<15");
- ColourTable cTable = ColourTable.getPresetColourTable(ColourTable.ACCENT_3);
- scatterplot.setPointColour(colours,cTable);
- scatterplot.setPointSize(5);
- }
- void draw()
- {
- background(255);
- scatterplot.draw(10,10,width-20,height-20);
- }
1