[英]Plot two lines on the same row on a graph
I am trying to create a medical graph to display the heart rate.我正在尝试创建一个医学图表来显示心率。 It will have the live data on the left part and the prediction forecast on the right.它将在左侧显示实时数据,在右侧显示预测预测。 I will get both from the backend API, and I need now to show them as one line on the graph.我将从后端 API 获取两者,现在我需要在图表上将它们显示为一条线。 I am using ReactJs and chart.JS.我正在使用 ReactJs 和 chart.JS。 Look the picture below to understand better: ( https://i.stack.imgur.com/qWd6H.jpg )tter:看下面的图片可以更好地理解:( https://i.stack.imgur.com/qWd6H.jpg )tter:
I just tried to do the regression but it will be done from the backend.我只是尝试进行回归,但它将从后端完成。 I am getting from the API two fields: live data: and prediction: And I need them to add them together.我从 API 得到两个字段:实时数据:和预测:我需要将它们加在一起。
I think you can use segment
option for this.我认为您可以为此使用segment
选项。 You can change line styles based on datapoint options / value.您可以根据数据点选项/值更改 styles 行。 Usage example: Link an official example使用示例: 链接一个官方示例
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.