Create visualization.py
Browse files- visualization.py +36 -0
visualization.py
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import plotly.graph_objects as go
|
| 2 |
+
import random
|
| 3 |
+
|
| 4 |
+
def create_comparison_chart(user_data):
|
| 5 |
+
categories = ['Team Strength', 'Market Potential', 'Mission Clarity', 'Innovation', 'Scalability']
|
| 6 |
+
|
| 7 |
+
# Generate random scores for the user's company and a top-tier company
|
| 8 |
+
user_scores = [random.uniform(0.3, 0.9) for _ in range(len(categories))]
|
| 9 |
+
top_tier_scores = [random.uniform(0.7, 1.0) for _ in range(len(categories))]
|
| 10 |
+
|
| 11 |
+
fig = go.Figure()
|
| 12 |
+
|
| 13 |
+
fig.add_trace(go.Scatterpolar(
|
| 14 |
+
r=user_scores,
|
| 15 |
+
theta=categories,
|
| 16 |
+
fill='toself',
|
| 17 |
+
name='Your Company'
|
| 18 |
+
))
|
| 19 |
+
|
| 20 |
+
fig.add_trace(go.Scatterpolar(
|
| 21 |
+
r=top_tier_scores,
|
| 22 |
+
theta=categories,
|
| 23 |
+
fill='toself',
|
| 24 |
+
name='Top-Tier Company'
|
| 25 |
+
))
|
| 26 |
+
|
| 27 |
+
fig.update_layout(
|
| 28 |
+
polar=dict(
|
| 29 |
+
radialaxis=dict(
|
| 30 |
+
visible=True,
|
| 31 |
+
range=[0, 1]
|
| 32 |
+
)),
|
| 33 |
+
showlegend=True
|
| 34 |
+
)
|
| 35 |
+
|
| 36 |
+
return fig
|