\n"; echo " \n"; if ($superimposition == "") { echo " \n"; } else { 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 " ['" . urldecode($GETlabel) . "','" . str_replace(",", "','", str_replace("'", "", urldecode($GETvalue))) . "'] \n"; echo str_replace("~,", "',", str_replace("[~", "['", str_replace(",]", ",0]", str_replace(",,", ",0,", str_replace(",]", ",0]", $GETdata))))); echo " ]);\n"; echo " var options = { " . $GETextraopts . " \n"; echo " title: '" . $GETtitle . "', \n"; echo " hAxis: {title: '" . $GETlabel . "', titleTextStyle: {color: 'red'}}" . $nondefs . " \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)'; if (document.getElementById('safariform')) { document.getElementById('safariform').style.top='70px'; } 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) { selecteventfive(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)'; if (document.getElementById('safariform')) { document.getElementById('safariform').style.top='70px'; } ans=prompt(' In ' + colparts[0] + ' ' + postdparts[0].replace(']','') + ' you clicked ' + colparts[item.column] + ' of ' + str + ' while (' + diffcolnames + ') were (' + diffvalues + ').' + avblurb, paramdata); if (ans != null) { selecteventsix(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 != "") { if ($superimposition == "") { echo " \n"; } else { echo " \n"; } } else { echo " \n"; } $statistics=""; $sarr=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]; $narr=[0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0]; $clprefix=""; $cl=-1; $cpos=0; $abbl="about:blank"; $dabbl="none"; $wabbl=""; if (strpos($GETmode,'Both') === 0 || strpos($GETmode,'Statistics') === 0) { if (strpos($GETmode,'Both') === 0) $wabbl="Both"; if (strpos($GETmode,'Statistics') === 0) $wabbl="Statistics"; if (strpos($GETmode,'Both') === 0 && $GETmode != 'Both') { $abbl=substr($GETmode,4); $dabbl="block"; } else if (strpos($GETmode,'Statistics') === 0 && $GETmode != 'Statistics') { $abbl=substr($GETmode,10); $dabbl="block"; } $thing_names=explode(",", $GETvalue); $date_items=explode("~", $GETdata); $data_items=explode("~,", $GETdata); $matrix = array(array()); $rowarray = array(); $colarray = array(); $num_columns_is=sizeof($data_items) + 4; //$statistics=$GETdata . "\n" . $GETvalue . "\n" . $GETlabel . "\n" . $GETtitle; $subjideas=explode(" of ", $GETtitle); $subjidea=""; if (strpos($GETtitle, "Timed Count") !== false) $subjidea="Vehicle"; if (sizeof($subjideas) > 1) { $subjidea=explode(" ",$subjideas[1])[0]; } $statistics.="

"; $arow=""; for ($icpos=0; $icpos<$num_columns_is; $icpos++) { if (($icpos % sizeof($sarr)) == 0 && $icpos != 0) { $cl++; $clprefix=$sarr[$cl]; } if ($clprefix != "") $narr[sizeof($narr)]=0.0; $arow = str_replace("", "" . $clprefix . $sarr[($icpos % sizeof($sarr))] . "", $arow); if (($icpos + 1) == sizeof($thing_names)) { for ($jcpos=1; $jcpos<=5; $jcpos++) { if ((($icpos + $jcpos) % sizeof($sarr)) == 0) { $cl++; $clprefix=$sarr[$cl]; } if (1 == 4) $arow = str_replace("", "" . $clprefix . $sarr[(($icpos + $jcpos) % sizeof($sarr))] . "", $arow); } } } $statistics=str_replace("", $arow . "", $statistics); $arow="1" . $GETtitle . ""; $statistics=str_replace("", $arow . "", $statistics); $arow="2" . $subjidea . ""; $cl=2; for ($icpos=0; $icpos<(-1 + sizeof($data_items)); $icpos++) { $arow = str_replace("", "" . str_replace(",","",str_replace("[","",str_replace("~","",str_replace(" ","",$date_items[2 * $icpos + 1])))) . "", $arow); } $arow = str_replace("", "Total",$arow); $arow = str_replace("", "Average",$arow); $arow = str_replace("", "Median",$arow); $arow = str_replace("", "Mode",$arow); $statistics=str_replace("", $arow . "", $statistics); $aarow=""; $bbrow=""; $ccrow=""; $ddrow=""; $firsthuh=""; for ($icpos=0; $icpos<(-1 + sizeof($data_items)); $icpos++) { $firsthuh.="?"; } for ($icpos=0; $icpos" . ($icpos + 3) . ""; $aarow="" . ($icpos + 4) . ""; $bbrow="" . ($icpos + 5) . ""; $ccrow="" . ($icpos + 6) . ""; $ddrow="" . ($icpos + 7) . ""; $arow = str_replace("", "" . $thing_names[$icpos] . "", $arow); $aarow = str_replace("", "Total", $aarow); $bbrow = str_replace("", "Average", $bbrow); $ccrow = str_replace("", "Median", $ccrow); $ddrow = str_replace("", "Mode", $ddrow); for ($jcpos=0; $jcpos<(-1 + sizeof($data_items)); $jcpos++) { $rowarray[sizeof($rowarray)] = (float)str_replace(",","",str_replace("[","",str_replace("~","",str_replace(" ","",explode(",",str_replace("]",",",$data_items[$jcpos + 1]))[$icpos])))); $matrix[$icpos][$jcpos] = (float)str_replace(",","",str_replace("[","",str_replace("~","",str_replace(" ","",explode(",",str_replace("]",",",$data_items[$jcpos + 1]))[$icpos])))); $narr[$jcpos] += (float)str_replace(",","",str_replace("[","",str_replace("~","",str_replace(" ","",explode(",",str_replace("]",",",$data_items[$jcpos + 1]))[$icpos])))); $sumis += (float)str_replace(",","",str_replace("[","",str_replace("~","",str_replace(" ","",explode(",",str_replace("]",",",$data_items[$jcpos + 1]))[$icpos])))); $movavg = ($movavg * $jcpos + (float)str_replace(",","",str_replace("[","",str_replace("~","",str_replace(" ","",explode(",",str_replace("]",",",$data_items[$jcpos + 1]))[$icpos])))) ) / (1 + $jcpos); $arow = str_replace("", "" . str_replace(",","",str_replace("[","",str_replace("~","",str_replace(" ","",explode(",",str_replace("]",",",$data_items[$jcpos + 1]))[$icpos])))) . "", $arow); $aarow = str_replace("", "" . $secondhuh . "", $aarow); $bbrow = str_replace("", "" . $secondhuh . "", $bbrow); $ccrow = str_replace("", "" . $secondhuh . "", $ccrow); $ddrow = str_replace("", "" . $secondhuh . "", $ddrow); $secondhuh=substr($secondhuh,1); } $arow = str_replace("", "" . $sumis . "", $arow); $arow = str_replace("", "" . $movavg . "", $arow); sort($rowarray, SORT_NUMERIC); $arow = str_replace("", "" . $rowarray[(int)(sizeof($rowarray) / 2)] . "", $arow); // median $sofar = $rowarray[0]; $lastnum = $rowarray[0]; $thissofarnum = 1; $sofarnum = 1; for ($imore=1; $imore $sofarnum) { $sofar = $rowarray[$imore]; $sofarnum = $thissofarnum; } else { $thissofarnum = 1; } $lastnum = $rowarray[$imore]; } } $arow = str_replace("", "" . $sofar . "", $arow); // mode $othercharts="
"; $othercharts.="
Up AboveNew WindowEmail Client
Bar Chart
"; $othercharts.="
Bar Chart
"; $othercharts.="
Bar Chart
"; $othercharts.="
Line Chart
"; $othercharts.="
Line Chart
"; $othercharts.="
Line Chart
"; $othercharts.="
Area Chart
"; $othercharts.="
Area Chart
"; $othercharts.="
Area Chart
"; $othercharts.="
Column Chart
"; $othercharts.="
Column Chart
"; $othercharts.="
Column Chart
"; $othercharts.="
"; if (str_replace("about:blank","",$abbl) != "") { $leftis=explode(".php", $abbl); $rightis=explode("title=", $abbl); $othercharts.=" function dothis() { document.getElementById('igchart').src='" . $leftis[0] . ".php' + String.fromCharCode(63) + 'title=" . $rightis[1] . "'; } setTimeout(dothis,1000); "; } $aarow = str_replace("", "
" . $othercharts . "
", $aarow); //$aarow = str_replace("", "", $aarow); //$aarow = str_replace("", "", $aarow); //$aarow = str_replace("", "", $aarow); // $bbrow = str_replace("", "", $bbrow); //$bbrow = str_replace("", "", $bbrow); //$bbrow = str_replace("", "", $bbrow); //$bbrow = str_replace("", "", $bbrow); // $ccrow = str_replace("", "", $ccrow); //$ccrow = str_replace("", "", $ccrow); //$ccrow = str_replace("", "", $ccrow); //$ccrow = str_replace("", "", $ccrow); // $ddrow = str_replace("", "", $ddrow); //$ddrow = str_replace("", "", $ddrow); //$ddrow = str_replace("", "", $ddrow); //$ddrow = str_replace("", "", $ddrow); $statistics=str_replace("", $arow . "", $statistics); if ((1 + $icpos) == sizeof($thing_names)) { $secondhuh=$firsthuh; for ($iicpos=0; $iicpos<(-1 + sizeof($data_items)); $iicpos++) { $colarray = array(); for ($jjcpos=0; $jjcpos $sofarnum) { $sofar = $colarray[$imore]; $sofarnum = $thissofarnum; } else { $thissofarnum = 1; } $lastnum = $colarray[$imore]; } } $ddrow = str_replace($secondhuh, "" . $sofar, $ddrow); // temporary $secondhuh=substr($secondhuh,1); } $statistics=str_replace("", $aarow . "", $statistics); $statistics=str_replace("", $bbrow . "", $statistics); $statistics=str_replace("", $ccrow . "", $statistics); $statistics=str_replace("", $ddrow . "", $statistics); } } } if (strpos($GETmode,'Both') === 0) { echo "

" . $GETtitle . " Statistics Table and Column Chart

\n"; echo '
' . $statistics . '
' . $bdivstart . '
' . $bdivend . '
' . " \n"; } else if (strpos($GETmode,'Statistics') !== 0) { echo "

" . $GETtitle . " Column Chart

\n"; echo '' . $bdivstart . '
' . $bdivend . '
' . " \n"; } else { echo "

" . $GETtitle . " Statistics Table

\n"; echo '
' . $statistics . '
' . $bdivstart . '' . $bdivend . '
' . " \n"; } } //echo 'Another column chart to show differences for?' . " \n"; echo 'Another area/bar/line/column chart?' . " \n"; echo '
'; echo '<' . 'script' . '>' . "\n " . " function later() { \n"; if ((!isset($_GET['value']) && !isset($_POST['value'])) || (1 == 2 && $data0 == "")) { if (isset($_GET['data'])) $data0 = "&data0=" . $_GET['data']; if (isset($_POST['data'])) $data0 = "&data0=" . $_POST['data']; echo " if (document.getElementById('safariform')) { document.getElementById('safariform').style.top='70px'; } " . "\n"; 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 (background image URL or background image data URI ; separated (followed by ;) before title are available options, and suffix by &onclick=y for added onclick functionality, and/or suffix by &mode=Statistics for a spreadsheet type display or &mode=Both for both types of display, Email Attachment Title suffixes are &emailto=[emailTo] &emailsubject=[EmailSubject] and &top=[0], &left=[0], &opacity=[0.5], &overlay=[C] or A or B or L (and appended ,[~2010~,45,67] type data sets of overlay data, can be different to entries later) for superimposition purposes available)", "' . $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"; if (strpos($data0, "data0=") !== false) { echo ' if (allowed) { var wl = toolong("./column_chart_diff.php?title=" + title + yonclick + "&label=" + label + nojwinextra + "&value=" + value.replace(" ercent ", "") + "' . $data0 . '&data=" + datac); if (wl != "#") { window.location=wl; } } ' . "\n"; } else { echo ' if (allowed) { var wl = toolong("./column_chart.php?title=" + title + yonclick + "&label=" + label + nojwinextra + "&value=" + value.replace(" ercent ", "") + "' . $data0 . '&data=" + datac); if (wl != "#") { window.location=wl; } } ' . "\n"; } echo "} \n" . "} \n"; } else { echo " } \n"; } echo '' . "\n"; ?>