object array Group by an element?
<p>Please see this example: <a href="http://jsfiddle.net/minagabriel/nayS7/" rel="nofollow">JsFiddle</a> </p>

<p>Question : i have the following Array Object </p>

<pre><code>y= [ {"LngTrend":15,"DblValue":10,"DtmStamp":1358226000000},     
{"LngTrend":16,"DblValue":92,"DtmStamp":1358226000000},    
{"LngTrend":17,"DblValue":45,"DtmStamp":1358226000000},
{"LngTrend":18,"DblValue":87,"DtmStamp":1358226000000},


{"LngTrend":15,"DblValue":10,"DtmStamp":1358226060000},
{"LngTrend":16,"DblValue":87,"DtmStamp":1358226060000},
{"LngTrend":17,"DblValue":45,"DtmStamp":1358226060000},
{"LngTrend":18,"DblValue":92,"DtmStamp":1358226060000} ]
</code></pre>

<p>I was trying to group these object by <code>DtmStamp</code> end up having something like this : </p>

<pre><code> x =  [[1358226000000,10,92,45,87],[1358226060000,10,87,45,92], .......]
</code></pre>

<p>In other words: </p>

<pre><code>x[0][0] = y[0].DtmStamp ;
x[0][1] = y[0].LngTrend ;
x[0][2] = y[1].LngTrend ;
x[0][3] = y[2].LngTrend ; 
x[0][4] = y[3].LngTrend ;
</code></pre>

<p>Unfortunately it ends with something I don't want. </p>

<p>Here is what I have tried so far: </p>

<pre><code>   var dataTrendArray = [];
           $.each(x, function (index, value) {
                var trendArray = [];
                if (index % 4 == 0) {
                    trendArray.push(x[index].DtmStamp);
                    for (var i = 0; i &lt; 4; i++) {
                        index = eval(index + i);
                        trendArray.push(x[index].DblValue);
                    }
                }

               console.log(trendArray) ;
                dataTrendArray.push(trendArray);
            });
</code></pre>

<p>Can some one help me get on the right path?</p>
