Radmon -> Google Gauge visualization

  • AstroW
  • AstroW's Avatar
  • Visitor
  • Visitor
6 years 10 months ago #3219 by AstroW
Replied by AstroW on topic Radmon -> Google Gauge visualization
Still no success :(

Please Log in or Create an account to join the conversation.

More
6 years 10 months ago - 6 years 10 months ago #3221 by OM1AMJ
In this line
<meta http-equiv="refresh" content=”30">
you have one quotation wrong (before 30).
But I do not know if this is a problem.
Last edit: 6 years 10 months ago by OM1AMJ.

Please Log in or Create an account to join the conversation.

  • AstroW
  • AstroW's Avatar
  • Visitor
  • Visitor
6 years 10 months ago #3222 by AstroW
Replied by AstroW on topic Radmon -> Google Gauge visualization
Got it, thanks :-)
Working fine now!

Please Log in or Create an account to join the conversation.

More
5 years 1 month ago #4337 by s52sk
Hi OM1AMj
What must be changed to get same gauge with uSV radings...Thanks and 73s

Marco

Please Log in or Create an account to join the conversation.

More
5 years 3 weeks ago - 5 years 3 days ago #4366 by ZschorlRad
Here is the code for µSv/h:

<?php
$user = "xxxxxxx"; // change to your user name
$warning = "0.3";
$alert = "0.85";
$size = "150";

$url = "http://www.radmon.org/radmon.php?function=lastreading&user=$user";
$page = fopen($url, 'r');
$content = "";
while( !feof( $page ) ) {
$buffer = trim( fgets( $page, 4096 ) );
$content .= $buffer;
}

$startcpm = "";
$endcpm = " CPM";
preg_match( "/$startcpm(.*)$endcpm/s", $content, $match);
$cpm = $match[1];
$usvh = round($cpm/175.43, 4); //convert CPM to uSv/h (175.43 is for SBM-20 tube), change to your GM tube
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title><?php echo "Google Gauge - $user"; ?></title>
<meta name="robots" content="noindex,follow">
<meta name="googlebot" content="nosnippet,noarchive">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
<meta HTTP-EQUIV="Expires" CONTENT="-1">
<meta http-equiv="refresh" content="120">

<style type="text/css">
body { background-color: #AFC3C9; }
#container { height: 100%; width: 100%; display: table; }
#inner { vertical-align: middle; display: table-cell; }
#gauge_div { width: <?php echo "$size"; ?>px; margin: 0 auto; }
.auto-style1 {
text-align: left;
}
.auto-style2 {
text-align: center;
font-family: Arial, Helvetica, sans-serif;
font-size: small;
}
.auto-style3 {
font-family: "Trebuchet MS", "Lucida Sans Unicode", "Lucida Grande", "Lucida Sans", Arial, sans-serif;
}
</style>

<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js'>
<script type='text/javascript' src='https://www.google.com/jsapi'>
<script type='text/javascript'>

// maximum value for the gauge
var max_gauge_value = 0.4;
// name of the gauge
var gauge_name = 'µSv/h';

// global variables
var chart, charts, data;

// load the google gauge visualization
google.load('visualization', '1', {packages:});
google.setOnLoadCallback(initChart);

// display the data
function displayData(point) {
data.setValue(0, 0, gauge_name);
data.setValue(0, 1, point);
chart.draw(data, options);
}

// load the data
function loadData() {
// variable for the data point
var p;

p = <?php echo "$usvh"; ?>;

// if there is a data point display it
if (p) {

displayData(p);
};
}

// initialize the chart
function initChart() {

data = new google.visualization.DataTable();
data.addColumn('string', 'Label');
data.addColumn('number', 'Value');
data.addRows(1);

chart = new google.visualization.Gauge(document.getElementById('gauge_div'));
options = {width: <?php echo "$size"; ?>, height: <?php echo "$size"; ?>, redFrom: <?php echo "$alert"; ?>, redTo: 1, yellowFrom: <?php echo "$warning"; ?>, yellowTo: <?php echo "$alert"; ?>, greenFrom: 0, greenTo: <?php echo "$warning"; ?>, minorTicks: 25, max: 1.000};

loadData();

// load new data every 120 seconds
setInterval('loadData()', 120000);
}

</script>

</head>

<body>
<div class="auto-style2">
<strong><span class="auto-style3">Ortsdosisleistung (ODL)</span></strong></div>
<div id="container">
<div id="inner">
<div id="gauge_div" class="auto-style1"><br></div>
</div>
</div>
</body>
</html>

Good luck
Uwe

Weather Zschorlau
Last edit: 5 years 3 days ago by ZschorlRad.

Please Log in or Create an account to join the conversation.

More
5 years 5 days ago #4368 by pilovis
Tested on php5, does not work.

Please Log in or Create an account to join the conversation.

Moderators: Gamma-Man
Time to create page: 0.221 seconds
Powered by Kunena Forum
Everything's free. Please support us by considering a donation. Log in first!
Solar powered Raspberry Pi 4 server stats: CPU 41% Memory 12% Swap 12% CPU temp=53.0'C Uptime 19 Days