Rewrote data collection for sparkline, so it can also handle the absence of a key column.
Also it can now handle if the key column has higher index than the value columns.

But this should be way simpler, the code is a bit verbose.