Index: /trunk/FACT++/src/smartfact.cc
===================================================================
--- /trunk/FACT++/src/smartfact.cc	(revision 13848)
+++ /trunk/FACT++/src/smartfact.cc	(revision 13849)
@@ -304,5 +304,5 @@
 // ========================================================================
 
-class StateMachineSmartFACT : public StateMachineDim//, public DimInfoHandler
+class StateMachineSmartFACT : public StateMachineDim
 {
 private:
@@ -407,4 +407,6 @@
         void WriteBinary(const EventImp &d, const string &fname, const T &t, double scale, double offset=0)
     {
+        const Statistics stat(t);
+
         vector<uint8_t> val(t.size(), 0);
         for (uint64_t i=0; i<t.size(); i++)
@@ -424,4 +426,8 @@
         out << offset << '\n';
         out << offset+scale << '\n';
+        out << setprecision(3);
+        out << stat.min << '\n';
+        out << stat.med << '\n';
+        out << stat.max << '\n';
         out.write(ptr, val.size()*sizeof(uint8_t));
 
@@ -1391,5 +1397,5 @@
 
         // -------------- System status --------------
-        if (fMcpConfigurationState>=5) // Idle
+        if (fDimMcp.state()>=5) // Idle
         {
             string col = kHtmlBlue;
Index: /trunk/FACT++/www/smartfact/index.js
===================================================================
--- /trunk/FACT++/www/smartfact/index.js	(revision 13848)
+++ /trunk/FACT++/www/smartfact/index.js	(revision 13849)
@@ -204,5 +204,6 @@
         switch (args[i])
         {
-        case "max": $("body").setAttribute("data-max", "yes"); continue;
+        case "max":     $("body").setAttribute("data-max",     "yes"); continue;
+        case "noslide": $("body").setAttribute("data-noslide", "yes"); continue;
         }
 
@@ -802,9 +803,9 @@
 
     var W = window.innerWidth;
-    if (W==0)
-    {
-        $("table"+newz).style.left="0px";
+    if (W==0 || $("body").getAttribute("data-noslide")=="yes")
+    {
         $("body").setAttribute("data-visible", newz);
         $("body").removeChild($("table"+oldz));
+        $("table"+newz).style.left="0px";
         return;
     }
@@ -819,6 +820,6 @@
     // This is needed on my mobile to ensure that te browser
     // doesn't try to zoom during shifting
-    //    $("table"+newz).style.position="fixed";
-    //    $("table"+oldz).style.position="fixed";
+    $("table"+newz).style.position="fixed";
+    $("table"+oldz).style.position="fixed";
 
     intervalSlide = setInterval(function(){doShift(oldz,newz)}, 75);
@@ -835,5 +836,5 @@
         $("body").removeChild(t0);
 
-        // t1.style.position="absolute";
+        t1.style.position="absolute";
 
         // Now the scroll bar might have to appear or disappear
@@ -1264,12 +1265,19 @@
 }
 
-function drawCamLegend(canv, min, max)
-{
+function drawCamLegend(canv, data)
+{
+    var umin = data[1];
+    var umax = data[2];
+
     var unit = canv.getAttribute("data-data");//.split("/");
-    if (unit.length>0)
-        unit = " "+unit;
-
-    var v0 = parseFloat(min);
-    var v1 = parseFloat(max);
+    unit = unit.replace("&deg;", "\u00B0");
+    unit = unit.replace("&deg;", "\u00B5");
+
+    var min = data[3]+unit
+    var med = data[4]+unit;
+    var max = data[5]+unit;
+
+    var v0 = parseFloat(umin);
+    var v1 = parseFloat(umax);
 
     var diff = v1-v0;
@@ -1289,11 +1297,27 @@
         ctx.strokeText((v0+diff*i/10).toPrecision(3)+unit, cw-5, 125-i*12);
     }
-}
-
-function drawGraph(canv, min, max, data)
+
+    var mw = Math.max(ctx.measureText(min).width,
+                      ctx.measureText(med).width,
+                      ctx.measureText(max).width);
+
+    ctx.textBaseline = "top";
+    ctx.strokeStyle  = "#000";
+
+    ctx.strokeText(min, 5+mw, 5);
+    ctx.strokeText(med, 5+mw, 5+12);
+    ctx.strokeText(max, 5+mw, 5+24);
+}
+
+function drawGraph(canv, vals, data)
 {
     var unit = canv.getAttribute("data-data");//.split("/");
-    if (unit.length>0)
-        unit = " "+unit;
+    unit = unit.replace("&deg;",   "\u00B0");
+    unit = unit.replace("&micro;", "\u00B5");
+
+    var umin = vals[1]+unit;
+    var umax = vals[2]+unit;
+
+    var stat = vals[3]+unit+"   /   "+vals[4]+unit+"   /   "+vals[5]+unit;
 
     var cw = canv.width;
@@ -1309,6 +1333,6 @@
     ctx.textAlign = "right";
 
-    var dim0 = ctx.measureText(min+unit);
-    var dim1 = ctx.measureText(max+unit);
+    var dim0 = ctx.measureText(umin);
+    var dim1 = ctx.measureText(umax);
 
     var tw = Math.max(dim0.width, dim1.width)+dw+2;
@@ -1317,6 +1341,6 @@
     var mr = 10;   // margin right
 
-    var mt = fs/2+5; // margin top
-    var mb = fs/2+4; // margin bottom
+    var mt = 5+2*fs+4; // margin top
+    var mb = fs/2+4;   // margin bottom
 
     var nx = 20;
@@ -1352,11 +1376,11 @@
     for (var i=1; i<=nx; i++)
     {
-        ctx.moveTo(ml+w/nx*i, ch-mb);
-        ctx.lineTo(ml+w/nx*i,    mt);
+        ctx.moveTo(ml+w*i/nx, ch-mb);
+        ctx.lineTo(ml+w*i/nx,    mt);
     }
     for (var i=0; i<ny; i++)
     {
-        ctx.moveTo(ml,   mb+h/ny*i);
-        ctx.lineTo(ml+w, mb+h/ny*i);
+        ctx.moveTo(ml,   mt+h*i/ny);
+        ctx.lineTo(ml+w, mt+h*i/ny);
     }
     ctx.stroke();
@@ -1373,11 +1397,11 @@
     for (var i=1; i<=nx; i++)
     {
-        ctx.moveTo(ml+w/nx*i, ch-mb-dw);
-        ctx.lineTo(ml+w/nx*i, ch-mb+dw);
+        ctx.moveTo(ml+w*i/nx, ch-mb-dw);
+        ctx.lineTo(ml+w*i/nx, ch-mb+dw);
     }
     for (var i=0; i<ny; i++)
     {
-        ctx.moveTo(ml-dw, mb+h/ny*i);
-        ctx.lineTo(ml+dw, mb+h/ny*i);
+        ctx.moveTo(ml-dw, mt+h*i/ny);
+        ctx.lineTo(ml+dw, mt+h*i/ny);
     }
     ctx.stroke();
@@ -1385,8 +1409,12 @@
 
     ctx.textBaseline = "bottom";
-    ctx.strokeText(min+unit, ml-dw-2, ch-1);
+    ctx.strokeText(umin, ml-dw-2, ch-1);
+
+    ctx.textBaseline = mt>fs/2 ? "middle" : "top";
+    ctx.strokeText(umax, ml-dw-2, mt);
 
     ctx.textBaseline = "top";
-    ctx.strokeText(max+unit, ml-dw-2, 0);
+    ctx.textAlign    = "center";
+    ctx.strokeText(stat, ml+w/2, 5);
 }
 
@@ -1410,5 +1438,7 @@
         return;
 
-    var l = data[0].length+1+data[1].length+1+data[2].length+1;
+    var len = 0;
+    for (var i=0; i<6; i++)
+        len += data[i].length+1;
 
     switch (type)
@@ -1416,9 +1446,9 @@
         //case "camera": drawCam(result);     break;
     case "hist":
-        drawGraph(canv, data[1], data[2], result.substr(l));
+        drawGraph(canv, data, result.substr(len));
         break;
     case "camera":
-        drawFullCam(result.substr(l));
-        drawCamLegend(canv, data[1], data[2]);
+        drawFullCam(result.substr(len));
+        drawCamLegend(canv, data);
         break;
     }
