<commit_before>Polymer({
    is: 'multi-line',
    properties: {
        title: '',
        inputs: {
            notify: true,
            type: Array,
            value: [{
                input: 'x',
                txt: 'Pick a x',
                selectedValue: -1,
                uitype: 'single-value',
                notify: true,
            }, {
                input: 'y',
                txt: 'Pick y',
                selectedValue: [],
                uitype: 'multi-value',
                notify: true
            }]
        },
        settings: {
            notify: true,
            type: Array,
            value: []
        },
        hideSettings: true,
        source: [],
        external: Array,
        svg: Object
    },

    behaviors: [
        PolymerD3.chartBehavior,
        PolymerD3.colorPickerBehavior
    ],

    attached: function() {
      var me = this;
      var callback = function(data) {
          me.source = data;
      }
      PolymerD3.fileReader("ms.csv", [1, 2, 3], [0], "%Y%m%d", callback);
    },

    draw: function() {
      var me = this;

      if (me.getInputsProperty('x') === -1 || me.getInputsProperty('y').length === 0) {
        throw new Error('Inputs not selected');
      }

      me.makeChartWrap();
      var margin = me.getMargins();
      var width = me.getWidth() - margin.left - margin.right;
      var height = me.getHeight() - margin.top - margin.bottom;
      var svg = me.svg;
      PolymerD3.setSvgArea (svg, width, height, margin);
      var g = svg.select("g").attr("transform", "translate(" + margin.left + "," + margin.top + ")");   
        
 
      //var parseTime = d3.timeParse("%Y%m%d");
      var xAxis = PolymerD3.axis('time', 'Tabbrmonth');
      var yAxis = PolymerD3.axis('number').orient("left");
      var x = xAxis.scale().range([0, width]),
          y = yAxis.scale().range([height, 0]),
          color = d3.scale.category10();
      //z = d3.scale.ordinal(d3.schemeCategory10);

      var line = d3.svg.line().interpolate("basis")
          .x(function(d) {
              return x(d[0]);
          })
          .y(function(d) {
              return y(d[1]);
          });

      var data = this.source;

      //load this from input
      var yHeaders = [];
      me.getInputsProperty('y').forEach(function (ele) { 
        me.external.forEach (function (anExternal) { 
          if(anExternal.value === ele) { 
            yHeaders.push([anExternal.key, anExternal.value]);
          } 
        });
      });

      //load this from input
      var xInput = me.getInputsProperty('x'); 
      var xHeader = [me.external[xInput].key, me.external[xInput].value];
      
      var cities = yHeaders.map(function(aRow) {
          return {
              id: aRow[0],
              values: function() {
                  var tArray = []
                  data.map(function(d) {
                      tArray.push([d[xHeader[1]], d[aRow[1]]]);
                  });
                  return tArray;
              }()
          };
      });

      x.domain(d3.extent(data, function(d) {
          return d[xHeader[1]];
      }));

      y.domain([
          d3.min(cities, function(c) {
              return d3.min(c.values, function(d) {
                  return d[1];
              });
          }),
          d3.max(cities, function(c) {
              return d3.max(c.values, function(d) {
                  return d[1];
              });
          })
      ]);

      color.domain(cities.map(function(c) {
          return c.id;
      }));

     g.append("g")
          .attr("class", "axis axis--x")
          .attr("transform", "translate(0," + height + ")")
          .call(xAxis);

     g.append("g")
          .attr("class", "axis axis--y")
          .call(yAxis)
          .append("text")
          .attr("transform", "rotate(-90)")
          .attr("y", 6)
          .attr("dy", "0.71em")
          .attr("fill", "#000")
          .text("Temperature, ºF");

      var city = g.selectAll(".city")
          .data(cities)
          .enter().append("g")
          .attr("class", "city");

      city.append("path")
          .attr("class", "line")
          .attr("d", function(d) {
              return line(d.values);
          })
          .style("stroke", function(d) {
              return color(d.id);
          });

      city.append("text")
          .datum(function(d) {
              return {
                  id: d.id,
                  value: d.values[d.values.length - 1]
              };
          })
          .attr("transform", function(d) {
              return "translate(" + x(d.value[0]) + "," + y(d.value[1]) + ")";
          })
          .attr("x", 3)
          .attr("dy", "0.35em")
          .style("font", "10px sans-serif")
          .text(function(d) {
              return d.id;
          });
    }
});<commit_msg>multi line working<commit_after>Polymer({
    is: 'multi-line',
    properties: {
        title: '',
        inputs: {
            notify: true,
            type: Array,
            value: [{
                input: 'x',
                txt: 'Pick a x',
                selectedValue: -1,
                uitype: 'single-value',
                notify: true,
                selectedObjs: [],
                name:'',
                scaleType: '',
                format:'',

            }, {
                input: 'y',
                txt: 'Pick y',
                selectedValue: [],
                uitype: 'multi-value',
                notify: true,
                selectedObjs: [],
                name:'',
                scaleType: '',
                format:'',
            }]
        },
        settings: {
            notify: true,
            type: Array,
            value: []
        },
        hideSettings: true,
        source: [],
        external: Array,
        svg: Object
    },

    behaviors: [
        PolymerD3.chartBehavior,
        PolymerD3.colorPickerBehavior
    ],

    attached: function() {
      var me = this;
      var callback = function(data) {
          me.source = data;
      }
      PolymerD3.fileReader("ms.csv", [1, 2, 3], [0], "%Y%m%d", callback);
      this.inputs[0].selectedValue = 0;
      this.inputs[0].name = 'time';
      this.inputs[1].selectedValue  = [1,2,3];
      this.inputs[1].name = ['<NAME>','<NAME>', 'Austin'];

      this.external = [ {'key':"Time", 'value':0, 'scaleType':'time', 'format':'time'},
       {'key':"<NAME>", 'value':1, 'scaleType':'linear', 'format':'number'},
       {'key':"<NAME>", 'value':2, 'scaleType':'linear', 'format':'number'},
       {'key':"Austin", 'value':3, 'scaleType':'linear', 'format':'number'}];

    },

    draw: function() {
      var me = this;
      var xIndex = me.getInputsProperty('x');
      var yIndex = me.getInputsProperty('y');
      if ( xIndex === -1 || yIndex.length === 0) {
        throw new Error('Inputs not selected');
      }
      var data = this.source;
      var dataStat = PolymerD3.summarizeData(data, 0, 'time', [1,2,3], 'number', false);
      var xBound = dataStat.getXDomain();
      var yBound = dataStat.getYDomain();

      var config = {'scaleType':"time", 
        'align':'h', 'format':'time', 'position':'bottom','domain':xBound};
      var xAxis = me.createAxis(config);
      var x = xAxis.scale();

      config = {'scaleType':"linear", 
        'align':'v', 'format':'currency', 'position':'left','domain':[0, yBound[1]]};
      var yAxis = me.createAxis(config);
      var y = yAxis.scale();

      var color = d3.scale.category10();
      //z = d3.scale.ordinal(d3.schemeCategory10);
      var dataStruct = PolymerD3.rollupMultiValued(
        this.inputs[1].selectedValue, 
        this.inputs[1].name,
        xIndex, data);

      var line = d3.svg.line().interpolate("basis")
          .x( (d) => { 
            return x(d.x);
             })
          .y( (d) => { 
            return y(d.y); 
          });

      var aGroup = this.parentG.selectAll(".groups")
          .data(dataStruct)
          .enter().append("g")
          .attr("class", "groups");

      aGroup.append("path")
          .attr("class", "line")
          .attr("d", (d) => { 
            return line(d.values); 
          })
          .style("stroke", (d) => { 
            return color(d.id); 
          });

      aGroup.append("text")
          .datum((d) => {
              return {
                  id: d.id,
                  value: d.values[d.values.length - 1]
              };
          })
          .attr("transform", (d) => {
              return "translate(" + x(d.value.x) + "," + y(d.value.y) + ")";
          })
          .attr("x", 3)
          .attr("dy", "0.35em")
          .style("font", "10px sans-serif")
          .text((d) => {
              return d.id;
          });
    }
});
{'fraction_non_alphanumeric': 0.17345193294560382, 'fraction_numerical': 0.011745923138328201, 'mean_word_length': 1.4354346014995834, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 14, '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': '7523890', 'n_tokens_mistral': 2768, 'n_tokens_neox': 2634, 'n_words': 500}