~sircmpwn/hnstats

97d331d6045d23771943e9813123578cd75c5fbd — Drew DeVault 7 years ago 4c96d3b
Drop event lines (buggy)
1 files changed, 0 insertions(+), 44 deletions(-)

M templates/article.html
M templates/article.html => templates/article.html +0 -44
@@ 216,50 216,6 @@ function createTimeChart(selector, yfunc, filter, invert) {
      .attr("class", "axis axis--y")
      .call(d3.axisLeft(y));

  var eventDates = { };

  function eventLine(events, name) {
    for (var i = 0; i < events.length; i++) {
      var event = events[i];
      var _x = x(event.date);
      if (_x <= 0) {
        continue;
      }
      var _y = height - 5;
      if (eventDates[event.date]) {
        _y -= eventDates[event.date] * 8;
        eventDates[event.date]++;
      } else {
        eventDates[event.date] = 1;
      }
      g.append("line")
        .attr("class", "event")
        .attr("x1", _x)
        .attr("y1", 0)
        .attr("x2", _x)
        .attr("y2", height);
      if (_x < width / 2) {
        g.append("text")
          .attr("class", "event-text")
          .attr("x", _x + 5)
          .attr("y", _y)
          .text("title change");
      } else {
        g.append("text")
          .attr("class", "event-text")
          .attr("x", _x - 5)
          .attr("y", _y)
          .attr("text-anchor", "end")
          .text(name);
      }
    }
  }
  if (samples.length > 5) {
    eventLine(data.title_changes, "title change");
    eventLine(data.url_changes, "url change");
    eventLine(data.status_changes, "status change");
  }

  g.append("path")
      .datum(samples)
      .attr("class", "line")