简体   繁体   English

Antd 图表 - 面积图系列值相对于上一个系列绘图

[英]Antd Charts - Area chart series values plot relative to last series

I'm trying to use Ant Design charts to plot an area chart with 3 series - actual, target and forecast.我正在尝试使用 Ant Design 图表绘制具有 3 个系列的面积图 - 实际、目标和预测。 For some reason, the chart plots the series relative to the last item in the array, rather than relative to the x axis.出于某种原因,图表相对于数组中的最后一项绘制系列,而不是相对于 x 轴。 I tried setting the startOnZero: true but that didn't help.我尝试设置startOnZero: true但这没有帮助。

See below example:见下面的例子: 在此处输入图片说明

In this example, the target is 220 and the actual is 1558, but the target point is higher on the y axis.在此示例中,目标为 220,实际为 1558,但目标点在 y 轴上更高。 Recreated:重新创建:

https://codesandbox.io/s/beautiful-grothendieck-qtjj7?file=/App.tsx:8366-8384 https://codesandbox.io/s/beautiful-grothendieck-qtjj7?file=/App.tsx:8366-8384

If we put the 'Target' values to the bottom of the data array, it works fine for some reason:如果我们将“目标”值放在数据数组的底部,由于某种原因它可以正常工作:

在此处输入图片说明

默认情况下它创建堆积图,您可以将 isStack 设置为 false

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM