0

我正在使用react-native-svg-charts制作StackedAreaChart,这是我正在使用的数据格式

 const hardCodedData = [
        {
            month: new Date(2015, 0, 1),
            BackLeft: 1600,
            BackRight: 1440,
            FrontLeft: 960,
            FrontRight: 400,
        },
        {
            month: new Date(2015, 4, 1),
            BackLeft: 3840,
            BackRight: 1920,
            FrontLeft: 960,
            FrontRight: 400,
        },
        {
            month: new Date(2015, 8, 1),
            BackLeft: 640,
            BackRight: 960,
            FrontLeft: 3640,
            FrontRight: 400,
        },
        {
            month: new Date(2015, 3, 7),
            BackLeft: 3320,
            BackRight: 480,
            FrontLeft: 640,
            FrontRight: 400,
        },
    ]

我面临的问题是,我不会总是date为所有 4 个条目获得相同的值,例如

 {
   month: new Date(2015, 4, 1),
   BackLeft: 3840,
   BackRight: "not available",
   FrontLeft: 960,
   FrontRight: "not available",
 },

我试图把undefined,但我有一个错误。

我该如何处理这种类型的变化?

4

0 回答 0