Hamburger Hamburger

Heizungssteuerung Web-Interface

HV_colorMap

To have a unicly defined color map for all temperatures this function returns the appropriate color for the given temperature argument. (Additionally a text color which contrasts nicely to the temperature color is returned.)

If the temperature argument is set to 'bar', the color bar is composed and returned as html.

<?php 
/* published under GPL www.gnu.org/licenses/gpl.html */
  /*
   echo "<html><table>";
   $bar = HV_colorMap("bar");
   echo $bar;
   }
   echo "</table></html>";
  */

function HV_colorMap($T){
  /* old set
  $bgc["-10"]=" #000066"; $txt["-10"]="white";
  $bgc["0"]  =" #0000ff"; $txt["0"]  ="white";
  $bgc["10"] =" #0066ff"; $txt["10"] ="black";
  $bgc["20"] =" #00ffd6"; $txt["20"] ="black";
  $bgc["30"] =" #00ff33"; $txt["30"] ="black";
  $bgc["40"] =" #ffff00"; $txt["40"] ="black";
  $bgc["50"] =" #ff9900"; $txt["50"] ="black";
  $bgc["60"] =" #ff0000"; $txt["60"] ="white";
  $bgc["70"] =" #b80096"; $txt["70"] ="white";
  $bgc["80"] ="fuchsia"; $txt["80"] ="black";
  */
  $bgc["-1000"]=" #ffffff"; $txt["-1000"]="white";
  $bgc["-10"]=" #01006c"; $txt["-10"]="white";
  $bgc["-5"] =" #0000fe"; $txt["-5"] ="white";
  $bgc["0"]  =" #0c2df6"; $txt["0"]  ="white";
  $bgc["5"]  =" #0062ff"; $txt["5"]  ="white";
  $bgc["10"] =" #0099ff"; $txt["10"] ="black";
  $bgc["15"] =" #00ccff"; $txt["15"] ="black";
  $bgc["20"] =" #339933"; $txt["20"] ="white";
  $bgc["25"] =" #009900"; $txt["25"] ="white";
  $bgc["30"] =" #33cc33"; $txt["30"] ="black";
  $bgc["35"] =" #69ff65"; $txt["35"] ="black";
  $bgc["40"] =" #ffff66"; $txt["40"] ="black";
  $bgc["45"] =" #ffff00"; $txt["45"] ="black";
  $bgc["50"] =" #ff9703"; $txt["50"] ="black";
  $bgc["55"] =" #fc6700"; $txt["55"] ="black";
  $bgc["60"] =" #ff3300"; $txt["60"] ="white";
  $bgc["65"] =" #ff68a5"; $txt["65"] ="white";
  $bgc["70"] =" #cc3467"; $txt["70"] ="white";
  $bgc["75"] ="fuchsia"; $txt["75"] ="black";

  if($T=="bar"){
    $colorBar ="<table>";
    $keys = array_keys($bgc);
    $NoColors=count($bgc);
    for($c=0;$c<$NoColors;$c++){
      $cc=$NoColors-$c-1;
      $colorBar.="<tr><td align='right'
                  style='background-color:".$bgc[$keys[$cc]].";
                  color:".$txt[$keys[$cc]].";'>".$keys[$cc]."</td></tr>";
    } #c
    $colorBar.="</table>";
    return $colorBar;
  }else{
    $keys = array_keys($bgc);
    $NoColors=count($bgc);
    for($c=0;$c<$NoColors;$c++){
      $thisKey=$keys[$NoColors-$c-1];
      if($T>1.0*$thisKey-2.5){
	return array($bgc[$thisKey],$txt[$thisKey]);
      } #fi
    } #c
    return array("white","black");
  }
}
?>

Index of Library

1EM_editParameter.php
2EM_handleJSON.php
3EM_plot.php
4HV_Admin_Login.php
5HV_colorMap.php
6HV_composeH2Oplot.php
7HV_config.php
8HV_H2Olevel.php
9HV_readOperationState.php
10HV_restart.php
11HV_serviceLog.php
12HV_setParameters.php
13HV_showHouse.php
14HV_showLog.php
15HV_showWeatherForecast.php
16HV_TempCal.php
17index.php
18readFilenames.php
19readNamedData.php

Der gesamte Sourcecode darf gemäß GNU General Public License weiterverbreitet werden.