I have "projecttask" table and its having below data
mysql> select projecttaskid,projecttaskname,projecttask_no,projecttaskstatus from vtiger_projecttask;
+---------------+------------------------+----------------+-------------------+
| projecttaskid | projecttaskname | projecttask_no | projecttaskstatus |
+---------------+------------------------+----------------+-------------------+
| 3 | A BLOCK BASEMENT FLOOR | PT1 | Completed |
| 5 | A BLOCK GROUND FLOOR | PT2 | Completed |
| 6 | A BLOCK FIRST FLOOR | PT3 | |
| 7 | A BLOCK SECOND FLOOR | PT4 | Completed |
| 8 | A BLOCK THIRD FLOOR | PT5 | Completed |
| 9 | A BLOCK FOURTH FLOOR | PT6 | In Progress |
| 10 | A BLOCK FIFTH FLOOR | PT7 | In Progress |
| 11 | A BLOCK SIXTH FLOOR | PT8 | Open |
| 12 | A BLOCK SEVENTH FLOOR | PT9 | Open |
| 13 | A BLOCK TARRACE FLOOR | PT10 | Completed |
| 19 | A BLOCK STRUCTURE | PT11 | |
+---------------+------------------------+----------------+-------------------+
Once the project completed we should get the data as '1' for google chart. If any other status it should set as '0' in my chart script. The chart script as shown below:
<script type="text/javascript" src="https://www.google.com/jsapi"> </script>
<script type="text/javascript">
google.load("visualization", "1", {packages:["corechart"]});
var dataSet = [
['Date','1st Floor', '2nd Floor', '3rd Floor', '4th Floor', '5th Floor', '6th Floor', '7th Floor', 'Tarrace Floor'],
['A Block', 1, 1, 1, 0, 0, 0, 0, 0],
['B Block', 1, 1, 1, 1, 1, 1, 1, 1],
['C Block', 1, 1, 1, 1, 1, 1, 1, 1],
['D Block', 1, 1, 1, 1, 1, 1, 1, 1],
['E Block', 1, 1, 0, 0, 0, 0, 0, 0],
['F Block', 1, 1, 0, 0, 0, 0, 0, 0],
];
// The first chart
google.setOnLoadCallback(drawChart1);
function drawChart1() {
var data = google.visualization.arrayToDataTable( dataSet );
var options = {
title: 'Stacked histogram\nTotals',
vAxis: {title: 'Total Floors', maxValue: 8}, // sets the maximum value
backgroundColor: {strokeWidth: 2 }, // to draw a nice box all around the chart
isStacked: 'true' // = rowstacked in gnuplot
};
var chart = new google.visualization.ColumnChart(document.getElementById('chart_div1'));
chart.draw(data, options);
}
This is where the data should inject in my script from the database. I need here the data should automatically come from the database. Please help me on this.
var dataSet = [
['Date','1st Floor', '2nd Floor', '3rd Floor', '4th Floor', '5th Floor', '6th Floor', '7th Floor', 'Tarrace Floor'],
['A Block', 1, 1, 1, 0, 0, 0, 0, 0],
['B Block', 1, 1, 1, 1, 1, 1, 1, 1],
['C Block', 1, 1, 1, 1, 1, 1, 1, 1],
['D Block', 1, 1, 1, 1, 1, 1, 1, 1],
['E Block', 1, 1, 0, 0, 0, 0, 0, 0],
['F Block', 1, 1, 0, 0, 0, 0, 0, 0],
];
Once 1 floor completed the stcked chart automatically go up by 1. Output you can see in the URL http://www.onnetsourcing.com/vivera/chart.html