QR Diagram

Simple QR Diagram using Crockford's supplant function and survey data

HTML

<script src="https://www.quickbase.com/db/bfx7sqpm8?a=dbpage&amp;pagename=SurveyData.js"></script>
<script src="http://keith-wood.name/js/jquery.gchart.js"></script>
<div id="myGChart"></div>

CSS

#myGChart {
    height: 400px;
    width: 400px;
    background-color: lightblue;
}

JavaScript

//http://javascript.crockford.com/remedial.html
if (!String.prototype.supplant) {
    String.prototype.supplant = function (o) {
        return this.replace(/{([^{}]*)}/g,
            function (a, b) {
                var r = o[b];
                return typeof r === 'string' || typeof r === 'number' ? r : a;
            }
        );
    };
}

var template="There are {length1} responses in survey 1; {length2} responses in survey 2; {length3} responses in survey 3; {length4} responses in survey 4; and a grand total of {length} responses in full survey!"
    
var params={length1: survey1.length,
            length2: survey2.length,
            length3: survey3.length,
            length4: survey4.length,
            length:  survey.length}

$('#myGChart').gchart($.gchart.qrCode(
    template.supplant(params))) ; 

//decode qr image with this utility:
//http://zxing.org/w/decode.jspx