问题描述
我在我的项目中使用 AMCharts,我想要的是完成这个:
给定1。数据点:
const data = [{x: 23,y: 0},{x: 24,{x: 25,y: 23},...,{x: 26,y: 24}]
并给出2。 x 轴最小步长 0.5
我想形成一个图表,其中点 23.5、24.5 ... 等自动添加到图表中,它们的 Y 值基于直线自动插值,当 X = 23.5 时询问 Y 值时,它让我得到Y 值(在这种情况下应该是 0)。
我用来创建图表的部分代码:(截至目前,我只是提供了尽可能多的 x、y 值,但稍后我想提供一些,并且图表应该根据我给定的“步长”假设介于两者之间的点")
this.chart = am4core.create(this.chartDiv,am4charts.XYChart);
this.title = this.chart.titles.create();
// chartData is just an array of x,y values
this.chart.data = this.props.chartData;
const X_AXIS = this.chart.xAxes.push(new am4charts.ValueAxis());
X_AXIS.title.text = "X VALUES";
const Y_AXIS = this.chart.yAxes.push(new am4charts.ValueAxis());
Y_AXIS.title.text = "Y VALUES";
this.series = this.chart.series.push(new am4charts.Lineseries());
this.series.datafields.valueX = "xValue";
this.series.datafields.valueY = "yValue";
// cursor
this.chart.cursor = new am4charts.XYCursor();
this.chart.cursor.xAxis = X_AXIS;
this.chart.cursor.yAxis = Y_AXIS;
this.chart.cursor.snapToSeries = this.series;
注意:图表没有必要显示所有插值的 x 值,如 23.5,但是当查询最初未提供的 x 值的 y 值时,它应该能够得到...
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)