Stats: Links and ranks for legends

- only the top 8 ranks are displayed in line charts
- fixed some errors concerning chart color generation and legend ranking