Added code to generate CSV data for visualization.