Skip to content

Commit

Permalink
Draft for a basic timeline visualization
Browse files Browse the repository at this point in the history
  • Loading branch information
thvitt committed May 8, 2019
1 parent 22458ef commit cd0a806
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/macrogen/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -1174,6 +1174,26 @@ def _dating_table():
return stat, dating_stat, edge_df


def report_timeline(info: MacrogenesisInfo):
refs = info.order_refs()
data = [dict(start=ref.earliest.isoformat(), end=ref.latest.isoformat(),
content=_fmt_node(ref))
for ref in refs
if ref.earliest > EARLIEST and ref.latest < LATEST]
(config.path.report_dir / 'timeline.html').write_text(f"""
<html><head><title>Zeitstrahl</title>
<script src="//unpkg.com/timeline-plus/dist/timeline.js"></script>
<link href="//unpkg.com/timeline-plus/dist/timeline.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="timeline">Lade Zeitstrahl ...</div>
<script>
const Timeline = new timeline.Timeline(document.getElementById('timeline'), {json.dumps(data)});
</script>
</body></html>
""")


def report_inscriptions(info: MacrogenesisInfo):
# all documents that have inscriptions in their textual transcript
from .witnesses import all_documents
Expand Down

0 comments on commit cd0a806

Please sign in to comment.