Changeset 35071


Ignore:
Timestamp:
2021-04-15T00:44:15+12:00 (3 years ago)
Author:
davidb
Message:

Initial cut at having a TreeMap showing Jury/Tele voting differences

Location:
main/trunk/model-sites-dev/eurovision-lod/collect/eurovision
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/js/dataviz.js

    r35039 r35071  
    6969    $('#ssv-voting-dataflow-jury-endyear').autocomplete({source: all_esc_years});
    7070   
    71     $('#ssv-voting-dataflow-tele-startyear').autocomplete({source: ["2018", "2019"]});
    72     $('#ssv-voting-dataflow-tele-endyear').autocomplete({source: ["2018", "2019"]});
     71    $('#ssv-voting-dataflow-tele-startyear').autocomplete( {source: ["2016", "2017", "2018", "2019"]} );
     72    $('#ssv-voting-dataflow-tele-endyear').autocomplete(   {source: ["2016", "2017", "2018", "2019"]} );
     73
     74    $('#ssv-jury-tele-diff-tocountry').autocomplete({source: esc_countries});
     75    $('#ssv-jury-tele-diff-inyear').autocomplete({source: ["2016", "2017", "2018", "2019"]});
    7376})
     77
     78
     79
     80function ssq_load(query_text_id)
     81{
     82    $('#sample-sparql-query').val($('#'+query_text_id).text().trim());
     83    $('.exec-ssq').hide();
     84    $('#exec-'+query_text_id).show();
     85}
     86
     87function ssq_execute()
     88{   
     89    $('#sample-sparql-query-form').submit();
     90}
     91
     92
     93
     94
     95function ssv_load(query_text_id)
     96{
     97    var sample_data_sgvizler_query = $('#'+query_text_id).text().trim();
     98    $('#sample-data-sgvizler-query').val(sample_data_sgvizler_query);   
     99
     100    if ($('#'+query_text_id+"-chart").length>0) {
     101    // Override existing val with custom value
     102        $('#sample-data-sgvizler-chart').val($('#'+query_text_id+"-chart").text().trim());
     103    }
     104   
     105    if ($('#'+query_text_id+"-chart-options").length>0) {
     106    // Override existing val with custom value
     107        $('#sample-data-sgvizler-chart-options').val($('#'+query_text_id+"-chart-options").text().trim());
     108    }
     109   
     110    if ($('#'+query_text_id+"-div-style").length>0) {
     111    // Override existing val with custom value
     112        $('#sample-div-style').val($('#'+query_text_id+"-div-style").text().trim());
     113    }
     114    else {
     115    $('#sample-div-style').val($('#ssv-orig-div-style').text().trim());
     116    }
     117
     118    $('.exec-ssq').hide();
     119    $('#exec-'+query_text_id).show();
     120}
     121
     122
     123
     124function ssv_execute(query_text_id)
     125{
     126    if (query_text_id) {
     127    var sample_data_sgvizler_query = $('#'+query_text_id).text().trim();
     128
     129    if ($('#'+query_text_id+"-startyear").length>0) {
     130        var start_year = $('#'+query_text_id+"-startyear").val();
     131        sample_data_sgvizler_query = sample_data_sgvizler_query.replace(/\*\*startyear\*\*/g,start_year);
     132    }
     133   
     134    if ($('#'+query_text_id+"-endyear").length>0) {
     135        var end_year = $('#'+query_text_id+"-endyear").val();
     136        sample_data_sgvizler_query = sample_data_sgvizler_query.replace(/\*\*endyear\*\*/g,end_year);
     137    }
     138
     139    if ($('#'+query_text_id+"-inyear").length>0) {
     140        var in_year = $('#'+query_text_id+"-inyear").val();
     141        sample_data_sgvizler_query = sample_data_sgvizler_query.replace(/\*\*inyear\*\*/g,in_year);
     142    }
     143
     144    if ($('#'+query_text_id+"-tocountry").length>0) {
     145        var to_country = $('#'+query_text_id+"-tocountry").val();
     146        to_country = to_country.replace(/^the\s+/i,"");
     147        sample_data_sgvizler_query = sample_data_sgvizler_query.replace(/\*\*tocountry\*\*/g,to_country);
     148    }
     149   
     150    $('#sample-data-sgvizler-query').val(sample_data_sgvizler_query);
     151    }
     152   
     153   
     154    var sgvizler_div_raw_text = $('#sample-sgvizler-div').val();
     155
     156    var data_sgvizler_endpoint      = $('#sample-data-sgvizler-endpoint').val().trim();
     157    var data_sgvizler_chart         = $('#sample-data-sgvizler-chart').val().trim();
     158    var data_sgvizler_chart_options = $('#sample-data-sgvizler-chart-options').val().trim();
     159
     160    var div_style = $('#sample-div-style').val();
     161
     162    var $sgvizler_div2 = $('<div>').attr("id","sgvizler-div");
     163    $sgvizler_div2.attr("data-sgvizler-endpoint",data_sgvizler_endpoint);
     164    $sgvizler_div2.attr("data-sgvizler-chart",data_sgvizler_chart);
     165    $sgvizler_div2.attr("data-sgvizler-chart-options",data_sgvizler_chart_options);
     166    $sgvizler_div2.attr("data-sgvizler-log","2");
     167   
     168    $sgvizler_div2.attr("style",div_style);
     169
     170    var data_sgvizler_query_raw_text = $('#sample-data-sgvizler-query').val();
     171    $sgvizler_div2.attr('data-sgvizler-query',data_sgvizler_query_raw_text);
     172
     173    $('#sgvizler-div-outer').empty().append($sgvizler_div2);
     174   
     175    sgvizler2.containerDraw('sgvizler-div');
     176
     177    var url = window.location.href;
     178    window.location.href = url + "#sgvizler-plot";
     179    history.replaceState(null,null,url);
     180}
  • main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/js/eurovision.js

    r35063 r35071  
    1717    "UnitedKingdom":               "United Kingdom",
    1818};
     19
     20
     21var esc_countries = [
     22    "Albania",
     23    "Andorra",
     24    "Armenia",
     25    "Australia",
     26    "Austria",
     27    "Azerbaijan",
     28    "Belarus",
     29    "Belgium",
     30    "Bosnia and Herzegovina",
     31    "Bulgaria",
     32    "Croatia",
     33    "Cyprus",
     34    "Czech Republic",
     35    "Denmark",
     36    "Estonia",
     37    "Finland",
     38    "France",
     39    "Georgia",
     40    "Germany",
     41    "Greece",
     42    "Hungary",
     43    "Iceland",
     44    "Ireland",
     45    "Israel",
     46    "Italy",
     47    "Latvia",
     48    "Lithuania",
     49    "Luxembourg",
     50    "Macedonia",
     51    "Malta",
     52    "Moldova",
     53    "Monaco",
     54    "Montenegro",
     55    "Morocco",
     56    "The Netherlands",
     57    "North Macedonia",
     58    "Norway",
     59    "Poland",
     60    "Portugal",
     61    "Romania",
     62    "Russia",
     63    "San Marino",
     64    "Serbia",
     65    "Serbia and Montenegro",
     66    "Slovakia",
     67    "Slovenia",
     68    "Spain",
     69    "Sweden",
     70    "Switzerland",
     71    "Turkey",
     72    "Ukraine",
     73    "United Kingdom",
     74    "Yugoslavia",
     75];
     76
     77
     78
    1979
    2080function transpose_i(i,num_cols,num_rows,num_countries)
     
    160220    var votes_country_json_type = "VotesCountryJSON-" + vote_type;
    161221    var votes_points_json_type = "VotesPointsJSON-" + vote_type;
    162     var vote_label = (vote_type == "J") ? "Jury votes" : "Televotes";
     222    var vote_label;
     223    if (vote_type == "J") {
     224        vote_label = "Jury votes";
     225    }
     226    else if (vote_type == "T") {
     227        vote_label = "Televotes";
     228    }
     229    else {
     230        vote_label = "Separate Jury and Televotes Added Together";
     231    }
    163232   
    164233    var $vote_div = $('<div>').attr("class","voting-label").append(vote_label);
     
    239308     
    240309
    241 
    242 function ssq_load(query_text_id)
    243 {
    244     $('#sample-sparql-query').val($('#'+query_text_id).text().trim());
    245     $('.exec-ssq').hide();
    246     $('#exec-'+query_text_id).show();
    247 }
    248 
    249 function ssq_execute()
    250 {   
    251     $('#sample-sparql-query-form').submit();
    252 }
    253 
    254 
    255 
    256 
    257 function ssv_load(query_text_id)
    258 {
    259     var sample_data_sgvizler_query = $('#'+query_text_id).text().trim();
    260     $('#sample-data-sgvizler-query').val(sample_data_sgvizler_query);   
    261 
    262     if ($('#'+query_text_id+"-chart").length>0) {
    263     // Override existing val with custom value
    264         $('#sample-data-sgvizler-chart').val($('#'+query_text_id+"-chart").text().trim());
    265     }
    266    
    267     if ($('#'+query_text_id+"-chart-options").length>0) {
    268     // Override existing val with custom value
    269         $('#sample-data-sgvizler-chart-options').val($('#'+query_text_id+"-chart-options").text().trim());
    270     }
    271    
    272     if ($('#'+query_text_id+"-div-style").length>0) {
    273     // Override existing val with custom value
    274         $('#sample-div-style').val($('#'+query_text_id+"-div-style").text().trim());
    275     }
    276     else {
    277     $('#sample-div-style').val($('#ssv-orig-div-style').text().trim());
    278     }
    279 
    280     $('.exec-ssq').hide();
    281     $('#exec-'+query_text_id).show();
    282 }
    283 
    284 
    285 
    286 function ssv_execute(query_text_id)
    287 {
    288     if (query_text_id) {
    289     var sample_data_sgvizler_query = $('#'+query_text_id).text().trim();
    290 
    291     if ($('#'+query_text_id+"-startyear").length>0) {
    292         var start_year = $('#'+query_text_id+"-startyear").val();
    293         sample_data_sgvizler_query = sample_data_sgvizler_query.replaceAll("**startyear**",start_year);
    294     }
    295    
    296     if ($('#'+query_text_id+"-endyear").length>0) {
    297         var end_year = $('#'+query_text_id+"-endyear").val();
    298         sample_data_sgvizler_query = sample_data_sgvizler_query.replaceAll("**endyear**",end_year);
    299     }
    300    
    301     $('#sample-data-sgvizler-query').val(sample_data_sgvizler_query);
    302     }
    303    
    304    
    305     var sgvizler_div_raw_text = $('#sample-sgvizler-div').val();
    306 
    307     var data_sgvizler_endpoint      = $('#sample-data-sgvizler-endpoint').val().trim();
    308     var data_sgvizler_chart         = $('#sample-data-sgvizler-chart').val().trim();
    309     var data_sgvizler_chart_options = $('#sample-data-sgvizler-chart-options').val().trim();
    310 
    311     var div_style = $('#sample-div-style').val();
    312 
    313     var $sgvizler_div2 = $('<div>').attr("id","sgvizler-div");
    314     $sgvizler_div2.attr("data-sgvizler-endpoint",data_sgvizler_endpoint);
    315     $sgvizler_div2.attr("data-sgvizler-chart",data_sgvizler_chart);
    316     $sgvizler_div2.attr("data-sgvizler-chart-options",data_sgvizler_chart_options);
    317     $sgvizler_div2.attr("data-sgvizler-log","2");
    318    
    319     $sgvizler_div2.attr("style",div_style);
    320 
    321     var data_sgvizler_query_raw_text = $('#sample-data-sgvizler-query').val();
    322     $sgvizler_div2.attr('data-sgvizler-query',data_sgvizler_query_raw_text);
    323 
    324     $('#sgvizler-div-outer').empty().append($sgvizler_div2);
    325    
    326     sgvizler2.containerDraw('sgvizler-div');
    327 
    328     var url = window.location.href;
    329     window.location.href = url + "#sgvizler-plot";
    330     history.replaceState(null,null,url);
    331 }
  • main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/transform/dataviz/voting-dataflow-tele.xsl

    r35056 r35071  
    5353<!-- -->
    5454<xsl:text>
    55 title=Dataflow Analysis of Televoting by Country (2018-2019)|height=1200|chartArea.height=1100|fontSize=11
     55title=Dataflow Analysis of Televoting by Country (2016-2019)|height=1200|chartArea.height=1100|fontSize=11
    5656</xsl:text>
    5757        </div>
  • main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/transform/pages/document.xsl

    r35065 r35071  
    6363          Jury
    6464        </gsf:when>
     65        <gsf:when test="equals" test-value="T">
     66          Televotes
     67        </gsf:when>
    6568        <gsf:otherwise>
    66           Televotes
     69          Separate Jury and Televotes Added Together
    6770        </gsf:otherwise>
    6871          </gsf:switch>
  • main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/transform/pages/sgvizler.xsl

    r35067 r35071  
    2222    <xsl:include href="dataviz/voting-dataflow-jury.xsl"/>
    2323    <xsl:include href="dataviz/voting-dataflow-tele.xsl"/>
     24    <xsl:include href="dataviz/jury-tele-diff.xsl"/>
    2425    <xsl:include href="dataviz/draw-bias.xsl"/>
    2526    <xsl:include href="dataviz/draw-bias-normalized.xsl"/>
     
    263264        <xsl:call-template name="ssv-voting-dataflow-jury"/>
    264265        <xsl:call-template name="ssv-voting-dataflow-tele"/>
     266        <xsl:call-template name="ssv-jury-tele-diff"/>
    265267        <xsl:call-template name="ssv-draw-bias"/>
    266268        <xsl:call-template name="ssv-draw-bias-normalized"/>
     
    378380
    379381          <li>
     382        <b>Differences between Jury and Televoting:</b><br/>
     383        <div>
     384          <button type="button" class="load-ssq" id="load-ssv-jury-tele-diff" onclick="ssv_load('ssv-jury-tele-diff')">Load query above</button>
     385          <span style="padding-right: 12px;">
     386            For the country: <input type="text" id="ssv-jury-tele-diff-tocountry" value="The Netherlands" style="width: 180px; padding-left: 6px"/>
     387            In the year:     <input type="text" id="ssv-jury-tele-diff-inyear"    value="2019"        style="width:  80px; padding-left: 6px"/>
     388          </span>
     389       
     390          <button type="button" class="exec-ssq" id="exec-ssv-jury-tele-diff" onclick="ssv_execute('ssv-jury-tele-diff')">Visualize Results</button><br/>
     391        </div>
     392        <p>
     393          Plot as a Tree-map how the various juries have cast
     394          their votes for a specific country.  The area of the
     395          block represents the number of points awarded by
     396          the jury.  To this we add colouring
     397          to the block to show how much in agreement
     398          the televote was: red indicates the televote was
     399          higher than the the jury vote; green is when the
     400          votes are similar (neutral); and
     401          blue indicates the televote was lower then the
     402          jury vote.
     403        </p>
     404          </li>       
     405         
     406
     407          <li>
    380408        <b>The Curse of Being the Second Performer in the Lineup?</b><br/>
    381409        <button type="button" class="load-ssq" id="load-ssv-draw-bias" onclick="ssv_load('ssv-draw-bias')">Load query above</button>
Note: See TracChangeset for help on using the changeset viewer.