Dynamic amount of lines in line chart


I would like to have a line graph in grafana in which the amounts of lines is dynamically determined. Now I see that if I have a line graph then I have to statically tell grafana how many lines and what labels they should have. I would like it to determine it based on a datasource. Ideally the datasource would be my REST API (i tried the simple json plugin but when creating a graph I have to pick how many lines from the api will always be displayed) but any other way I could take under consideration. Is it even possible?

To make it clearer let me paint an example: my API measures the speed of multiple cars in time, but the amount of cars is dynamic. In one point in time there might be 5 cars that are measured but at another there might be 10 cars, all have an identification number that would also by dynamically provided (not from a small pool of numbers). I would like to plot a graph where the speed of each car in time is plotted if it was measured in that point in time. From what I see at this point the only way to make a line graph like this is that I would have to set a static number of cars that might be measured at all times.