Commit 6afbbc87 authored by nextime's avatar nextime

New panel in gui for graphs

parent 01026e3b
ALTER TABLE `user_gui_panels` CHANGE `panel_type` `panel_type` ENUM( 'standard', 'graph', 'macrobuttons', 'bookmarks', 'cameras', 'video', 'gxv3175_left', 'gxv3175_center', 'gxv3175_right' ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT 'standard';
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -8,6 +8,7 @@ CSS="../../resources/bootstrap/css/bootstrap.min.css
../../resources/glyphicons/css/bootstrap-glyphicons.css
../../resources/full-glyphicons/css/glyphicons.css
../../resources/bootstrap-switch/static/stylesheets/bootstrap-switch.css
../../resources/js/jqplot/jquery.jqplot.min.css
css/style.css
"
......@@ -26,6 +27,12 @@ js/starthammer.js
../../resources/EventSource/eventsource.js
../../resources/js/jquery.easing.1.3.min.js
../../resources/js/jquery.alterclass.js
../../resources/js/jqplot/jquery.jqplot.min.js
../../resources/js/jqplot/plugins/jqplot.dateAxisRenderer.min.js
../../resources/js/jqplot/plugins/jqplot.highlighter.min.js
../../resources/js/jqplot/plugins/jqplot.cursor.min.js
../../resources/js/jqplot/plugins/jqplot.canvasTextRenderer.min.js
../../resources/js/jqplot/plugins/jqplot.canvasAxisTickRenderer.min.js
js/fastclick.js
js/speech.js
js/domotika.js
......
<? @include_once("../../includes/common.php"); ?>
<?
$_SESSION[PANELS_CHARTS]=array();
if($panel && is_array($panel)) {
$days = getLastNDays(7, 'Y-m-d' );
$daysql = getLastNDays(7, 'Y-m-d');
$charts=DB::query("SELECT * FROM stats_charts WHERE active=1 AND DMDOMAIN(name, '".$panel['panel_content']."')=1 order by webposition");
if(is_numeric($panel['panel_height'])) $panel['panel_height'].="px";
$visible="";
if($panel['panel_visible']!="all") $visible=$panel['panel_visible'];
if(count($buttonar)<=0) {
$visible.=" hidden-xs hidden-sm";
}
?>
<div class="panel panel-theme-<?=$_DOMOTIKA['gui_theme']?> col-lg-<?=$panel['panel_cols']?> panel-media-low <?=$visible?>" style="height:<?=$panel['panel_height'];?>;">
<?
if($panel['panel_title']!="") {
?>
<div class="panel-heading panel-head-theme-<?=$_DOMOTIKA['gui_theme']?>"><h2 class="panel-title"><?=$panel['panel_title']?></h2></div>
<? }
$height="";
$dmfull="";
if($panel['panel_height']!="" && intval($panel['panel_height'])>0) {
$height="style=\"height:".$panel['panel_height']."\"";
$dmheight="style=\"height:".strval(intval($panel['panel_height'])-70)."px\"";
if(endsWith($panel['panel_height'], '%')) {
$dmfull="domotika-panel-full";
$dmheight="style=\"height:100%;\"";
}
}
elseif($panel['panel_height']!="" && intval($panel['panel_height'])==0) {
$height="style=\"height:100%;\"";
$dmfull="domotika-panel-full";
$dmheight="style=\"height:100%;\"";
}
?>
<div class="domotika-panel <?=$dmfull;?>" <?=$dmheight;?>>
<div class="home-panel" <?=$dmheight;?>>
<div class="list-group theme-<?=$_DOMOTIKA['gui_theme']?>">
<?
foreach($charts as $chart) {
//print_r($chart);
$_SESSION[PANELS_CHARTS][$chart['name']."-".$panel['id']]=$chart;
?>
<div id="<?=$chart['name']."-".$panel['id']?>" style="height:200px;width:550px"><?=$chart['name']?></div>
<?
}?>
</div>
</div>
</div>
</div>
<?}?>
<? @include_once("../../includes/common.php"); ?>
<script type="text/javascript">
$(document).ready(function() {
<?
$days = getLastNDays(7, 'Y-m-d' );
$daysql = getLastNDays(7, 'Y-m-d');
foreach($_SESSION[PANELS_CHARTS] as $eid => $chart)
{
$chartserie = getChartData($chart['name']);
?>
var plot_<?=$chart['name']?>=$.jqplot('<?=$eid?>', [<?
$maxseriecount=0;
for($c=0;$c<count($chartserie);$c++)
{
if($maxseriecount<$chartserie[$c]['count'])
$maxseriecount=$chartserie[$c]['count'];
echo $chartserie[$c]['data'];
if($c<count($chartserie)-1)
echo ",";
}
?>], {
title:'<?=addslashes($chart['title'])?>',
legend: {
show: <?=$chart['legend_show']?>,
location:'<?=$chart['legend_position']?>',
renderOptions: {
placement: "<?=$chart['legend_placement']?>"
}
},
grid: {
shadow: <?=$chart['grid_shadow']?>,
drawBorder: <?=$chart['grid_border']?>,
background: '<?=$chart['grid_background']?>'
},
axes:{
xaxis: {
renderer:$.jqplot.DateAxisRenderer,
tickRenderer:$.jqplot.CanvasAxisTickRenderer,
autoscale:true,
<?if($chart['x_numberTicks']) {
if($maxseriecount<intval($chart['x_numberTicks'])) {?>
numberTicks: <?=$maxseriecount?>,
<? }else{?>
numberTicks: <?=$chart['x_numberTicks']?>,
<? }?>
<?}?>
tickOptions:{
<?if($chart['x_formatString']) {?>
formatString: <?=$chart['x_formatString']?>,
<?}?>
angle:30
}
},
yaxis: {
min:0,
<?if($chart['y_numberTicks']) {?>
numberTicks: <?=$chart['y_numberTicks']?>,
<?}?>
tickOptions:{
<?if($chart['y_formatString']) {?>
formatString: <?=$chart['y_formatString']?>
<?} else {?>
formatString:'%.<?=$chart['y_label_precision']?>f'
<?}?>
}
}
},
highlighter: {
show: true,
sizeAdjust: 7.5
},
cursor: {
show: false
},
series:[
<?
for($c=0;$c<count($chartserie);$c++)
{
$serie=$chartserie[$c]['serie']
?>
{
label: '<?=addslashes($serie['label'])?>',
lineWidth:<?=$serie['line_width']?>,
markerOptions:{
style:'<?=$serie['marker_style']?>',
size: <?=$serie['marker_size']?>,
},
color:'<?=$serie['color']?>',
showMarker: <?=$serie['marker_show']?>,
showLine: true,
fill: <?=$serie['fill']?>,
fillAndStroke: true,
highlighter: {
formatString:'<?=$serie['highlighter_formatString']?>'
}
}<?
if($c<count($chartserie)-1)
echo ",\n";
}
?>
],
seriesDefaults:{
rendererOptions: {
smooth: true,
shadowAlpha: 0.1,
fillToZero: true
}
}
});
<?
}
?>
});
</script>
......@@ -24,6 +24,15 @@
<!-- jquery easing plugin -->
<script src="/resources/js/jquery.easing.1.3.min.js"></script>
<script src="/resources/js/jquery.alterclass.js"></script>
<!-- jqplot -->
<script src="/resources/js/jqplot/jquery.jqplot.min.js" ></script>
<script type="text/javascript" src="/resources/js/jqplot/plugins/jqplot.dateAxisRenderer.min.js"></script>
<script type="text/javascript" src="/resources/js/jqplot/plugins/jqplot.highlighter.min.js"></script>
<script type="text/javascript" src="/resources/js/jqplot/plugins/jqplot.cursor.min.js"></script>
<script type="text/javascript" src="/resources/js/jqplot/plugins/jqplot.canvasTextRenderer.min.js"></script>
<script type="text/javascript" src="/resources/js/jqplot/plugins/jqplot.canvasAxisTickRenderer.min.js"></script>
<script src="<?=$BASEGUIPATH;?>/js/fastclick.js"></script>
<script src="<?=$BASEGUIPATH;?>/js/speech.js"></script>
<script src="<?=$BASEGUIPATH;?>/js/domotika.js"></script>
......
......@@ -20,6 +20,7 @@
<link href="/resources/glyphicons/css/bootstrap-glyphicons.css" rel="stylesheet" media="screen">
<link href="/resources/full-glyphicons/css/glyphicons.css" rel="stylesheet" media="screen">
<link href="/resources/bootstrap-switch/static/stylesheets/bootstrap-switch.css" rel="stylesheet" media="screen">
<link rel="stylesheet" type="text/css" href="/resources/js/jqplot/jquery.jqplot.min.css" media="screen" />
<link href="<?=$BASEGUIPATH;?>/css/style.css" rel="stylesheet" media="screen" />
<? } else { ?>
......
<?
include_once("common_includes.php");
include_once("include.php");
?>
<html>
<head title="Domotika GUI stats">
......
......@@ -21,6 +21,7 @@ require_once("meekrodb.php");
require_once("conn.php");
require_once("helpers.php");
require_once("libraries.php");
require_once("graphlib.php");
define("DOMOTIKA", true);
if(startsWith($_SERVER['SCRIPT_FILENAME'], DOMOTIKAD_HTTPPATH)) {
if(file_exists(DOMOTIKAD_HTTPPATH."includes/common.php"))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment