So I have a project due tomorrow, and this is one of the last hurdles. I have a large graph being drawn in my program that can show every country in the world, or filter them out. The polygons being drawn represent one country each, and the plotting values come from datasheets
The problem is that there are 231 countries and regions that the user can choose to see. I have tried to use a wide range of colors to distinguish each country from the other, but with such a huge number to fill, a lot of the countries' colors look the same. Also, each graphed shape has 32 vertices on it, so I don't know if such an odd shape can have a texture applied to it or not...
Anyways, I figured that I would diversify the graphed data and add five different patterns, working with a range of different colors, to represent each country. So I made the patterns, all with an alpha channel, hoping that I could easily apply the pattern PNG images to the drawn polygons. Here is the code so far...
noStroke();
beginShape();
textureMode(NORMAL);
texture(patternToUse);
for(int col = 0; col < columnCount; col++){
if( data.isValid(countryToGraph, col)){
float value = interpolators[countryToGraph][col].value;
float x = map(years[col], yearMin, yearMax, graphPlotX1, graphPlotX2);
float y = map(value, dataMin, graphMax, graphPlotY2, graphPlotY1);
vertex(x, y, 0, 0);
if((col == 0) || (col == columnCount -1))
vertex(x, y, 1, 0);
}
}
//draw the lower-right and lower-left corners
vertex(graphPlotX2, graphPlotY2, 1, 1);
vertex(graphPlotX1, graphPlotY2, 0, 1);
endShape(CLOSE);
I'm not getting an error here; the graphs just aren't drawing at all. I should mention that there is a conditional prior to this that just checks to see if the current row index applies to countries that I want to have a pattern on their graph, but I don't think that's the issue. Any suggestions? Should I be using texture for this? I tried to find a guide to masking by PhilHo, but it has been taken down, and I'm not sure what masking is.
1