0

我正在使用反应图表 js。i我在我的页面中添加了条形图,我的图表数据是:

const data = {
          labels: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
          datasets: [
            {
              backgroundColor: '#db3eb1',
              data: [7, 8, 3],
            },
            {
              backgroundColor: '#db3eb1',
              data: [0, 9, 7],
            },
            {
              backgroundColor: '#db3eb1',
              data: [0, 10, 12],
            },
          ],
        };

然后我尝试将这些数据动态更改,但它无法正常工作。动态数据为:

[{"backgroundColor":"#db3eb1","data":[1.119]},
{"backgroundColor":"#db3eb1","data":[1.103]},    
{"backgroundColor":"#db3eb1","data":[1.105]},    
{"backgroundColor":"#db3eb1","data":[1.096]},
{"backgroundColor":"#db3eb1","data":[1.22,1.097]},
{"backgroundColor":"#db3eb1","data":[1.092]}]

如何解决这个问题?

4

0 回答 0