this.setState(prevState => {
const data = prevState.data.map(obj => {
if (obj.id == 1) {
obj.series.map(item => {
item.data.map(i => {
if (item.id === 1) {
i.y = bonusData ? bonusData.accountWeightsFinish : null;
} else if (item.id === 2) {
i.y = bonusData ? bonusData.accountWeightsDDU : null;
} else if (item.id === 3) {
i.y = bonusData ? bonusData.accountWeightsFinish : null;
}
})
});
} else if (obj.id == 2) {
} else if (obj.id == 3) {
}
});
return {
data
};
}, () => {
console.log('state', this.state);
});
data: [ { id: "1", name: "Индивидульный", values: [24, 85], series: [{ id: 1, name: "Move", data: [{ color: { linearGradient: { x1: 0, x2: 0, y1: 0, y2: 1 }, stops: [ [0, "#dfff46"], [1, "#00f40a"] ] }, radius: "112%", innerRadius: "88%", y: null }] } } ] надо обновить только y
Обсуждают сегодня