flotr2.nolibs.js
function(){
    var csv = '',
        series = this.series,
        options = this.options,
        dg = this.spreadsheet.loadDataGrid(),
        separator = encodeURIComponent(options.spreadsheet.csvFileSeparator);
    
    if (options.spreadsheet.decimalSeparator === options.spreadsheet.csvFileSeparator) {
      throw "The decimal separator is the same as the column separator ("+options.spreadsheet.decimalSeparator+")";
    }
    
    // The first row
    _.each(series, function(serie, i){
      csv += separator+'"'+(serie.label || String.fromCharCode(65+i)).replace(/\"/g, '\\"')+'"';
    });

    csv += "%0D%0A"; // \r\n
    
    // For each row
    csv += _.reduce(dg, function(memo, row){
      var rowLabel = getRowLabel.call(this, row[0]) || '';
      rowLabel = '"'+(rowLabel+'').replace(/\"/g, '\\"')+'"';
      var numbers = row.slice(1).join(separator);
      if (options.spreadsheet.decimalSeparator !== '.') {
        numbers = numbers.replace(/\./g, options.spreadsheet.decimalSeparator);
      }
      return memo + rowLabel+separator+numbers+"%0D%0A"; // \t and \r\n
    }, '', this);

    if (Flotr.isIE && Flotr.isIE < 9) {
      csv = csv.replace(new RegExp(separator, 'g'), decodeURIComponent(separator)).replace(/%0A/g, '\n').replace(/%0D/g, '\r');
      window.open().document.write(csv);
    }
    else window.open('data:text/csv,'+csv);
  }
function(){
    var csv = '',
        series = this.series,
        options = this.options,
        dg = this.spreadsheet.loadDataGrid(),
        separator = encodeURIComponent(options.spreadsheet.csvFileSeparator);
    
    if (options.spreadsheet.decimalSeparator === options.spreadsheet.csvFileSeparator) {
      throw "The decimal separator is the same as the column separator ("+options.spreadsheet.decimalSeparator+")";
    }
    
    // The first row
    _.each(series, function(serie, i){
      csv += separator+'"'+(serie.label || String.fromCharCode(65+i)).replace(/\"/g, '\\"')+'"';
    });

    csv += "%0D%0A"; // \r\n
    
    // For each row
    csv += _.reduce(dg, function(memo, row){
      var rowLabel = getRowLabel.call(this, row[0]) || '';
      rowLabel = '"'+(rowLabel+'').replace(/\"/g, '\\"')+'"';
      var numbers = row.slice(1).join(separator);
      if (options.spreadsheet.decimalSeparator !== '.') {
        numbers = numbers.replace(/\./g, options.spreadsheet.decimalSeparator);
      }
      return memo + rowLabel+separator+numbers+"%0D%0A"; // \t and \r\n
    }, '', this);

    if (Flotr.isIE && Flotr.isIE < 9) {
      csv = csv.replace(new RegExp(separator, 'g'), decodeURIComponent(separator)).replace(/%0A/g, '\n').replace(/%0D/g, '\r');
      window.open().document.write(csv);
    }
    else window.open('data:text/csv,'+csv);
  }
function ( ) { var csv = '' , series = this . series , options = this . options , dg = this . spreadsheet . loadDataGrid ( ) , separator = encodeURIComponent ( options . spreadsheet . csvFileSeparator ) ; if ( options . spreadsheet . decimalSeparator === options . spreadsheet . csvFileSeparator ) { throw "The decimal separator is the same as the column separator (" + options . spreadsheet . decimalSeparator + ")" ; } // The first row _ . each ( series , function ( serie , i ) { csv += separator + '"' + ( serie . label || String . fromCharCode ( 65 + i ) ) . replace ( / \" / g , '\\"' ) + '"' ; } ) ; csv += "%0D%0A" ; // \r\n // For each row csv += _ . reduce ( dg , function ( memo , row ) { var rowLabel = getRowLabel . call ( this , row [ 0 ] ) || '' ; rowLabel = '"' + ( rowLabel + '' ) . replace ( / \" / g , '\\"' ) + '"' ; var numbers = row . slice ( 1 ) . join ( separator ) ; if ( options . spreadsheet . decimalSeparator !== '.' ) { numbers = numbers . replace ( / \. / g , options . spreadsheet . decimalSeparator ) ; } return memo + rowLabel + separator + numbers + "%0D%0A" ; // \t and \r\n } , '' , this ) ; if ( Flotr . isIE && Flotr . isIE < 9 ) { csv = csv . replace ( new RegExp ( separator , 'g' ) , decodeURIComponent ( separator ) ) . replace ( / %0A / g , '\n' ) . replace ( / %0D / g , '\r' ) ; window . open ( ) . document . write ( csv ) ; } else window . open ( 'data:text/csv,' + csv ) ; }
Converts the data into CSV in order to download a file
Converts the data into CSV in order to download a file