我正在使用 React Recharts 进行可视化,但是,我在显示具有不同相应对象内容的简单条形图时遇到了挑战。
[
{
"month": "2017-07",
"commodities": [
{ "name": "wheat", "moves": 100, "avg_weight": 167 },
{ "name": "maize", "moves": 150, "avg_weight": 367 },
{ "name": "grains", "moves": 89, "avg_weight": 467 }
]
},
{
"month": "2017-08",
"commodities": [
{ "name": "mangoes", "moves": 140, "avg_weight": 167 },
{ "name": "grains", "moves": 190, "avg_weight": 47 }
]
},
{
"month": "2017-09",
"commodities": [
{ "name": "wheat", "moves": 130, "avg_weight": 267 },
{ "name": "tomatoes", "moves": 176, "avg_weight": 132 },
{ "name": "onions", "moves": 120, "avg_weight": 47 }
]
},
{
"month": "2018-10",
"commodities": [
{ "name": "oranges", "moves": 130, "avg_weight": 267 },
]
},
]
我有这个示例 json 对象,我想将月份作为我的 XAxis 和商品的移动作为我的 YAxs。理想情况下,下图表示我希望如何显示我的数据。谢谢您的帮助,。