From 5a163788a9fb0e507af7f2e1a765bbbaa71e704d Mon Sep 17 00:00:00 2001 From: betateilchen <> Date: Fri, 20 Mar 2015 15:15:58 +0000 Subject: [PATCH] statistics: rework started - bring back colored bars in legend - remove dummy and eventTypes from Top10 git-svn-id: https://svn.fhem.de/fhem/trunk@8248 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/contrib/statistics/data/style.css | 75 ++++++++++++++++++++++++++ fhem/contrib/statistics/statistics.cgi | 65 +++++++++++----------- 2 files changed, 110 insertions(+), 30 deletions(-) create mode 100644 fhem/contrib/statistics/data/style.css diff --git a/fhem/contrib/statistics/data/style.css b/fhem/contrib/statistics/data/style.css new file mode 100644 index 000000000..69a930b2b --- /dev/null +++ b/fhem/contrib/statistics/data/style.css @@ -0,0 +1,75 @@ +body { border:0; background-color: #FFFFE7; + font-family:Arial, sans-serif; font-size:16px;} +input { font-family:Arial, sans-serif; font-size:16px; } +select { font-family:Arial, sans-serif; font-size:16px; } + +#logo { margin-top:10px; margin-left:20px; width:120px; height:132px; + background-image:url(fhemicon.png); } +#menu { margin-top:10px; margin-left:20px; width:140px; } +#menuScrollArea { width: 175px; left:0px; top:0px; height:100%; + position:fixed; overflow-x:hidden; overflow-y:auto; } + +#hdr { position:absolute; top:10px; left:180px; } +#content { position:absolute; top:50px; left:180px; bottom:20px; right:10px; } +/*#rightcontent { position:absolute; top:0px; left:0px; bottom:20px; right:10px; }*/ + +#connect_err { background-color: #000000; color: #FFFFFF; + position:absolute; top:0px; left:40px; z-index: 10; } +.devType { padding-top:20px; } +a { color: #278727; } +img { border-style: none; } + +.wide { width:100%; } + +table.block { border:1px solid gray; background: #F8F8E0; } +table.block tr.odd { background: #F0F0D8; } +table.block tr.sel { background: #F0F0D8; } +table { border-radius:8px; } + +table.room { border:1px solid gray; width: 100%; background: #D7FFFF; } +table.room tr.sel { background: #A0FFFF; } + +#right { position:absolute; top:0px; left:180px; width:80%; height:100%; } + +h2,h3,h4 { color:#52865D; line-height:1.3; + margin-top:1.5em; font-family:Arial,Sans-serif; } +div.dist { padding-top:0.3em; } +button.dist { margin:10px; background:transparent; border:0px; cursor:pointer; } + +a img { border-style:none; } +.col2 { text-align:center; } + +/* detail-selector & slider */ +.makeTable { display:inline; float:left; clear:left; + margin-top:10px; margin-bottom:20px;} +.makeSelect { display:inline; float:left; clear:left; } + +select { margin-left:5px; margin-right:5px; } +.get,.set,.attr { margin-bottom:5px; float:left; } +.slider { float:left; width:250px; height:26px; } + +/* detail only */ +.makeSelect .slider {background:#F0F0D8; border-radius:8px;} + +/* timepicker */ +.set .set { margin-bottom:2px; margin-top:3px; } + +.handle { position:relative; cursor:pointer; width:50px; + height:20px; line-height:20px; + -webkit-user-select:none; -moz-user-select:none; -user-select:none; + border:3px solid; color:#278727; text-align:center; } +.downText { margin-top:2px; } + +pre { white-space: pre-wrap; } + +#svg { height:32px; width:32px; fill:#278727; } +#svg.on,svg.FS20_on { fill:orange; } + +/* next lines are for remotecontrol */ +.rc_body { border-style: solid; border-color: gray; border-width: 2px; padding: 5px; + background: #C8C8B0; font-size:6px;} +.rc_button { padding: 5px 7px;} +.rc_button img { border-style: solid; border-width: 1px; border-color: transparent; } +.rc_button img:active { border-color: gray; } + +.changed { color:red; } diff --git a/fhem/contrib/statistics/statistics.cgi b/fhem/contrib/statistics/statistics.cgi index ac0fb2970..1fb3d2a09 100755 --- a/fhem/contrib/statistics/statistics.cgi +++ b/fhem/contrib/statistics/statistics.cgi @@ -1,11 +1,12 @@ #!/usr/bin/perl -w ################################################################ # $Id$ -# vim: ts=2:et # # (c) 2012 Copyright: Martin Fischer (m_fischer at gmx dot de) # All rights reserved # +# Rework started: 2015 by betateilchen +# # This script free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or @@ -69,20 +70,20 @@ my %tblColName; my %tblSum; my %tblCnt; -# cascading style sheet -my $css = "http://fhem.de/../css/style.css"; - -# exclude modules from top 10 graph -my $excludeFromTop10modules = "at autocreate notify telnet weblink FileLog FHEMWEB Global SUNRISE_EL"; -my $excludeFromTop10definitions = "at autocreate notify telnet weblink FileLog FHEMWEB Global SUNRISE_EL"; - # directory cointains databases my $datadir = "./data"; +# cascading style sheet +#my $css = "http://fhem.de/../css/style.css"; +my $css = "$datadir/style.css"; + # geo ip database file from http://www.maxmind.com/download/geoip/database/ # should be updated once per month my $geoIPDat = "$datadir/GeoLiteCity.dat"; +# exclude modules from top 10 +my $excludeModules = "at autocreate dummy eventTypes notify telnet weblink FileLog FHEMWEB Global SUNRISE_EL"; + # database my $dbf = "$datadir/fhem_statistics_db.sqlite"; my $dsn = "dbi:SQLite:dbname=$dbf"; @@ -114,23 +115,22 @@ sub viewStatistics() { my $cArch = drawPieChart("nodes","arch","Architecture",390,300,"chart_arch"); my $cRelease = drawPieChart("nodes","release","FHEM Release",390,300,"chart_release"); my $cPerl = drawPieChart("nodes","perl","Perl Version",390,300,"chart_perl"); - my $cModulesTop10 = drawColumnChartTop10Modules("modules","modulestop10",,"Used",800,300,"chart_modulestop10"); - my $cModDefTop10 = drawColumnChartTop10ModDef("modules","definitions","Definitions",800,300,"chart_moddeftop10"); + my $cModulesTop10 = drawColumnChartTop10Modules("modules","modulestop10",,"Used",800,300,"chart_modulestop10"); + my $cModDefTop10 = drawColumnChartTop10ModDef("modules","definitions","Definitions",800,300,"chart_moddeftop10"); #my $cModules = drawBarChartModules("modules","modules","Used","Definitions",800,600,"chart_modules"); - my $mWorld = drawRegionsMap("locations","countryname","world","map_world"); - my $mEU = drawRegionsMap("locations","countryname","150","map_europe"); - my $mWesternEU = drawMarkersMap("locations","city","155","map_germany"); - my $tModules = drawTable3cols("modules","total_modules","string","Module","number","Used","number","Definitions","table_modules"); + my $mWorld = drawRegionsMap("locations","countryname","world","map_world"); + my $mEU = drawRegionsMap("locations","countryname","150","map_europe"); + my $mWesternEU = drawMarkersMap("locations","city","155","map_germany"); + my $tModules = drawTable3cols("modules","total_modules","string","Module","number","Used","number","Definitions","table_modules"); #my $tModDef = drawTable("modules","total_moddef","string","Module","number","Definitions","table_moddef"); - my $tModels = drawTable2cols("models","total_models","string","Model","boolean","defined","table_models"); + my $tModels = drawTable2cols("models","total_models","string","Model","boolean","defined","table_models"); my @res = $dbh->selectrow_array("SELECT created FROM db"); my $since = "@res"; - print header; +# print header; print start_html( -title => 'fhem.de - Statistics', -author => 'm_fischer@gmx.de', - -base => 'true', -style => {-src => $css}, -meta => {'keywords' => 'fhem houseautomation statistics'}, -script => [ @@ -149,17 +149,19 @@ sub viewStatistics() { my ($nodes) = $dbh->selectrow_array("SELECT COUNT(uniqueID) FROM nodes"); print <