Property Prices Development

View the "big picture" of residential property sales in England and Wales.

by Vlad Makovsky

HTML

<script src="https://www.google.com/jsapi"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<a href="http://house.briskat.com?tab=2">house.briskat.com</a>
<button id="play_btn" type="button">Play!</button>
<div id="bubble_div"></div>

JavaScript

google.load('visualization', '1.0', {
    'packages': ['corechart']
});
google.setOnLoadCallback(initMe);
var GS; var Year;

function initMe() {
    GS=new google.visualization.BubbleChart(document.getElementById('bubble_div'));
    $("#play_btn").click(function() { 
        Year = 2010;
        $("#play_btn").hide();
        setTimeout(refresh, 1100);
    });
}

function switchColumns(jsonData,header,fields) {
    var body = $.map(jsonData, function(n,i){
                   var row = new Array();
                   row.push(n[0]);
                   for ( var idx in fields ) { 
                       row.push(Math.round(n[fields[idx]]));
                   }
                   return [row];
               });

    return header.concat(body);
}

function drawGraph(Graph,Year) {
        var pc=1; // try 1 -inner london, 12(east midlands),.20 (wales)
        var Data = $.ajax({
            url: "http://house.briskat.com/api/p/lruk/r/area?pc=" + pc + "&yr=" + Year,
            dataType: "json",
            async: false
        }).responseJSON;

        var Table = google.visualization.arrayToDataTable(switchColumns(
                        Data,
                        [['Post Code', 'Average price £','Avg price changed YoY (%)','Properties sold','']],
                        [2,3,1,1]
                    ));
        Graph.draw(Table, 
                   { title: 'London property prices, ' + Year,
                     hAxis: {title: 'Average price paid £',
                                viewWindowMode:'explicit',
                                viewWindow:{
                                    max: 1100000,
                                     min: 150000,
                                   }
                     },
                     vAxis: {title: 'Average price changed YoY in %',
                             viewWindowMode:'explicit',
                             viewWindow:{
                             max:30,
                             min:-30
            ...