<commit_before>/** Lines **/
Flotr.addType('lines', {
  options: {
    show: false,           // => setting to true will show lines, false will hide
    lineWidth: 2,          // => line width in pixels
    fill: false,           // => true to fill the area from the line to the x axis, false for (transparent) no fill
    fillColor: null,       // => fill color
    fillOpacity: 0.4,      // => opacity of the fill color, set to 1 for a solid fill, 0 hides the fill
    stacked: false         // => setting to true will show stacked lines, false will show normal lines
  },
  /**
   * Draws lines series in the canvas element.
   * @param {Object} series - Series with options.lines.show = true.
   */
  draw: function(series){

    var ctx = this.ctx,
      lineWidth = series.lines.lineWidth,
      shadowSize = series.shadowSize,
      offset;

    series = series || this.series;

    ctx.save();
    ctx.translate(this.plotOffset.left, this.plotOffset.top);
    ctx.lineJoin = 'round';
    this.lines.clip();

    if(shadowSize){

      ctx.lineWidth = shadowSize / 2;
      offset = lineWidth/2 + ctx.lineWidth/2;
      
      ctx.strokeStyle = "rgba(0,0,0,0.1)";
      this.lines.plot(series, offset + shadowSize/2, false);

      ctx.strokeStyle = "rgba(0,0,0,0.2)";
      this.lines.plot(series, offset, false);

      if(series.lines.fill) {
        ctx.fillStyle = "rgba(0,0,0,0.05)";
        this.lines.plotArea(series, offset + shadowSize/2, false);
      }
    }

    ctx.lineWidth = lineWidth;
    ctx.strokeStyle = series.color;
    if(series.lines.fill){
      ctx.fillStyle = this.processColor(series.lines.fillColor || series.color, {opacity: series.lines.fillOpacity});
      this.lines.plotArea(series, 0, true);
    }

    this.lines.plot(series, 0, true);
    ctx.restore();
  },

  plot: function(series, offset, incStack){

    var ctx = this.ctx,
      xa = series.xaxis,
      ya = series.yaxis,
      data = series.data, 
      length = data.length - 1, i,
      plotWidth = this.plotWidth, 
      plotHeight = this.plotHeight,
      prevx = null,
      prevy = null,
      x1, x2, y1, y2, stack1, stack2;
      
    if(data.length < 2) return;

    ctx.beginPath();

    for(i = 0; i < length; ++i){

      // To allow empty values
      if (data[i][1] === null || data[i+1][1] === null) continue;

      // Zero is infinity for log scales
      if (xa.options.scaling === 'logarithmic' && (data[i][0] <= 0 || data[i+1][0] <= 0)) continue;
      if (ya.options.scaling == 'logarithmic' && (data[i][1] <= 0 || data[i+1][1] <= 0)) continue;
      
      x1 = xa.d2p(data[i][0]);
      x2 = xa.d2p(data[i+1][0]);
      
      if (series.lines.stacked) {

        stack1 = xa.values[data[i][0]].stack || 0;
        stack2 = xa.values[data[i+1][0]].stack || xa.values[data[i][0]].stack || 0;

        y1 = ya.d2p(data[i][1] + stack1);
        y2 = ya.d2p(data[i+1][1] + stack2);
        
        if(incStack){
          xa.values[data[i][0]].stack = data[i][1]+stack1;
            
          if(i == length-1)
            xa.values[data[i+1][0]].stack = data[i+1][1]+stack2;
        }
      }
      else{
        y1 = ya.d2p(data[i][1]);
        y2 = ya.d2p(data[i+1][1]);
      }

      // Clip against graph bottom edge.
      if(y1 >= y2 && y1 >= plotHeight){
        // Line segment is outside the drawing area.
        if(y2 >= plotHeight) continue;

        // Compute new intersection point.
        x1 = x1 - (y1 - plotHeight - 1) / (y2 - y1) * (x2 - x1);
        y1 = plotHeight - 1;
      }
      else if(y2 >= y1 && y2 >= plotHeight){
        if(y1 >= plotHeight) continue;
        x2 = x1 - (y1 - plotHeight - 1) / (y2 - y1) * (x2 - x1);
        y2 = plotHeight - 1;
      }

      // Clip against graph top edge.
      if(y1 <= y2 && y1 < 0) {
        if(y2 < 0) continue;
        x1 = x1 - y1 / (y2 - y1) * (x2 - x1);
        y1 = 0;
      }
      else if(y2 <= y1 && y2 < 0){
        if(y1 < 0) continue;
        x2 = x1 - y1 / (y2 - y1) * (x2 - x1);
        y2 = 0;
      }

      // Clip against graph left edge.
      if(x1 <= x2 && x1 < 0){
        if(x2 < 0) continue;
        y1 = y1 - x1 / (x2 - x1) * (y2 - y1);
        x1 = 0;
      }
      else if(x2 <= x1 && x2 < 0){
        if(x1 < 0) continue;
        y2 = y1 - x1 / (x2 - x1) * (y2 - y1);
        x2 = 0;
      }

      // Clip against graph right edge.
      if(x1 >= x2 && x1 >= plotWidth){
        if (x2 >= plotWidth) continue;
        y1 = y1 + (plotWidth - x1) / (x2 - x1) * (y2 - y1);
        x1 = plotWidth - 1;
      }
      else if(x2 >= x1 && x2 >= plotWidth){
        if(x1 >= plotWidth) continue;
        y2 = y1 + (plotWidth - x1) / (x2 - x1) * (y2 - y1);
        x2 = plotWidth - 1;
      }

      if((prevx != x1) || (prevy != y1 + offset))
        ctx.moveTo(x1, y1 + offset);
      
      prevx = x2;
      prevy = y2 + offset;<commit_msg>Removed old clipping detection.  Retain boundary detection for performance (drawing outside clip is faster than drawing inside clip but not free).<commit_after>/** Lines **/
Flotr.addType('lines', {
  options: {
    show: false,           // => setting to true will show lines, false will hide
    lineWidth: 2,          // => line width in pixels
    fill: false,           // => true to fill the area from the line to the x axis, false for (transparent) no fill
    fillColor: null,       // => fill color
    fillOpacity: 0.4,      // => opacity of the fill color, set to 1 for a solid fill, 0 hides the fill
    stacked: false         // => setting to true will show stacked lines, false will show normal lines
  },
  /**
   * Draws lines series in the canvas element.
   * @param {Object} series - Series with options.lines.show = true.
   */
  draw: function(series){

    var ctx = this.ctx,
      lineWidth = series.lines.lineWidth,
      shadowSize = series.shadowSize,
      offset;

    series = series || this.series;

    ctx.save();
    ctx.translate(this.plotOffset.left, this.plotOffset.top);
    ctx.lineJoin = 'round';
    this.lines.clip();

    if(shadowSize){

      ctx.lineWidth = shadowSize / 2;
      offset = lineWidth/2 + ctx.lineWidth/2;
      
      ctx.strokeStyle = "rgba(0,0,0,0.1)";
      this.lines.plot(series, offset + shadowSize/2, false);

      ctx.strokeStyle = "rgba(0,0,0,0.2)";
      this.lines.plot(series, offset, false);

      if(series.lines.fill) {
        ctx.fillStyle = "rgba(0,0,0,0.05)";
        this.lines.plotArea(series, offset + shadowSize/2, false);
      }
    }

    ctx.lineWidth = lineWidth;
    ctx.strokeStyle = series.color;
    if(series.lines.fill){
      ctx.fillStyle = this.processColor(series.lines.fillColor || series.color, {opacity: series.lines.fillOpacity});
      this.lines.plotArea(series, 0, true);
    }

    this.lines.plot(series, 0, true);
    ctx.restore();
  },

  plot: function(series, offset, incStack){

    var ctx = this.ctx,
      xa = series.xaxis,
      ya = series.yaxis,
      data = series.data, 
      length = data.length - 1, i,
      plotWidth = this.plotWidth, 
      plotHeight = this.plotHeight,
      prevx = null,
      prevy = null,
      x1, x2, y1, y2, stack1, stack2;
      
    if(data.length < 2) return;

    ctx.beginPath();

    for(i = 0; i < length; ++i){

      // To allow empty values
      if (data[i][1] === null || data[i+1][1] === null) continue;

      // Zero is infinity for log scales
      if (xa.options.scaling === 'logarithmic' && (data[i][0] <= 0 || data[i+1][0] <= 0)) continue;
      if (ya.options.scaling == 'logarithmic' && (data[i][1] <= 0 || data[i+1][1] <= 0)) continue;
      
      x1 = xa.d2p(data[i][0]);
      x2 = xa.d2p(data[i+1][0]);
      
      if (series.lines.stacked) {

        stack1 = xa.values[data[i][0]].stack || 0;
        stack2 = xa.values[data[i+1][0]].stack || xa.values[data[i][0]].stack || 0;

        y1 = ya.d2p(data[i][1] + stack1);
        y2 = ya.d2p(data[i+1][1] + stack2);
        
        if(incStack){
          xa.values[data[i][0]].stack = data[i][1]+stack1;
            
          if(i == length-1)
            xa.values[data[i+1][0]].stack = data[i+1][1]+stack2;
        }
      }
      else{
        y1 = ya.d2p(data[i][1]);
        y2 = ya.d2p(data[i+1][1]);
      }

      if ((y1 >= plotHeight && y2 >= plotHeight) || 
        (y1 <= 0 && y2 <= 0) ||
        (x1 <= 0 && x2 <= 0) ||
        (x1 >= plotWidth && x2 >= plotWidth)) continue;

      if((prevx != x1) || (prevy != y1 + offset))
        ctx.moveTo(x1, y1 + offset);
      
      prevx = x2;
      prevy = y2 + offset;
{'fraction_non_alphanumeric': 0.16479005395261553, 'fraction_numerical': 0.03729767769176636, 'mean_word_length': 1.955632582322357, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 31, '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': '6092944', 'n_tokens_mistral': 3169, 'n_tokens_neox': 3045, 'n_words': 745}