| import plotly.express as px | |
| import pandas as pd | |
| def generate_chart(analysis_option, data): | |
| if analysis_option == "Employee Satisfaction": | |
| return px.bar(data, x="DepartmentType", y="Satisfaction Score", | |
| title="Satisfaction Score by Department", color="DepartmentType") | |
| elif analysis_option == "Department Performance": | |
| return px.line(data, x="DepartmentType", y=["Performance Score", "Current Employee Rating"], | |
| title="Departmental Performance Trends", markers=True) | |
| elif analysis_option == "Training Analytics": | |
| return px.bar(data, x="Training Program Name", y="Training Outcome", | |
| title="Training Participation by Program", color="Training Program Name") | |
| elif analysis_option == "Cost-Benefit Analysis": | |
| return px.scatter(data, x="DepartmentType", y="ROI", title="ROI by Department", size="ROI") | |
| elif analysis_option == "Training Effectiveness": | |
| return px.bar(data, x="Training Program Name", y="Performance Score", | |
| title="Training Effectiveness by Program", color="Training Program Name") | |
| elif analysis_option == "Diversity & Inclusion": | |
| return px.bar(data, x="Category", y="Count", color="Group", | |
| title="Diversity & Inclusion Breakdown", barmode="stack") | |
| elif analysis_option == "Career Development": | |
| return px.histogram(data, x="Career Movements", title="Career Progression Histogram") | |
| return None | |