EVR.include("level/summary/graph/Margin.js");
EVR.include("level/summary/graph/Set.js");
EVR.include("level/summary/graph/Plot.js");
EVR.Level.Summary.Graph = function(cell, level)
{
   this.level = level;
   this.road = level.road;
   this.field = level.container;
   EVR.Table.call(this, cell, 1, 1);
   this.title = GRAPH_TITLE;
   this.font_size = GRAPH_FONT_SIZE;
   this.font_color = GRAPH_FONT_COLOR;
   this.colors = GRAPH_COLORS;
   this.set_measurements();
   this.element.bgColor = GRAPH_PLOT_BACKGROUND_COLOR;
   cell.style.verticalAlign = "middle";
   cell.style.paddingLeft = GRAPH_MARGIN;
   this.add_components();
   this.initialize_sets();
   this.plot = new EVR.Level.Summary.Graph.Plot(this, this.sets);
   this.insert_title();
   this.append();
}
EVR.Level.Summary.Graph.prototype = new EVR.Table;
EVR.Level.Summary.Graph.prototype.set_measurements = function()
{
   var level = this.level;
   var history = level.history;
   var measurements = [history.get_accuracies(), history.get_times()];
   for (var ii = 0; ii < measurements.length; ii++)
   {
      measurements[ii] = measurements[ii].slice(-GRAPH_HISTORY_LENGTH);
   }
   this.measurements = measurements;
}
EVR.Level.Summary.Graph.prototype.insert_title = function()
{
   var cell = this.insert_cell(this.insert_row(0));
   var text = this.build_title_text();
   var font = GRAPH_TITLE_FONT;
   var color = this.font_color;
   var size = this.font_size;
   var title = new EVR.Text(cell, text, font, color, size, this.field);
   cell.height = "1";
   cell.style.background = GRAPH_TITLE_BACKGROUND;
   cell.style.textAlign = "center";
   cell.style.letterSpacing = GRAPH_TITLE_LETTER_SPACING;
   cell.colSpan = this.get_rows()[1].cells.length;
   this.title = title;
}
EVR.Level.Summary.Graph.prototype.build_title_text = function()
{
   var count = this.measurements[0].length;
   var text = GRAPH_TITLE;
   if (count > 1)
   {
      text += " " + count;
   }
   return text;
}
EVR.Level.Summary.Graph.prototype.add_components = function()
{
   var row = this.insert_row();
   var cells = [];
   cells[0] = [this.insert_margin_cell(row)];
   cells[1] = [this.insert_margin_cell(row)];
   this.first_row = row;
   row = this.insert_row();
   cells[0].push(this.insert_margin_cell(row, true));
   cells[1].push(this.insert_margin_cell(row, true));
   var colors = this.colors;
   var left = new EVR.Level.Summary.Graph.Margin(cells[0], this, colors[0]);
   var right = new EVR.Level.Summary.Graph.Margin(cells[1], this, colors[1]);
   this.margins = [left, right];
}
EVR.Level.Summary.Graph.prototype.insert_margin_cell = function(row, bottom)
{
   var cell = this.insert_cell(row);
   cell.style.padding = "0 " + GRAPH_MARGIN_PADDING;
   cell.style.verticalAlign = bottom ? "bottom" : "top";
   cell.style.backgroundColor = GRAPH_MARGIN_BACKGROUND;
   return cell;
}
EVR.Level.Summary.Graph.prototype.initialize_sets = function()
{
   var sets = [];
   var margins = this.margins;
   var measurements = this.measurements;
   var reverse, color, set;
   for (var ii = 0, len = measurements.length; ii < len; ii++)
   {
      reverse = measurements[ii][0] instanceof EVR.Time;
      color = this.colors[ii];
      set = new EVR.Level.Summary.Graph.Set(
	 measurements[ii], margins[ii], color, reverse);
      sets.push(set);
   }
   this.sets = sets;
}
EVR.Level.Summary.Graph.prototype.insert_plot_cell = function(spacer)
{
   var row = this.first_row;
   var cell = row.insertCell(row.cells.length - 1);
   cell.rowSpan = 2;
   cell.style.verticalAlign = "bottom";
   if (spacer)
   {
      cell.style.paddingRight = GRAPH_BAR_PADDING;
   }
   return cell;
}
EVR.Level.Summary.Graph.prototype.draw = function()
{
   this.title.set_font_size();
   this.plot.draw();
   var margins = this.margins;
   for (var ii = 0; ii < margins.length; ii++)
   {
      margins[ii].draw();
   }
}
EVR.Level.Summary.Graph.prototype.toString = function()
{
   return "[object EVR.Level.Summary.Graph]";
}
EVR.Level.Summary.Graph.Set = function(measurements, margin, color, reverse)
{
   this.measurements = measurements;
   this.margin = margin;
   this.color = color;
   this.reverse = reverse || false;
   this.set_bounds();
}
EVR.Level.Summary.Graph.Set.prototype.set_bounds = function()
{
   var measurements = this.measurements;
   var min = measurements[0];
   var max = measurements[0];
   var measurement;
   for (var ii = 0, len = measurements.length; ii < len; ii++)
   {
      measurement = measurements[ii];
      if (measurement > max)
      {
	 max = measurement;
      }
      else if (measurement < min)
      {
	 min = measurement;
      }
   }
   var reverse = this.reverse;
   this.best = reverse ? min : max;
   this.worst = reverse ? max : min;
   this.range = Math.abs(this.best - this.worst);
   this.display();
}
EVR.Level.Summary.Graph.Set.prototype.display = function()
{
   var precision = GRAPH_PRECISION;
   var worst = this.worst.toString(precision);
   var best = this.best.toString(precision);
   this.margin.set_bounds(worst, best);
}
EVR.Level.Summary.Graph.Set.prototype.toString = function()
{
   return "[EVR.Level.Summary.Graph.Set]";
}
EVR.Level.Summary.Graph.Margin = function(cells, graph, color)
{
   this.cells = cells;
   this.graph = graph;
   this.color = color;
   this.initialize_text();
}
EVR.Level.Summary.Graph.Margin.prototype.initialize_text = function()
{
   var cells = this.cells;
   this.maximum = this.build_text(cells[0]);
   this.minimum = this.build_text(cells[1]);
}
EVR.Level.Summary.Graph.Margin.prototype.build_text = function(cell)
{
   var graph = this.graph;
   var font = GRAPH_MARGIN_TEXT_FONT;
   var color = GRAPH_MARGIN_TEXT_COLOR;
   var size = graph.font_size;
   var field = graph.field;
   var text = new EVR.Text(cell, null, font, color, size, field);
   text.set_color(this.color);
   return text;
}
EVR.Level.Summary.Graph.Margin.prototype.set_bounds = function(minimum, maximum)
{
   this.minimum.set(minimum);
   this.maximum.set(maximum);
}
EVR.Level.Summary.Graph.Margin.prototype.draw = function()
{
   this.maximum.set_font_size();
   this.minimum.set_font_size();
}
EVR.Level.Summary.Graph.Margin.prototype.toString = function()
{
   return "[EVR.Level.Summary.Graph.Margin]";
}
216.73.216.176
216.73.216.176
216.73.216.176
 
July 18, 2022


A new era ‼

Our infrastructure has recently upgraded ‼

Nugget Communications Bureau 👍

You've never emailed like this before ‼

Roundcube

Webmail software for reading and sending email from @nugget.fun and @shampoo.ooo addresses.

Mailman3

Email discussion lists, modernized with likes and emojis. It can be used for announcements and newsletters in addition to discussions. See lists for Picture Processing or Scrapeboard. Nowadays, people use Discord, but you really don't have to!

FreshRSS

With this hidden in plain sight, old technology, even regular people like you and me can start our own newspaper or social media feed.

Nugget Streaming Media 👍

The content you crave ‼

HLS

A live streaming, video format based on M3U playlists that can be played with HTML5.

RTMP

A plugin for Nginx can receive streaming video from ffmpeg or OBS and forward it as an RTMP stream to sites like Youtube and Twitch or directly to VLC.


Professional ‼

Nugget Productivity Suite 👍

Unleash your potential ‼

Kanboard

Virtual index cards you can use to gamify your daily grind.

Gitea

Grab whatever game code you want, share your edits, and report bugs.

Nugget Security 👍

The real Turing test ‼

Fail2ban

Banning is even more fun when it's automated.

Spamassassin

The documentation explains, "an email which mentions rolex watches, Viagra, porn, and debt all in one" will probably be considered spam.

GoAccess

Display HTTP requests in real time, so you can watch bots try to break into WordPress.

Nugget Entertainment Software 👍

The best in gaming entertainment ‼

Emoticon vs. Rainbow

With everything upgraded to the bleeding edge, this HTML4 game is running better than ever.


Zoom ‼

The game engine I've been working on, SPACE BOX, is now able to export to web, so I'm planning on turning nugget.fun into a games portal by releasing my games on it and adding an accounts system. The upgraded server and software will make it easier to create and maintain. I'm also thinking of using advertising and subscriptions to support the portal, so some of these services, like webmail or the RSS reader, may be offered to accounts that upgrade to a paid subscription.