1: {title: ass_axis[due], ticks: [{v:0, f:'OFF'}, {v:1, f:'ON'}]
},
2: {title: ass_axis[uno]+' / '+ass_axis[due] , ticks: [{v:0, f:'OFF'}, {v:1, f:'ON'}]
}
},
vAxis:{
baselineColor: '#fff',
gridlineColor: '#fff',
textPosition: 'none'
}
} // fine options
myLine.setOptions(opzioniGraficoLinee);
newData = google.visualization.data.join(myData, mySolarimetro, 'left', [[0,0]], [1,2,3,4 ], [1]);
var view = new google.visualization.DataView(newData);
view.setColumns([0,uno,due,tre]); //here you set the columns you want to display
//Visualization Go draw!
//visualizationPlot.draw(view, options);
// Bind myLine to the dashboard, and to the controls
// this will make sure our line chart is update when our date changes
myDashboard.bind(myDateSlider, myLine);
myDashboard.draw(view);
}
//################################# aggiungo gli eventi ai check #######################
/*Array.prototype.remove = function(from, to) {
var rest = this.slice((to || from) + 1 || this.length);
this.length = from < 0 ? this.length + from : from;
return this.push.apply(this, rest);
};
*/
Array.prototype.remove = function(value) {
var idx = this.indexOf(value);
if (idx != -1) {
return this.splice(idx, 1); // The second parameter is the number of elements to remove.
}
return false;
}
Array.prototype.insert = function (index, item) {
this.splice(index, 0, item);
};
//per la Temperatura Parete
document.addEventListener('DOMContentLoaded', function () {
document.querySelector('#uno').addEventListener('change', changeHandler1);
});
function changeHandler1(){
if(uno.checked){
visible.insert(1,1);
}
else{
visible.remove(1);
}
controlloArray();
}
// per la Temperatura Inverter
document.addEventListener('DOMContentLoaded', function () {
document.querySelector('#due').addEventListener('change', changeHandler2);
});
function changeHandler2(){
if(due.checked){
visible.insert(2,2);
}
else{
visible.remove(2);
}
controlloArray();
}
//per Ventilatore 1
document.addEventListener('DOMContentLoaded', function () {
document.querySelector('#tre').addEventListener('change', changeHandler3);
});
function changeHandler3(){
if(tre.checked){
visible.insert(3,3);
}
else{
visible.remove(3);
}
controlloArray();
}
// per Ventilatore 2
document.addEventListener('DOMContentLoaded', function () {
document.querySelector('#quattro').addEventListener('change', changeHandler4);
});
function changeHandler4(){
if(quattro.checked){
visible.insert(4,4);
}
else{
visible.remove(4);
}
controlloArray();
}
// per il solarimetro
document.addEventListener('DOMContentLoaded', function () {
document.querySelector('#cinque').addEventListener('change', changeHandler5);
});
function changeHandler5(){
if(quattro.checked){
visible.insert(5,5);
}
else{
visible.remove(5);
}
controlloArray();
}
function controlloArray(){
if(visible.length == 3){
//passo direttamente il numero delle misure che mi servono
drawChartTwoAxis(visible[1],visible[2]);
}
else if(visible.length == 1){}
else
drawChart();
}
function checkchecked(visible, check){
checkname = new Array('zero', 'uno', 'due', 'tre', 'quattro');
if(visible.length > 4){
alert(\"Massimo 4 selezioni\");
document.getElementById(checkname[check]).checked = false;
return 1;
}
return 0;
}
</script>
";
} //fine if
$body=
"
<!-- <div class=\"well\">
<span>Benvenuto</span>
</div> -->
<div class=\"well well-lg\">
<div class=\"row\">
<div class=\"col-md-2\">
";
$body = $body . $dynamicMenu .
"
</div>
<!-- Modal Start here-->
<div id=\"loading-div-background\">
<div id=\"loading-div\" class=\"ui-corner-all\" >
<img style=\"height:80px;margin:30px;\" src=\"img/loading.gif\" alt=\"Loading..\"/>
<h2 style=\"color:gray;font-weight:normal;\">Please wait....</h2>
</div>
</div>
<!-- Modal ends Here -->
<div class=\"col-md-10\"> <div id=\"curve_chart\" style=\"width:100%;\">";
$selettore =
"<p id=\"selettoregiorno\" style=\"margin-bottom: 0.1em; margin-top: -0.1em; font-family:orbitron;color: #000;font-weight: bold;font-size: 0.8em;text-align: center;\">
Dal
<input form=\"main-menu\" type=\"text\" id=\"selezionadatainizio\" name=\"datainizio\" value=\"";
//se non c'e' precedentemente impostata imposta oggi se c'e' imposta
$datainizio = date("Y-m-d");
$datafine = date("Y-m-d");
// converte la stringa data in un oggetto data
$datainizio = date_create_from_format("Y-m-d",$datainizio);
$datafine = date_create_from_format("Y-m-d",$datafine);
if(isset($_GET['datainizio']) && isset($_GET['datafine'])){
$datainizio_sql = str_replace("/", "-", $_GET['datainizio']);
$datafine_sql = str_replace("/", "-", $_GET['datafine']);//;$_POST['datafine'];
$datainizio = date_create_from_format("Y-m-d",$datainizio_sql);
$datafine = date_create_from_format("Y-m-d",$datafine_sql);
}
$selettore = $selettore . date_format($datainizio,"Y-m-d") . "\" style=\"width: 9em; font-family:monospace\">
Al
<input form=\"main-menu\" type=\"text\" id=\"selezionadatafine\" name=\"datafine\" value=\"".date_format($datafine,"Y-m-d")."\" style=\"width: 9em; font-family:monospace\">";
$selettore = $selettore ."
<input form=\"main-menu\" type=\"hidden\" id=\"type\" name=\"type\" value=\"".$type."\" style=\"width: 9em; font-family:monospace\">
<button style=\"font:inherit; color:white; text-shadow:0 0 3px #000;\" form=\"main-menu\" type=\"submit\">esegui</button>
</p>";
$body = $body.$selettore.
"<div id=\"chart_div\" style=\"width:100%; height: 412px\"> </div>
<div id=\"control_div\" style=\"width:100%; height: 62px;\"> </div>
</div>
<!-- parte relativa ai check -->
<div class=\"input-group\">
<span class=\"input-group-addon\">
<input type=\"checkbox\" id=\"uno\" name=\"temp1\" checked>
<label for=\"temp1\"><nobr>Temperatura Parete</nobr></label>
</span>
<span class=\"input-group-addon\">
<input type=\"checkbox\" id=\"due\" name=\"temp2\" checked>
<label for=\"temp2\"><nobr>Temperatura Inverter</nobr></label>
</span>
<span class=\"input-group-addon\">
<input type=\"checkbox\" id=\"tre\" name=\"rele1\" unchecked>
<label for=\"rele1\"><nobr> Ventilatore 1 (On/Off) </nobr></label>
</span>
<span class=\"input-group-addon\">
<input type=\"checkbox\" id=\"quattro\" name=\"rele2\" unchecked>
<label for=\"rele2\"><nobr>Ventilatore 2 (On/Off) </nobr></label>
</span>
</div>
<!-- fine parte relativa ai check -->
</div>
</div>
</div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js\"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src=\"js/bootstrap.min.js\"></script>
</body>
</html>
";
$datepicker =
"<link rel=\"stylesheet\" href=\"//code.jquery.com/ui/1.11.1/themes/smoothness/jquery-ui.css\">
<script src=\"//code.jquery.com/jquery-1.10.2.js\"></script>
<script src=\"//code.jquery.com/ui/1.11.1/jquery-ui.js\"></script>
<script>
var opzioniselettoredata = {
showOtherMonths: true,
selectOtherMonths: true,
changeMonth: true,
changeYear: true,
dateFormat: \"yy-mm-dd\",
minDate: new Date(\"2012\"),
maxDate: new Date(),
clearText: 'Svuota',
clearStatus: '',
clearStatus: 'Cancella la data corrente',
closeText: 'Chiudi',
closeStatus: '',
closeStatus: 'Chiudi senza cambiamenti',
prevText: '<Prec',
prevStatus: '',
prevStatus: 'Mostra il mese precedente',
nextText: 'Succ>',
nextStatus: '',
nextStatus: 'Mostra il mese successivo',
currentText: 'Oggi',
currentStatus: '',
currentStatus: 'Mostra il mese corrente',
monthNames: ['Gennaio','Febbraio','Marzo','Aprile','Maggio','Giugno','Luglio','Agosto','Settembre','Ottobre','Novembre','Dicembre'],
monthNamesShort: ['Gen','Feb','Mar','Apr','Mag','Giu','Lug','Ago','Set','Ott','Nov','Dic'],
monthStatus: 'Mostra un altro mese',
yearStatus: 'Mostra un altro anno',
weekHeader: 'Sm',
weekStatus: '',
weekStatus: 'Settimana dell\'anno',
dayNames: ['Domenica','Lunedì','Martedì','Mercoledì','Giovedì','Venerdì','Sabato'],
dayNamesShort: ['Dom','Lun','Mar','Mer','Gio','Ven','Sab'],
dayNamesMin: ['Do','Lu','Ma','Me','Gio','Ve','Sa'],
dayStatus: 'Imposta DD come primo giorno della settimana',
dateStatus: 'Seleziona DD, M d',
dateFormat: 'yy-mm-dd', firstDay: 1,
initStatus: 'Seleziona una data',
isRTL: false
};
$(function () {
$.datepicker.setDefaults(opzioniselettoredata);
$(\"#selezionadatainizio\").datepicker({ onClose: function (selectedDate) { $(\"#selezionadatafine\").datepicker(\"option\", \"minDate\", selectedDate); } });
$(\"#selezionadatafine\").datepicker({ onClose: function (selectedDate) { $(\"#selezionadatainizio\").datepicker(\"option\", \"maxDate\", selectedDate); } });
//$(\"#loading-div-background\").show();
// $(\"#loading-div-background\").css({ opacity: 0 });
});
</script>
";
$body = $body . $datepicker;
echo $header.$nav.$body.$script;
?>