\n";
echo " \n";
echo "
\n";
echo " " . $GETtitle . " Column Chart
\n";
echo " \n";
echo " \n";
echo " \n";
} else {
echo ' data0 = "";' . "\n";
echo " google.load('visualization', '1', {packages:['corechart']}); " . "\n";
echo ' google.setOnLoadCallback(drawChart); ' . "\n";
echo ' function drawChart() { ' . "\n";
echo ' data = google.visualization.arrayToDataTable([ ' . "\n";
echo " ['" . $GETlabel . "','" . str_replace(",", "','", str_replace("'", "", $GETvalue)) . "'] \n";
echo str_replace("~,", "',", str_replace("[~", "['", str_replace(",]", ",0]", str_replace(",,", ",0,", str_replace(",]", ",0]", $GETdata)))));
echo " ]);\n";
echo " var options = { \n";
echo " title: '" . $GETtitle . "', \n";
echo " hAxis: {title: '" . $GETlabel . "', titleTextStyle: {color: 'red'}}" . " \n";
echo " }; \n";
echo " chart = new google.visualization.ColumnChart(document.getElementById('chart_div')); \n";
if ($GETonclick != "") {
echo "google.visualization.events.addListener(chart, 'ready', function() { ready=true; }); \n";
echo "google.visualization.events.addListener(chart, 'select', myselectfunction); \n function myselectfunction() {
if (ready) {
var relist=['remail',''],ire,ansbits,ioffset=0,ans=null,doit=true,avblurb=talkingpoint,kl,lk, thisnum, num=0,message = '', dparts, colparts=colnames.split(','), colav=new Array(), predparts, postdparts, diffcolnames=colnames,diffvalues;
var selection = chart.getSelection();
for (var i = 0; i < selection.length; i++) {
var item = selection[i];
if ((item.row != null && item.column != null) || (eval(ir) >= 0 && eval(ic) >= 0)) {
if (eval(ir) >= 0 && eval(ic) >= 0) {
//alert(999);
item.row=ir;
item.column=ic;
//alert(9999);
ir=-1;
ic=-1;
} else {
ir=item.row;
ic=item.column;
//document.title=ir + ',' + ic;
}
var str = data.getFormattedValue(item.row, item.column);
//document.title=str;
message=document.head.innerHTML.substring(ioffset);
while (message.indexOf(', [') != -1) {
message=message.replace(', [',',[');
}
dparts=message.split(',[');
//document.title='';
colav.push(0.0);
for (kl=1; kl= eval(1 + item.row)) {
postdparts=dparts[eval(1 + item.row)].replace(']',',').split(',');
if (eval(postdparts.length) >= eval(1 + item.column)) {
if (eval(colparts.length) == 3) {
if (1 == 1) {
avblurb+='Show this as Line Chart=L' + String.fromCharCode(10);
avblurb+='Show this as Bar Chart=B' + String.fromCharCode(10);
avblurb+='Show this as Area Chart=A' + String.fromCharCode(10) + String.fromCharCode(10) + 'Comma Separated Values Spreadsheet Export=filename.csv' + String.fromCharCode(10) + '' + String.fromCharCode(10) + 'Email with or without Talking Point=fillin.email@address This is when the improvement started. Robert' + String.fromCharCode(10) + '' + String.fromCharCode(10);
avblurb+='Change data as required below (keeping it the same or being blank or choosing Cancel leaves the status quo)';
ans=prompt('In ' + colparts[0] + ' ' + postdparts[0].replace(']','') + ' you clicked ' + colparts[item.column] + ' of ' + str + ' while ' + colparts[eval(3 - item.column)] + ' were ' + postdparts[eval(3 - item.column)].replace(']','') + ' the difference being ' + eval(eval(postdparts[1].replace(']','')) - eval(postdparts[2].replace(']',''))) + avblurb, paramdata);
if (ans != null) {
if (ans != '' && ans != paramdata) {
if ((ans.toLowerCase() + '~').indexOf('.csv~') != -1 && ans.toLowerCase().indexOf('&') == -1) ans=paramdata + '&csv=' + ans;
ansbits=ans.split(' ');
if (document.getElementById('altemail')) {
document.getElementById('altemail').value=ansbits[0];
document.getElementById('remail').href=document.getElementById('remail').href.replace('mt=','mt=' + ansbits[0] + '&junk=youshallneverfindthis').replace('get=','mt=' + ansbits[0] + '&junk=youshallneverfindthis');
}
if (document.getElementById('email')) relist[1]='email';
if (ansbits[0].indexOf('@') != -1) {
for (ire=0; ire<2; ire++) {
if (relist[ire] != '') {
document.getElementById(relist[ire]).href=document.getElementById(relist[ire]).href.replace('fillin.email@address', ansbits[0]);
if (document.getElementById(relist[ire]).href.indexOf(encodeURIComponent('&r=') + item.row) == -1) document.getElementById(relist[ire]).href+=encodeURIComponent('&r=') + item.row;
if (document.getElementById(relist[ire]).href.indexOf(encodeURIComponent('&c=') + item.column) == -1) document.getElementById(relist[ire]).href+=encodeURIComponent('&c=') + item.column;
if (ansbits.length > 1) {
ans=ans.replace(ansbits[0] + ' ','');
while (ans.indexOf(' ') != -1) {
ans=ans.replace(' ','%20');
}
while (ans.indexOf('?') != -1) {
ans=ans.replace('?','%3f');
}
while (ans.indexOf('&') != -1) {
ans=ans.replace('&','%26');
}
if (document.getElementById(relist[ire]).href.indexOf(encodeURIComponent('&tp=')) == -1 && document.getElementById(relist[ire]).href.indexOf(encodeURIComponent('?tp=')) == -1) {
document.getElementById(relist[ire]).href+=encodeURIComponent('&tp=') + encodeURIComponent(ans);
} else if (document.getElementById(relist[ire]).href.indexOf(encodeURIComponent('&tp=')) != -1) {
document.getElementById(relist[ire]).href=document.getElementById(relist[ire]).href.replace(encodeURIComponent('&tp='), encodeURIComponent('&tp=') + encodeURIComponent(ans) + String.fromCharCode(96));
} else if (document.getElementById(relist[ire]).href.indexOf(encodeURIComponent('?tp=')) != -1) {
document.getElementById(relist[ire]).href=document.getElementById(relist[ire]).href.replace(encodeURIComponent('?tp='), encodeURIComponent('?tp=') + encodeURIComponent(ans) + String.fromCharCode(96));
}
while (document.getElementById(relist[ire]).href.indexOf(' ') != -1) {
document.getElementById(relist[ire]).href=document.getElementById(relist[ire]).href.replace(' ','%20');
}
//alert(document.getElementById(relist[ire]).href);
}
document.getElementById(relist[ire]).click();
}
}
} else if (ans.substring(0,1).toLowerCase() == 'l') {
location.href=document.URL.replace('/ColumnChart', '/LineChart').replace('column_chart', 'line_chart').replace('_diff.', '.');
} else if (ans.substring(0,1).toLowerCase() == 'b') {
location.href=document.URL.replace('/ColumnChart', '/BarChart').replace('column_chart', 'bar_chart');
} else if (ans.substring(0,1).toLowerCase() == 'a') {
location.href=document.URL.replace('/ColumnChart', '/AreaChart').replace('column_chart', 'area_chart').replace('_diff.', '.');
} else {
location.href=document.URL.replace(pardata, ourencodeURIComponent(ans));
}
}
}
} else {
alert('In ' + colparts[0] + ' ' + postdparts[0].replace(']','') + ' you clicked ' + colparts[item.column] + ' of ' + str + ' while ' + colparts[eval(3 - item.column)] + ' were ' + postdparts[eval(3 - item.column)].replace(']','') + ' the difference being ' + eval(eval(postdparts[1].replace(']','')) - eval(postdparts[2].replace(']',''))) + avblurb);
}
} else {
predparts=dparts[eval(1 + item.row)].split(']');
diffvalues=('~' + predparts[0] + '~').replace('~' + postdparts[0].replace(']','') + ',','~');
if (eval(0 + item.column) == 1) {
diffvalues=diffvalues.replace('~' + str + ',','').replace(/~/g,'');
} else if (eval(colparts.length) == eval(1 + item.column)) {
diffvalues=diffvalues.replace(',' + str + '~','').replace(/~/g,'');
} else {
diffvalues=diffvalues.replace(',' + str + ',',',').replace(/~/g,'');
}
diffcolnames=('~' + colnames + '~').replace('~' + colparts[0] + ',','~').replace('~' + colparts[eval(0 + item.column)] + ',','').replace(',' + colparts[eval(0 + item.column)] + '~','').replace(',' + colparts[eval(0 + item.column)] + ',',',').replace(/~/g,'');
if (1 == 1) {
avblurb+='Show this as Line Chart=L' + String.fromCharCode(10);
avblurb+='Show this as Bar Chart=B' + String.fromCharCode(10);
avblurb+='Show this as Area Chart=A' + String.fromCharCode(10) + String.fromCharCode(10) + 'Comma Separated Values Spreadsheet Export=filename.csv' + String.fromCharCode(10) + '' + String.fromCharCode(10);
avblurb+='Change data as required below (keeping it the same or being blank or choosing Cancel leaves the status quo)';
ans=prompt('In ' + colparts[0] + ' ' + postdparts[0].replace(']','') + ' you clicked ' + colparts[item.column] + ' of ' + str + ' while (' + diffcolnames + ') were (' + diffvalues + ').' + avblurb, paramdata);
if (ans != null) {
if (ans != '' && ans != paramdata) {
if ((ans.toLowerCase() + '~').indexOf('.csv~') != -1 && ans.toLowerCase().indexOf('&') == -1) ans=paramdata + '&csv=' + ans;
ansbits=ans.split(' ');
if (document.getElementById('altemail')) {
document.getElementById('altemail').value=ansbits[0];
document.getElementById('remail').href=document.getElementById('remail').href.replace('mt=','mt=' + ansbits[0] + '&junk=youshallneverfindthis').replace('get=','mt=' + ansbits[0] + '&junk=youshallneverfindthis');
}
if (document.getElementById('email')) relist[1]='email';
if (ansbits[0].indexOf('@') != -1) {
for (ire=0; ire<2; ire++) {
if (relist[ire] != '') {
document.getElementById(relist[ire]).href=document.getElementById(relist[ire]).href.replace('fillin.email@address', ansbits[0]);
if (document.getElementById(relist[ire]).href.indexOf(encodeURIComponent('&r=') + item.row) == -1) document.getElementById(relist[ire]).href+=encodeURIComponent('&r=') + item.row;
if (document.getElementById(relist[ire]).href.indexOf(encodeURIComponent('&c=') + item.column) == -1) document.getElementById(relist[ire]).href+=encodeURIComponent('&c=') + item.column;
if (ansbits.length > 1) {
ans=ans.replace(ansbits[0] + ' ','');
while (ans.indexOf(' ') != -1) {
ans=ans.replace(' ','%20');
}
while (ans.indexOf('?') != -1) {
ans=ans.replace('?','%3f');
}
while (ans.indexOf('&') != -1) {
ans=ans.replace('&','%26');
}
if (document.getElementById(relist[ire]).href.indexOf(encodeURIComponent('&tp=')) == -1 && document.getElementById(relist[ire]).href.indexOf(encodeURIComponent('?tp=')) == -1) {
document.getElementById(relist[ire]).href+=encodeURIComponent('&tp=') + encodeURIComponent(ans);
} else if (document.getElementById(relist[ire]).href.indexOf(encodeURIComponent('&tp=')) != -1) {
document.getElementById(relist[ire]).href=document.getElementById(relist[ire]).href.replace(encodeURIComponent('&tp='), encodeURIComponent('&tp=') + encodeURIComponent(ans) + String.fromCharCode(96));
} else if (document.getElementById(relist[ire]).href.indexOf(encodeURIComponent('?tp=')) != -1) {
document.getElementById(relist[ire]).href=document.getElementById(relist[ire]).href.replace(encodeURIComponent('?tp='), encodeURIComponent('?tp=') + encodeURIComponent(ans) + String.fromCharCode(96));
}
while (document.getElementById(relist[ire]).href.indexOf(' ') != -1) {
document.getElementById(relist[ire]).href=document.getElementById(relist[ire]).href.replace(' ','%20');
}
//alert(document.getElementById(relist[ire]).href);
}
document.getElementById(relist[ire]).click();
}
}
} else if (ans.substring(0,1).toLowerCase() == 'l') {
location.href=document.URL.replace('/ColumnChart', '/LineChart').replace('column_chart', 'line_chart').replace('_diff.', '.');
} else if (ans.substring(0,1).toLowerCase() == 'b') {
location.href=document.URL.replace('/ColumnChart', '/BarChart').replace('column_chart', 'bar_chart');
} else if (ans.substring(0,1).toLowerCase() == 'a') {
location.href=document.URL.replace('/ColumnChart', '/AreaChart').replace('column_chart', 'area_chart').replace('_diff.', '.');
} else {
location.href=document.URL.replace(pardata, ourencodeURIComponent(ans));
}
}
}
} else {
alert('In ' + colparts[0] + ' ' + postdparts[0].replace(']','') + ' you clicked ' + colparts[item.column] + ' of ' + str + ' while (' + diffcolnames + ') were (' + diffvalues + ').' + avblurb);
}
}
}
}
message += '{row:' + item.row + ',column:' + item.column + '} = ' + str;
} else if (item.row != null) {
var str = data.getFormattedValue(item.row, 0);
message += '{row:' + item.row + ', column:none}; value (col 0) = ' + str;
} else if (item.column != null) {
var str = data.getFormattedValue(0, item.column);
message += '{row:none, column:' + item.column + '}; value (row 0) = ' + str;
}
}
if (message == '') {
message = 'nothing';
}
//document.title='2 ' + message;
if (1 == 2) console.log('You selected ' + message);
}
}
//);
";
}
echo " chart.draw(data, options); \n";
if ($GETr != "" && $GETc == "" && (!isset($_GET['cca']) && !isset($_POST['cca']))) echo " chart.setSelection([{'row': " . $GETr . ", 'column': null}]); setTimeout(myselectfunction,4100); \n";
if ($GETr == "" && $GETc != "" && (!isset($_GET['cca']) && !isset($_POST['cca']))) echo " chart.setSelection([{'row': null, 'column': " . $GETc . "}]); setTimeout(myselectfunction,4100); \n";
if ($GETr != "" && $GETc != "" && (!isset($_GET['cca']) && !isset($_POST['cca']))) echo " chart.setSelection([{'row': " . $GETr . ", 'column': " . $GETc . "}]); setTimeout(myselectfunction,4100); \n";
echo " } \n";
echo " \n";
echo " \n";
if ($GETonclick != "") {
echo " \n";
} else {
echo " \n";
}
echo " " . $GETtitle . " Column Chart
\n";
echo '' . " \n";
}
echo 'Another column chart to show differences for?' . " \n";
echo '<' . 'script' . '>' . "\n " . " function later() { \n";
if ((!isset($_GET['value']) && !isset($_POST['value'])) || $data0 == "") {
if (isset($_GET['data'])) $data0 = "&data0=" . $_GET['data'];
if (isset($_POST['data'])) $data0 = "&data0=" . $_POST['data'];
echo ' var datalineprefix = " "; ' . "\n";
echo ' var datalinesuffix = ""; ' . "\n";
echo ' var extra = ""; ' . "\n";
echo ' var thisline = 1; ' . "\n";
echo ' var ii = 0; ' . "\n";
echo ' var thisdef = "0"; ' . "\n";
echo ' var totalleft = 100.0; ' . "\n";
if (isset($_GET['data']) || isset($_POST['data'])) {
echo " var title = '" . $GETtitle . "'; " . "\n";
} else {
echo ' var title = prompt("Enter Column Chart Title (suffix by &onclick=y for added onclick functionality)", "' . $GETtitle . '"); ' . "\n";
}
echo ' if (title != null) { ' . "\n";
if (isset($_GET['data']) || isset($_POST['data'])) {
echo " var label = '" . $GETlabel . "'; " . "\n";
echo " var value = '" . $GETvalue . "'; " . "\n";
} else {
echo ' var label = prompt("Enter Column Concept", "' . $GETlabel . '"); ' . "\n";
echo ' var value = prompt("Enter Column " + label + " Measure(s) (separated by ,)", "' . $GETvalue . '"); ' . "\n";
}
echo ' if (value.indexOf(",") != (0 - 1)) { ' . "\n";
echo ' for (ii=0; ii 0))) { ' . "\n";
echo ' if (datalinesuffix.length != 0) datalineprefix = prompt("Enter " + label + " " + thisline + " (for no more hit Cancel button)", ""); ' . "\n";
echo ' if (datalineprefix == null) { ' . "\n";
echo ' datalineprefix = ""; ' . "\n";
echo ' totalleft = 0; ' . "\n";
echo ' } else if (datalineprefix.length != 0) { ' . "\n";
echo ' extra = ""; ' . "\n";
echo ' if (value.indexOf("ercent") != (0 - 1) && value.indexOf(" ercent ") == (0 - 1)) extra = " (for " + totalleft + " enter nothing or hit Cancel button)"; ' . "\n";
echo ' datalinesuffix = prompt("Enter " + value.replace(" ercent ", "") + " " + thisline + extra, thisdef); ' . "\n";
echo ' if (datalinesuffix == null && value.indexOf("ercent") != (0 - 1) && value.indexOf(" ercent ") == (0 - 1)) datalinesuffix = totalleft; ' . "\n";
echo ' if (datalinesuffix == null) datalinesuffix = "0"; ' . "\n";
echo ' if (datalinesuffix.length == 0) { ' . "\n";
echo ' datalinesuffix = eval(totalleft); ' . "\n";
echo ' totalleft = 0; ' . "\n";
echo ' } else if (eval(totalleft) == eval(datalinesuffix) && value.indexOf("ercent") != (0 - 1) && value.indexOf(" ercent ") == (0 - 1)) { ' . "\n";
echo ' totalleft = 0; ' . "\n";
echo ' } else if (eval(datalinesuffix) > eval(totalleft) && value.indexOf("ercent") != (0 - 1) && value.indexOf(" ercent ") == (0 - 1)) { ' . "\n";
echo ' datalinesuffix = eval(totalleft); ' . "\n";
echo ' totalleft = 0; ' . "\n";
echo ' } else if (eval(datalinesuffix) > eval(totalleft) && value.indexOf("ercent") == (0 - 1) && value.indexOf(" ercent ") == (0 - 1)) { ' . "\n";
echo ' value = value + " ercent "; ' . "\n";
echo ' } else { ' . "\n";
echo ' totalleft = eval(totalleft) - eval(datalinesuffix); ' . "\n";
echo ' } ' . "\n";
echo ' datac = datac + ", [~" + datalineprefix + "~," + datalinesuffix + "] "; ' . "\n";
echo ' thisline++; ' . "\n";
echo ' } ' . "\n";
echo ' } ' . "\n";
echo ' window.location = "./column_chart_diff.php?title=" + title + yonclick + "&label=" + label + "&value=" + value.replace(" ercent ", "") + "' . $data0 . '&data=" + datac; ' . "\n";
echo "} \n" . "} \n";
} else {
echo " } \n";
}
echo '' . 'script' . '>' . "\n";
?>