2,6d1 < $data0 = ""; < if (isset($_GET['data0'])) { < $data0 = "&data0=" . $_GET['data0']; < } < 15c10 < Pie Chart (Differences) - RJM Programming - http://www.rjmprogramming.com.au (Copyright © 2013 rjmprogramming.com.au all rights reserved.) --- > Pie Chart - RJM Programming - http://www.rjmprogramming.com.au (Copyright © 2013 rjmprogramming.com.au all rights reserved.) 24,28c19,41 < if (isset($_GET['desc'])) { < $GETtitle = $_GET['title']; < $GETtask = $_GET['task']; < $GETdesc = $_GET['desc']; < $GETdata = $_GET['data']; --- > if (isset($_POST['data'])) { > if (isset($_GET['title'])) { > $GETtitle = str_replace("\\'", "'", $_GET['title']); > } else { > $GETtitle = str_replace("\\'", "'", $_POST['title']); > } > if (isset($_GET['task'])) { > $GETtask = str_replace("\\'", "'", $_GET['task']); > } else { > $GETtask = str_replace("\\'", "'", $_POST['task']); > } > if (isset($_GET['desc'])) { > $GETdesc = str_replace("\\'", "'", $_GET['desc']); > } else { > $GETdesc = str_replace("\\'", "'", $_POST['desc']); > } > $GETdata = str_replace("\\'", "'", $_POST['data']); > } > if (isset($_GET['data'])) { > $GETtitle = str_replace("\\'", "'", $_GET['title']); > $GETtask = str_replace("\\'", "'", $_GET['task']); > $GETdesc = str_replace("\\'", "'", $_GET['desc']); > $GETdata = str_replace("\\'", "'", $_GET['data']); 31,67d43 < if (isset($_GET['data0'])) { < echo " google.load('visualization', '1.1', {packages:['corechart']}); " . "\n"; < echo ' google.setOnLoadCallback(drawChart); ' . "\n"; < echo ' function drawChart() { ' . "\n"; < echo ' var data = google.visualization.arrayToDataTable([ ' . "\n"; < echo " ['" . $GETtask . "','" . $GETdesc . "'] \n"; < echo str_replace("~,", "',", str_replace("[~", "['", str_replace(",]", ",0]", str_replace(",]", ",0]", str_replace(",]", ",0]", $GETdata))))); < echo " ]);\n"; < echo ' var data0 = google.visualization.arrayToDataTable([ ' . "\n"; < echo " ['" . $GETtask . "','" . $GETdesc . "'] \n"; < echo str_replace("~,", "',", str_replace("[~", "['", str_replace(",]", ",0]", str_replace(",]", ",0]", str_replace(",]", ",0]", $_GET['data0']))))); < echo " ]);\n"; < < < echo " var pieChartBefore = new google.visualization.PieChart(document.getElementById('piechart_before')); \n"; < echo " var pieChartAfter = new google.visualization.PieChart(document.getElementById('piechart_after')); \n"; < echo " var pieChartDiff = new google.visualization.PieChart(document.getElementById('piechart_diff')); \n"; < < echo " var options = { pieSliceText: 'none' }; \n"; < < echo " pieChartBefore.draw(data0, options); \n"; < echo " pieChartAfter.draw(data, options); \n"; < < echo " var diffData = pieChartDiff.computeDiff(data0, data); \n"; < echo " pieChartDiff.draw(diffData, options); \n } \n"; < < < echo " \n"; < echo " \n"; < echo " \n"; < echo "

" . $GETtitle . " Pie Chart

\n"; < < echo " \n"; < echo " \n"; < echo " \n"; < } else { < echo ' var data0 = "";' . "\n"; 81c57 < --- > 86,87d61 < echo '
' . "\n"; < } 89c63,64 < Another pie chart to show differences for? --- >
> Another pie chart? 91,92c66 < if (!isset($_GET['desc']) || $data0 == "") { < if (isset($_GET['data'])) $data0 = "&data0=" . $_GET['data']; --- > if (!isset($_GET['desc']) && !isset($_POST['desc'])) { 99,103c73 < if (isset($_GET['data'])) { < echo " var title = '" . $GETtitle . "'; " . "\n"; < } else { < echo ' var title = prompt("Enter Pie Chart Title", "My Daily Activities"); ' . "\n"; < } --- > echo ' var title = prompt("Enter Pie Chart Title", "My Daily Activities"); ' . "\n"; 105,109c75 < if (isset($_GET['data'])) { < echo " var task = '" . $GETtask . "'; " . "\n"; < echo " var desc = '" . $GETdesc . "'; " . "\n"; < } else { < echo ' var task = prompt("Enter Activity Type", "' . $GETtask . '"); ' . "\n"; --- > echo ' var task = prompt("Enter Activity Type", "Task"); ' . "\n"; 111d76 < } 143c108 < echo ' window.location = "./pie_chart_diff.php?title=" + title + "&task=" + task + "&desc=" + desc.replace(" ercent ", "") + "' . $data0 . '&data=" + datac; ' . "\n"; --- > echo ' window.location = "./pie_chart.php?title=" + title + "&task=" + task + "&desc=" + desc.replace(" ercent ", "") + "&data=" + datac; ' . "\n";