我创建了一个 Flex LineChart,显示随时间变化的高潮和低潮预测。我正在使用带有 form="curve" 的 LineSeries,它会产生一个漂亮的正弦波图,表示水位随时间的变化。X轴代表时间,Y轴代表水位。我必须处理的唯一数据点是高潮和低潮值,但我想弄清楚如何确定沿线任意 x 值的 y 值。
例如,假设我有以下数据点:
var highLowTidePredictions:ArrayCollection = new ArrayCollection( [
{ Date: new Date(2010, 1, 26, 7, 15), waterLevel: 20.3 },
{ Date: new Date(2010, 1, 26, 13, 15), waterLevel: -1.2 },
{ Date: new Date(2010, 1, 26, 19, 15), waterLevel: 19.0 },
{ Date: new Date(2010, 1, 27, 1, 15), waterLevel: -1.0 },
{ Date: new Date(2010, 1, 27, 7, 15), waterLevel: 18.7 },
{ Date: new Date(2010, 1, 27, 13, 15), waterLevel: 0.7 }
]);
这是我的折线图:
<mx:LineChart id="highLowLinePredictionsLineChart"
width="100%" height="100%"
dataProvider="{highLowTidePredictions}"
showDataTips="true">
<mx:horizontalAxis>
<mx:DateTimeAxis id="dta" />
</mx:horizontalAxis>
<mx:series>
<mx:LineSeries id="lineSeries1"
xField="Date" yField="waterLevel"
form="curve" interpolateValues="true" sortOnXField="true"/>
</mx:series>
</mx:LineChart>
我想知道waterLevel
2010 年 2 月 26 日 09:00。
如果我能做到就好了
var date:Date = new Date(2010, 1, 26, 9, 0);
var waterLevel:Number = lineSeries1.getYValue(date);
但是很可惜,这个getYValue(xValue)
功能不存在。