0
我有通過API檢索如下一個JSON,如何獲得具有相同價值的財產計數?
http://www.jsoneditoronline.org/?id=3d6078cbb11e7e5b3989320ff1cc00c1
我循環通過結果集並創建票證對象如下,
data.ticket.seating.forEach((seat: any) => {
this.listings.push({ section: seat.section, selling: data.price.selling, amount: data.ticket.amount, type: data.ticket.type, row: seat.row });
this.barChartLabels.push(data.price.selling);
this.barChartData[0].data.push() // how to push the count of tickets which has the same price.
});
在上面的代碼,如何獲得具有相同價格的門票數量?還有如何獲得所有門票中的最高價格?
僅供瞭解:您想按價格對門票進行分組嗎? – floriangosse
你有什麼嘗試?這裏的答案應該給你一個提示:[*如何保存兩個或更多數組中存在的項目並返回該數組?](http://stackoverflow.com/questions/42336471/how-to-preserve-items -thats-present-in-two-or-more-arrays-and-return-an-array-o) – RobG
@floriangosse是按價格對門票進行分組 – user2280016