google.load('visualization', '1', { packages: ['linechart', "barchart", "columnchart"] });

var visualization_Supply_HType;
var visualization_Supply_OwnerDwellUK;
var visualization_Supply_OwnerDwellUKIn;
var visualization_Supply_PrivateRentUK;
var visualization_Supply_HousingAssocUK;
var visualization_Supply_LA_UK;
var visualization_Supply_PublicUK;
var visualization_Supply_AssocUK;
var visualization_Supply_PrivateUK;
var visualization_Supply_Tenure;
var visualization_Supply_NewBuild;
var visualization_Supply_Complete;
var visualization_Supply_Starts;
var visualization_Supply_Complete08;


function drawAllFigure() 
{
    drawVisualization_Supply_HType();
	drawVisualization_Supply_OwnerDwellUK();
    drawVisualization_Supply_OwnerDwellUKIn();
	drawVisualization_Supply_PrivateRentUK();
    drawVisualization_Supply_HousingAssocUK();
    drawVisualization_Supply_LA_UK();
    drawVisualization_Supply_PublicUK();
    drawVisualization_Supply_AssocUK();
    drawVisualization_Supply_PrivateUK();
    drawVisualization_Supply_Tenure();
    drawVisualization_Supply_NewBuild();
    drawVisualization_Supply_Complete();
    drawVisualization_Supply_Starts();
    drawVisualization_Supply_Complete08();
}

//Supply_HType
function drawVisualization_Supply_HType() 
{
    // To see the data that this visualization uses, browse to
    var query_Supply_HType= new google.visualization.Query(
          'https://spreadsheets.google.com/pub?key=0Am-mi-Fc5ks5dG5Mc2kzQ2I2VnNETFJwQl85VlVzWVE&sheet=Supply_HType');
    // Send the query with a callback function.
    query_Supply_HType.send(handleQueryResponse_Supply_HType);
}

function handleQueryResponse_Supply_HType(response) 
{
    if (response.isError()) 
    {
        alert('Error in query: ' + response.getMessage() + ' ' + response.getDetailedMessage());
        return;
    }
   
    var data_Supply_HType = response.getDataTable();
    visualization_Supply_HType = new google.visualization.ColumnChart(document.getElementById('Supply_HType'));
    visualization_Supply_HType.draw(data_Supply_HType, { width: 706, height: 300, legend: "bottom", titleY: "Percentage change (%)", is3D: true });
}


//Supply_OwnerDwellUK
function drawVisualization_Supply_OwnerDwellUK() 
{
    // To see the data that this visualization uses, browse to
    var query_Supply_OwnerDwellUK= new google.visualization.Query(
          'https://spreadsheets.google.com/pub?key=0Am-mi-Fc5ks5dG5Mc2kzQ2I2VnNETFJwQl85VlVzWVE&sheet=Supply_OwnerDwellUK');
    // Send the query with a callback function.
    query_Supply_OwnerDwellUK.send(handleQueryResponse_Supply_OwnerDwellUK);
}

function handleQueryResponse_Supply_OwnerDwellUK(response) 
{
    if (response.isError()) 
    {
        alert('Error in query: ' + response.getMessage() + ' ' + response.getDetailedMessage());
        return;
    }
   
    var data_Supply_OwnerDwellUK = response.getDataTable();
    visualization_Supply_OwnerDwellUK = new google.visualization.LineChart(document.getElementById('Supply_OwnerDwellUK'));
    visualization_Supply_OwnerDwellUK.draw(data_Supply_OwnerDwellUK, { width: 706, height: 300, legend: "bottom", titleY: "No. of Dwellings", is3D: true });
}


// Supply_OwnerDwellUKIn
function drawVisualization_Supply_OwnerDwellUKIn() 
{
    // To see the data that this visualization uses, browse to
    var query_Supply_OwnerDwellUKIn = new google.visualization.Query(
          'https://spreadsheets.google.com/pub?key=0Am-mi-Fc5ks5dG5Mc2kzQ2I2VnNETFJwQl85VlVzWVE&sheet=Supply_OwnerDwellUKIn');
    // Send the query with a callback function.
    query_Supply_OwnerDwellUKIn.send(handleQueryResponse_Supply_OwnerDwellUKIn);
}

function handleQueryResponse_Supply_OwnerDwellUKIn(response) {
    if (response.isError()) {
        alert('Error in query: ' + response.getMessage() + ' ' + response.getDetailedMessage());
        return;
    }

    var data_Supply_OwnerDwellUKIn = response.getDataTable();
    visualization_Supply_OwnerDwellUKIn = new google.visualization.LineChart(document.getElementById('Supply_OwnerDwellUKIn'));
    visualization_Supply_OwnerDwellUKIn.draw(data_Supply_OwnerDwellUKIn, { width: 706, height: 300, legend: "bottom", titleY: "Ratio: Average Advance / Average Income", is3D: true });
}


//Supply_PrivateRentUK
function drawVisualization_Supply_PrivateRentUK() 
{
    // To see the data that this visualization uses, browse to
    var query_Supply_PrivateRentUK= new google.visualization.Query(
          'https://spreadsheets.google.com/pub?key=0Am-mi-Fc5ks5dG5Mc2kzQ2I2VnNETFJwQl85VlVzWVE&sheet=Supply_PrivateRentUK');
    // Send the query with a callback function.
    query_Supply_PrivateRentUK.send(handleQueryResponse_Supply_PrivateRentUK);
}

function handleQueryResponse_Supply_PrivateRentUK(response) 
{
    if (response.isError()) 
    {
        alert('Error in query: ' + response.getMessage() + ' ' + response.getDetailedMessage());
        return;
    }
   
    var data_Supply_PrivateRentUK = response.getDataTable();
    visualization_Supply_PrivateRentUK = new google.visualization.LineChart(document.getElementById('Supply_PrivateRentUK'));
    visualization_Supply_PrivateRentUK.draw(data_Supply_PrivateRentUK, { width: 706, height: 300, legend: "bottom", titleY: "No. of Dwellings", is3D: true });
}


// Supply_HousingAssocUK
function drawVisualization_Supply_HousingAssocUK() {
    // To see the data that this visualization uses, browse to
    var query_Supply_HousingAssocUK = new google.visualization.Query(
          'https://spreadsheets.google.com/pub?key=0Am-mi-Fc5ks5dG5Mc2kzQ2I2VnNETFJwQl85VlVzWVE&sheet=Supply_HousingAssocUK');
    // Send the query with a callback function.
    query_Supply_HousingAssocUK.send(handleQueryResponse_Supply_HousingAssocUK);
}

function handleQueryResponse_Supply_HousingAssocUK(response) 
{
    if (response.isError()) {
        alert('Error in query: ' + response.getMessage() + ' ' + response.getDetailedMessage());
        return;
    }

    var data_Supply_HousingAssocUK = response.getDataTable();
    visualization_Supply_HousingAssocUK = new google.visualization.LineChart(document.getElementById('Supply_HousingAssocUK'));
    visualization_Supply_HousingAssocUK.draw(data_Supply_HousingAssocUK, { width: 706, height: 300, legend: "bottom", titleY: "No. of Dwellings", is3D: true });
}

// Supply_LA_UK
function drawVisualization_Supply_LA_UK() {
    // To see the data that this visualization uses, browse to
    var query_Supply_LA_UK = new google.visualization.Query(
          'https://spreadsheets.google.com/pub?key=0Am-mi-Fc5ks5dG5Mc2kzQ2I2VnNETFJwQl85VlVzWVE&sheet=Supply_LA_UK');
    // Send the query with a callback function.
    query_Supply_LA_UK.send(handleQueryResponse_Supply_LA_UK);
}

function handleQueryResponse_Supply_LA_UK(response) {
    if (response.isError()) {
        alert('Error in query: ' + response.getMessage() + ' ' + response.getDetailedMessage());
        return;
    }

    var data_Supply_LA_UK = response.getDataTable();
    visualization_Supply_LA_UK = new google.visualization.LineChart(document.getElementById('Supply_LA_UK'));
    visualization_Supply_LA_UK.draw(data_Supply_LA_UK, { width: 706, height: 300, legend: "bottom", titleY: "No. of Dwellings", is3D: true });
}

// Supply_PublicUK
function drawVisualization_Supply_PublicUK() 
{
    // To see the data that this visualization uses, browse to
    var query_Supply_PublicUK = new google.visualization.Query(
          'https://spreadsheets.google.com/pub?key=0Am-mi-Fc5ks5dG5Mc2kzQ2I2VnNETFJwQl85VlVzWVE&sheet=Supply_PublicUK');
    // Send the query with a callback function.
    query_Supply_PublicUK.send(handleQueryResponse_Supply_PublicUK);
}

function handleQueryResponse_Supply_PublicUK(response) {
    if (response.isError()) {
        alert('Error in query: ' + response.getMessage() + ' ' + response.getDetailedMessage());
        return;
    }

    var data_Supply_PublicUK = response.getDataTable();
    visualization_Supply_PublicUK = new google.visualization.LineChart(document.getElementById('Supply_PublicUK'));
    visualization_Supply_PublicUK.draw(data_Supply_PublicUK, { width: 706, height: 300, legend: "bottom", titleY: "No. of Completions", is3D: true });
}

// Supply_AssocUK
function drawVisualization_Supply_AssocUK() {
    // To see the data that this visualization uses, browse to
    var query_Supply_AssocUK = new google.visualization.Query(
          'https://spreadsheets.google.com/pub?key=0Am-mi-Fc5ks5dG5Mc2kzQ2I2VnNETFJwQl85VlVzWVE&sheet=Supply_AssocUK');
    // Send the query with a callback function.
    query_Supply_AssocUK.send(handleQueryResponse_Supply_AssocUK);
}

function handleQueryResponse_Supply_AssocUK(response) {
    if (response.isError()) {
        alert('Error in query: ' + response.getMessage() + ' ' + response.getDetailedMessage());
        return;
    }

    var data_Supply_AssocUK = response.getDataTable();
    visualization_Supply_AssocUK = new google.visualization.LineChart(document.getElementById('Supply_AssocUK'));
    visualization_Supply_AssocUK.draw(data_Supply_AssocUK, { width: 706, height: 300, legend: "bottom", titleY: "No. of Completions",is3D: true });
}

// Supply_PrivateUK
function drawVisualization_Supply_PrivateUK() {
    // To see the data that this visualization uses, browse to
    var query_Supply_PrivateUK = new google.visualization.Query(
          'https://spreadsheets.google.com/pub?key=0Am-mi-Fc5ks5dG5Mc2kzQ2I2VnNETFJwQl85VlVzWVE&sheet=Supply_PrivateUK');
    // Send the query with a callback function.
    query_Supply_PrivateUK.send(handleQueryResponse_Supply_PrivateUK);
}

function handleQueryResponse_Supply_PrivateUK(response) {
    if (response.isError()) {
        alert('Error in query: ' + response.getMessage() + ' ' + response.getDetailedMessage());
        return;
    }

    var data_Supply_PrivateUK = response.getDataTable();
    visualization_Supply_PrivateUK = new google.visualization.LineChart(document.getElementById('Supply_PrivateUK'));
    visualization_Supply_PrivateUK.draw(data_Supply_PrivateUK, { width: 706, height: 300, legend: "bottom", titleY: "No. of Completions", is3D: true });
}

// Supply_Tenure
function drawVisualization_Supply_Tenure() 
{
    // To see the data that this visualization uses, browse to
    var query_Supply_Tenure = new google.visualization.Query(
          'https://spreadsheets.google.com/pub?key=0Am-mi-Fc5ks5dG5Mc2kzQ2I2VnNETFJwQl85VlVzWVE&sheet=Supply_Tenure');
    // Send the query with a callback function.
    query_Supply_Tenure.send(handleQueryResponse_Supply_Tenure);
}

function handleQueryResponse_Supply_Tenure(response) {
    if (response.isError()) {
        alert('Error in query: ' + response.getMessage() + ' ' + response.getDetailedMessage());
        return;
    }

    var data_Supply_Tenure = response.getDataTable();
    visualization_Supply_Tenure = new google.visualization.ColumnChart(document.getElementById('Supply_Tenure'));
    visualization_Supply_Tenure.draw(data_Supply_Tenure, { width: 706, height: 300, legend: "bottom", titleY: "Percentage (%)", is3D: true, min: "0", isStacked: true, max: "100" });
}

// Supply_NewBuild
function drawVisualization_Supply_NewBuild() {
    // To see the data that this visualization uses, browse to
    var query_Supply_NewBuild = new google.visualization.Query(
          'https://spreadsheets.google.com/pub?key=0Am-mi-Fc5ks5dG5Mc2kzQ2I2VnNETFJwQl85VlVzWVE&sheet=Supply_NewBuild');
    // Send the query with a callback function.
    query_Supply_NewBuild.send(handleQueryResponse_Supply_NewBuild);
}

function handleQueryResponse_Supply_NewBuild(response) 
{
    if (response.isError()) {
        alert('Error in query: ' + response.getMessage() + ' ' + response.getDetailedMessage());
        return;
    }

    var data_Supply_NewBuild = response.getDataTable();
    visualization_Supply_NewBuild = new google.visualization.LineChart(document.getElementById('Supply_NewBuild'));
    visualization_Supply_NewBuild.draw(data_Supply_NewBuild, { width: 706, height: 300, legend: "bottom", titleY: "Total Dwelling Starts", is3D: true});
}


// Supply_Complete
function drawVisualization_Supply_Complete() {
    // To see the data that this visualization uses, browse to
    var query_Supply_Complete = new google.visualization.Query(
          'https://spreadsheets.google.com/pub?key=0Am-mi-Fc5ks5dG5Mc2kzQ2I2VnNETFJwQl85VlVzWVE&sheet=Supply_Complete');
    // Send the query with a callback function.
    query_Supply_Complete.send(handleQueryResponse_Supply_Complete);
}

function handleQueryResponse_Supply_Complete(response) {
    if (response.isError()) {
        alert('Error in query: ' + response.getMessage() + ' ' + response.getDetailedMessage());
        return;
    }

    var data_Supply_Complete = response.getDataTable();
    visualization_Supply_Complete = new google.visualization.LineChart(document.getElementById('Supply_Complete'));
    visualization_Supply_Complete.draw(data_Supply_Complete, { width: 706, height: 300, legend: "bottom", titleY: "Total Dwelling Completions", is3D: true });
}


// Supply_Starts
function drawVisualization_Supply_Starts() {
    // To see the data that this visualization uses, browse to
    var query_Supply_Starts = new google.visualization.Query(
          'https://spreadsheets.google.com/pub?key=0Am-mi-Fc5ks5dG5Mc2kzQ2I2VnNETFJwQl85VlVzWVE&sheet=Supply_Starts');
    // Send the query with a callback function.
    query_Supply_Starts.send(handleQueryResponse_Supply_Starts);
}

function handleQueryResponse_Supply_Starts(response) {
    if (response.isError()) {
        alert('Error in query: ' + response.getMessage() + ' ' + response.getDetailedMessage());
        return;
    }

    var data_Supply_Starts = response.getDataTable();
    visualization_Supply_Starts = new google.visualization.ColumnChart(document.getElementById('Supply_Starts'));
    visualization_Supply_Starts.draw(data_Supply_Starts, { width: 706, height: 300, legend: "bottom", titleY: "Percentage starts (%)", is3D: true, min: "0", max: "100", isStacked: true });
}


// Supply_Complete08
function drawVisualization_Supply_Complete08() {
    // To see the data that this visualization uses, browse to
    var query_Supply_Complete08 = new google.visualization.Query(
          'https://spreadsheets.google.com/pub?key=0Am-mi-Fc5ks5dG5Mc2kzQ2I2VnNETFJwQl85VlVzWVE&sheet=Supply_Complete08');
    // Send the query with a callback function.
    query_Supply_Complete08.send(handleQueryResponse_Supply_Complete08);
}

function handleQueryResponse_Supply_Complete08(response) {
    if (response.isError()) {
        alert('Error in query: ' + response.getMessage() + ' ' + response.getDetailedMessage());
        return;
    }

    var data_Supply_Complete08 = response.getDataTable();
    visualization_Supply_Complete08 = new google.visualization.ColumnChart(document.getElementById('Supply_Complete08'));
    visualization_Supply_Complete08.draw(data_Supply_Complete08, { width: 706, height: 300, legend: "bottom", titleY: "Percentage completions (%)", is3D: true, min: "0", max: "100", isStacked: true });
}

google.setOnLoadCallback(drawAllFigure);


