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]";
}
54.91.16.95
54.91.16.95
54.91.16.95
 
September 30, 2015


Edge of Life is a form I made with Babycastles and Mouth Arcade for an event in New York called Internet Yami-ichi, a flea market of internet-ish goods. We set up our table to look like a doctor's office and pharmacy and offered free examinations and medication prescriptions, a system described by one person as "a whole pharmacy and medical industrial complex".

Diagnoses were based on responses to the form and observations by our doctor during a short examination. The examination typically involved bizarre questions, toy torpedoes being thrown at people and a plastic bucket over the patient's head. The form combined ideas from Myers-Briggs Type Indicators, Codex Seraphinianus and chain-mail personality tests that tell you which TV show character you are. In our waiting room, we had Lake of Roaches installed in a stuffed bat (GIRP bat). It was really fun!

The icons for the food pyramid are from Maple Story and the gun icons are from the dingbat font Outgunned. I'm also using Outgunned to generate the items in Food Spring.


↠ RSS Feed ↞