<commit_before>ScrollView = require 'scroll-view'
d3 = require 'd3.v3'

module.exports =
class EditorStatsView extends ScrollView
  @activate: (rootView, state) ->
    @instance = new EditorStatsView(rootView)

  @content: (rootView) ->
    @div class: 'editor-stats-wrapper', tabindex: -1, =>
      @div class: 'editor-stats', outlet: 'editorStats'

  initialize: (@rootView) ->
    super

    @command 'core:cancel', @detach
    @statusBar = @rootView.find('.status-bar')
    @css 'background', @statusBar.css('background-color')

  draw: ->
    @x ?= d3.scale.ordinal().domain d3.range(@stats.hours * 60)
    @y ?= d3.scale.linear()
    w = @rootView.vertical.width()
    h = @height()
    [pt, pl, pb, pr] = [15, 10, 3, 25]

    data = d3.entries @stats.eventLog

    @x.rangeBands [0, w - pl - pr], 0.2
    @y.range [h - pt - pb, 0]

    @xaxis ?= d3.svg.axis().scale(@x).orient('top').tickFormat (d) =>
               d = new Date(@stats.startDate.getTime() + (d * 6e4))
               mins = d.getMinutes()
               mins = "0#{mins}" if mins <= 9
               "#{d.getHours()}:#{mins}"
    @xaxis.tickSize(-h + pt + pb, 50)

    vis = d3.select(@editorStats.get(0)).append('svg')
      .attr('width', w)<commit_msg>Don't rely on status bar for background color<commit_after>ScrollView = require 'scroll-view'
d3 = require 'd3.v3'

module.exports =
class EditorStatsView extends ScrollView
  @activate: (rootView, state) ->
    @instance = new EditorStatsView(rootView)

  @content: (rootView) ->
    @div class: 'editor-stats-wrapper', tabindex: -1, =>
      @div class: 'editor-stats', outlet: 'editorStats'

  initialize: (@rootView) ->
    super

    @command 'core:cancel', @detach

  draw: ->
    @x ?= d3.scale.ordinal().domain d3.range(@stats.hours * 60)
    @y ?= d3.scale.linear()
    w = @rootView.vertical.width()
    h = @height()
    [pt, pl, pb, pr] = [15, 10, 3, 25]

    data = d3.entries @stats.eventLog

    @x.rangeBands [0, w - pl - pr], 0.2
    @y.range [h - pt - pb, 0]

    @xaxis ?= d3.svg.axis().scale(@x).orient('top').tickFormat (d) =>
               d = new Date(@stats.startDate.getTime() + (d * 6e4))
               mins = d.getMinutes()
               mins = "0#{mins}" if mins <= 9
               "#{d.getHours()}:#{mins}"
    @xaxis.tickSize(-h + pt + pb, 50)

    vis = d3.select(@editorStats.get(0)).append('svg')
      .attr('width', w)
{'fraction_non_alphanumeric': 0.18684541265186427, 'fraction_numerical': 0.025136154168412233, 'mean_word_length': 2.634703196347032, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3830217', 'n_tokens_mistral': 913, 'n_tokens_neox': 870, 'n_words': 195}