File size: 1,847 Bytes
82d9c75
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import plotly.graph_objects as go
from typing import List, Dict, Any

def create_map_visualization(locations: List[Dict[str, Any]]) -> go.Figure:
  fig = go.Figure()

  # Add markers for each location
  fig.add_trace(go.Scattergeo(
      lon=[loc["longitude"] for loc in locations],
      lat=[loc["latitude"] for loc in locations],
      text=[loc["place_name"] for loc in locations],
      mode="markers+text",
      marker=dict(size=10, color="red"),
      textposition="top center"
  ))

  # Update layout
  fig.update_layout(
      geo=dict(
          scope="world",
          showland=True,
          showcountries=True,
          landcolor="rgb(243, 243, 243)",
          countrycolor="rgb(204, 204, 204)"
      ),
      title="Historical Art Locations",
      height=600
  )

  return fig

def create_timeline_visualization(timeline_data: Dict[str, Any]) -> go.Figure:
  fig = go.Figure()

  # Add period span
  fig.add_trace(go.Scatter(
      x=[timeline_data["start_year"], timeline_data["end_year"]],
      y=[1, 1],
      mode="lines+markers",
      name=timeline_data["period_name"],
      line=dict(width=20, color="rgb(100, 100, 200)")
  ))

  # Add historical events
  event_years = list(range(
      timeline_data["start_year"],
      timeline_data["end_year"],
      (timeline_data["end_year"] - timeline_data["start_year"]) // len(timeline_data["events"])
  ))
  
  fig.add_trace(go.Scatter(
      x=event_years[:len(timeline_data["events"])],
      y=[1.2] * len(timeline_data["events"]),
      mode="markers+text",
      text=timeline_data["events"],
      textposition="top center",
      marker=dict(size=8, color="red")
  ))

  # Update layout
  fig.update_layout(
      title="Historical Timeline",
      showlegend=False,
      height=400,
      yaxis=dict(visible=False),
      xaxis=dict(title="Year")
  )

  return fig