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