title: count json lines dynamically
body: <p>I asked this question earlier this morning 
  "here is my JSON file : </p>
  
  <pre><code>[
  {
      "Week": "1145",
      "Sev_Logged": "3_major",
      "From": "IN1"
  },
  {
      "Week": "1145",
      "Sev_Logged": "4_minor",
      "From": "IN1"
  },
  {
      "Week": "1145",
      "Sev_Logged": "4_minor",
      "From": "IN1"
  },
  {
      "Week": "1145",
      "Sev_Logged": "4_minor",
      "From": "IN1"
  },
  {
      "Week": "1145",
      "Sev_Logged": "4_minor",
      "From": "IN1"
  },
  {
      "Week": "1145",
      "Sev_Logged": "4_minor",
      "From": "IN2"
  },
  {
      "Week": "1145",
      "Sev_Logged": "3_major",
      "From": "IN2"
  },
  ];
  </code></pre>
  
  <p>I want to count the "from : IN1" field for each "week", per example for week : 1145 i'd get : 3, and for "From : IN2" i'd get 2</p>
  
  <p>Thanks"</p>
  
  <p>Thank you VDP for your answer, so I did this : 
  My store is now like : </p>
  
  <pre><code>Ext.define('Metrics.store.GraphData', {
  extend : 'Ext.data.Store',
  model : 'Metrics.model.GraphData',
  autoload : true,
  
  proxy : {
      type : 'ajax',
      url : 'data/metrics_data.json',
      reader : {
          type : 'json',
          root : 'data',
          successProperty : 'success'
      }
  },
  //data : GraphData, //povide inline data or load using proxy
  countBy: function(param){
      var count = {};
      this.each(function(item){
          var type = item.get(param);
          if (Ext.isDefined(count[type])){
              count[type]++;
          } else {
              count[type] = 1;
          }                               
      });
      return count;
  }
  });
  </code></pre>
  
  <p>And my model : </p>
  
  <pre><code>Ext.define('Metrics.model.GraphData', {
  extend: 'Ext.data.Model',
  //fields: ['week', 'sev']
  fields : [ 
      {name: 'Week',  type: 'int'},
      {name: 'Sev_Logged',   type: 'string'},
      {name: 'From', type: 'string'}
  ]
  });
  </code></pre>
  
  <p>Since i'm using extjs 4 with MVC model, I have made a controller wich controls the event of a button, right now it looks like this : </p>
  
  <pre><code>launchGraph : function(button){
  console.log('clicked the apply button');
  var chartStore = this.getGraphDataStore();
  chartStore.load({
      callback: this.onGraphDataLoad,
      scope: this,
      console.log(chartStore.countBy("From"))
      });
  </code></pre>
  
  <p>But when I click the apply button I get this error in my controller : </p>
  
  <pre><code>"Uncaught SyntaxError: Unexpected token . "
  </code></pre>
  
  <p>And it points to the line :</p>
  
  <pre><code> "console.log(chartStore.countBy("From"))"
  </code></pre>
  
  <p>It seems like i have an error in the referencing to my store. Any ideas?</p>