<commit_before>_ = require "underscore"

Annotation = require "./annotation"
Renderer = require "../renderers/renderer"
p = require "../../core/properties"

class LabelView extends Renderer.View
  initialize: (options) ->
    super(options)
    @$el.appendTo(@plot_view.$el.find('div.bk-canvas-overlays'))
    @$el.addClass('label')
    @$el.hide()

  bind_bokeh_events: () ->
    if @mget('render_mode') == 'css'
      # dispatch CSS update immediately
      @listenTo(@model, 'data_update', @render)
    else
      @listenTo(@model, 'data_update', @plot_view.request_render)

  render: () ->

    @set_data(@mget('source'))

    if @mget('render_mode') == 'css'
      @_css_text()
    else
      @_canvas_text()

  _canvas_text: () ->
    ctx = @plot_view.canvas_view.ctx

    x_offset = @mget('x_offset')
    y_offset = @mget('y_offset')

    [@sx, @sy] = @map_to_screen(_.map(@x, (x) -> x + x_offset),
                                _.map(@y, (y) -> y + y_offset))

    debugger;
    for i in [0...@x.length]
      ctx.save()
      ctx.translate(@sx[i], @sy[i])<commit_msg>Remove debugger statement<commit_after>_ = require "underscore"

Annotation = require "./annotation"
Renderer = require "../renderers/renderer"
p = require "../../core/properties"

class LabelView extends Renderer.View
  initialize: (options) ->
    super(options)
    @$el.appendTo(@plot_view.$el.find('div.bk-canvas-overlays'))
    @$el.addClass('label')
    @$el.hide()

  bind_bokeh_events: () ->
    if @mget('render_mode') == 'css'
      # dispatch CSS update immediately
      @listenTo(@model, 'data_update', @render)
    else
      @listenTo(@model, 'data_update', @plot_view.request_render)

  render: () ->

    @set_data(@mget('source'))

    if @mget('render_mode') == 'css'
      @_css_text()
    else
      @_canvas_text()

  _canvas_text: () ->
    ctx = @plot_view.canvas_view.ctx

    x_offset = @mget('x_offset')
    y_offset = @mget('y_offset')

    [@sx, @sy] = @map_to_screen(_.map(@x, (x) -> x + x_offset),
                                _.map(@y, (y) -> y + y_offset))

    for i in [0...@x.length]
      ctx.save()
      ctx.translate(@sx[i], @sy[i])
{'fraction_non_alphanumeric': 0.18337975858867223, 'fraction_numerical': 0.0009285051067780873, 'mean_word_length': 2.8345195729537367, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '4817366', 'n_tokens_mistral': 781, 'n_tokens_neox': 756, 'n_words': 140}