rewrite events to contain item index and rewrite visualization to use this