We are about to switch to a new forum software. Until then we have removed the registration on this forum.
How can I add a bunch of points to a grafica layer and have it cut off at certain point, but then have it start drawing lines again later. This all has the be on the same plot layer. To help visualize my question look at this simple code:
import grafica.*;
GPlot plot;
GPointsArray myArray = new GPointsArray(0);
void setup() {
size(500, 500);
plot = new GPlot(this, 0, 0, 500, 500);
myArray.add(0, 0);
myArray.add(1, 1);
myArray.add(2, 2);
myArray.add(3, 3);
myArray.add(4, 4);
myArray.add(5, 5);
plot.setPoints(myArray);
plot.defaultDraw();
}
It creates this graph:
I need it to appear like this by "ending" the line at (2,2) and then start drawing again at (3,3):
I'm sure there's an easy way to pull this off that i'm not seeing...I imported a large data set and manually creating new layers for each cut off point seems unrealistic.
Answers
This confuses me. There must be something about your data that I'm not understanding from your example.
How do you know where these "certain point" cut-points should be if they aren't in your data set? If they are in your data set, why not just use them to generate layers?
@jeremydouglass My dataset displays the top 5 people for each time period. Depending on the period new people come in/out. Here's an example JSON:
Notice how "Jamie" was in the first object, but fell out of the list until the very last one and re-appeared.
The the graph will come out looking like in this video where people appear on the graph and end at certain times.
I hope that makes sense...thanks for your help
Ok I figured this out. Adding a NaN as a point will make grafica cut the line. So the solution to my first example would look like this:
Great. Thxs for sharing your answer.
Kf