$rhash->{'group'} = $gst;
}
}
+ # Values for TT rendering
$c->stash->{variants} = $t->{'variants'};
$c->stash->{total} = $t->{'variant_count'};
$c->stash->{genealogical} = $t->{'genealogical_count'};
- $c->stash->{conflict} = $t->{'conflict_count'};
+ $c->stash->{conflict} = $t->{'conflict_count'};
+ # Also make a JSON stash of the data for the statistics tables
+ $c->stash->{reading_statistics} = to_json( $t->{'variants'} );
} else {
$c->stash->{error} = 'Tradition ' . $tradition->name
. 'has no stemma for analysis.';
var colors = ['#ffeeaa','#afc6e9','#d5fff6','#ffccaa','#ffaaaa','#e5ff80','#e5d5ff','#ffd5e5'];
var row_triggered = false;
-$(document).ready(function() {
- $('.rowid').click( function() {
+
+function color_row( row ) {
row_triggered = true;
$('ellipse').attr( {stroke:'white', fill:'#fff'} );
$('.node').children('polygon').attr( {stroke:'#fff', fill:'#fff'} );
$('.node').children('text').attr( {stroke:'none', fill:'#000'} );
$('tr.active_variant_row').children('td').removeClass('cellb0 cellb1 cellb2 cellb3 cellb4 cellb5 cellb6 cellb7');
- $(this).parent().nextAll('.clickable').children('span').click();
+ row.parent().nextAll('.clickable').children('span').click();
$('td.active_variant_cell').removeClass('active_variant_cell');
row_triggered = false;
- });
- $('svg').width('485px');
-})
+}
+
function color_nodes( column_index, arr_node_ids, arr_greynode_ids ) {
if( !row_triggered ) {
$('tr.active_variant_row').children('td').removeClass('cellb0 cellb1 cellb2 cellb3 cellb4 cellb5 cellb6 cellb7');
-[% PROCESS header.tt
+[% WRAPPER header.tt
pagetitle = "Stexaminer - $text_title"
applicationjs = c.uri_for('/js/stexaminer.js')
applicationstyle = c.uri_for('/css/stexaminer.css')
%]
+<script type="text/javascript">
+var readingstats = [% reading_statistics %];
+function show_stats( row_index ) {
+ var rs = readingstats[row_index];
+ var rshtml = $('#stats_template').clone();
+ rshtml.find('#statrank').append( rs.id );
+ $('#row_statistics').empty();
+ $('#row_statistics').append( rshtml.contents() );
+};
+</script>
+[% END -%]
<h1>Stexaminer</h1>
<h2>[% text_title %]</h2>
- <div id="statistics">
- <p>Analyzed [% total %] variant locations, of which [% genealogical %] entirely followed the stemma. [% conflict %] readings conflicted with the stemma.</p>
- </div>
<div id="variants_table">
<table>
[% FOREACH row IN variants -%]
<div id="stemma_graph">
[% svg %]
</div>
+ <div id="row_statistics">
+ <h3>Aggregate text statistics</h3>
+ <ul>
+ <li>Total number of variant locations analyzed: [% total %]</li>
+ <li>Number of fully genealogical locations: [% genealogical %]</li>
+ <li>Number of readings that conflict with the stemma: [% conflict %]</li>
+ </ul>
+ <p>(Choose a row in the table to display statistics about individual readings.)</p>
+ </div>
+ <div id="stats_template">
+ <h3>Statistics for readings at <span id="statrank"></span></h3>
+ </div>
+
[% PROCESS footer.tt %]
[% SET rowclass = 'class="genealogical"' IF row.genealogical -%]
[% SET rowclass = 'class="coincidental"' UNLESS row.genealogical -%]
<tr [% rowclass %]>
- <th><span class="rowid">[% row.id %]</span></th>
+ <th><span class="rowid" onclick="color_row($(this));show_stats($(this).parent().parent().index())">[% row.id %]</span></th>
[% FOREACH reading IN row.readings -%]
[% SET cellclass = 'clickable conflict' IF reading.conflict -%]
[% SET cellclass = 'clickable' IF !reading.conflict -%]