First, this is not an array type array (array[n][n]), what you are doing is an object that has an array in the properties (Object{x:[n]}).
Ex:
var i = 0;
var result = null;
[{Estado: "SP", Venda: "200Temers"}].forEach((item) => { result[item.Estado][i] = ; i++; })
// Seu result vai virar isso aqui:
// result = { SP: [ "200Temers" ] }
Okay, after this conceptual correction, let’s continue. I imagine that the result you are looking for is a property for each state and each property of that will have an array with sales, so:
var resultados = {};
$scope.filteredDados.forEach((arrayItem) => {
resultados[arrayItem.Estado] = resultados[arrayItem.Estado] || [];
resultados[arrayItem.Estado].push(arrayItem.Venda)
});
for (atributo in resultados) {
resultados[atributo].forEach((venda) => {
console.log(atributo + ": " + venda);
})
}
What’s in this array
$scope.filteredDados
?– lenilsondc
@Lenilsondecastro a json
– Alisson Acioli
I imagine so, but I meant what data is in it?
– lenilsondc
@Lenilsondecastro are like this:
{"Ano":2016, "Mês": 1, "Estado":"SP", "Cultura": "x", "Segmento":"y", "Venda": "300.00"}
– Alisson Acioli
Then my reply should serve you as a look http://answall.com/a/160493/57237
– lenilsondc