我怎样才能实现这种行为?

问题描述 投票:0回答:0

I want to display these 2 lines on the chart, and the black line should stop like that and don't propagate to 2024

这些是每一行的数据,第一行:

"fairValues": [
                {
                    "year": "01-01-2017",
                    "fairValue": 50.00
                },
                {
                    "year": "01-01-2018",
                    "fairValue": 52.50
                },
                {
                    "year": "01-01-2019",
                    "fairValue": 58.00
                },
                {
                    "year": "01-01-2020",
                    "fairValue": 71.81
                },
                {
                    "year": "01-01-2021",
                    "fairValue": 100.92
                },
                {
                    "year": "01-01-2022",
                    "fairValue": 120.28
                },
                {
                    "year": "01-01-2023",
                    "fairValue": 115.41
                },
                {
                    "year": "01-01-2024",
                    "fairValue": 121.91
                }
            ]

第二个:

"values": [
                {
                    "year": "01-01-2017",
                    "value": 22.45
                },
                {
                    "year": "01-01-2018",
                    "value": 40.17
                },
                {
                    "year": "01-01-2019",
                    "value": 38.00
                },
                {
                    "year": "01-01-2020",
                    "value": 71.81
                },
                {
                    "year": "01-01-2021",
                    "value": 130.92
                },
                {
                    "year": "01-01-2022",
                    "value": 176.28
                },
                {
                    "year": "01-01-2023",
                    "value": 129.78
                },
                {
                    "year": "03-04-2023",
                    "value": 146.92
                }
            ]

我尝试在图表的选项中更改时间类型但没有用,我也尝试在

{year: "01-01-2024", value: null}
数组中添加一个
values
的值,但也没有用

reactjs charts chart.js react-chartjs-2
© www.soinside.com 2019 - 2024. All rights reserved.