Improved occurences chart query