【问题标题】:Flex: Move a datapoint from 1 location to another in a plotchartFlex:在图表中将数据点从一个位置移动到另一个位置
【发布时间】:2013-05-30 07:41:01
【问题描述】:

我有一个灵活的绘图图,我需要一个动画,使我能够将数据点从一个位置移动到另一个位置。还必须显示实际运动。

我尝试过移动控制,但调用 play() 不起作用。

任何提示也会有很大帮助..

提前致谢

【问题讨论】:

    标签: charts flex3


    【解决方案1】:

    经过一番努力,我发现将点从 1 个点移动到另一个点的一种方法是让它沿着直线的方程移动,并在一段时间后在图形上渲染中间点...

    我会分享代码...

    将以下行放在要开始移动的位置:

            setTimeout(showLabel,singleDuration,oldLocation,newLocation, 
                    Constants.TOTAL_STEPS,1,oldLocation.x, oldLocation.y, singleDuration);
    

    这是函数定义:

            private function showLabel(oldLoc:Object newLoc: Object, totalSteps: Number,
                            count:Number, currentX: Number, currentY: Number, singleDuration: Number): void{
                tempArrColl = new ArrayCollection();
                var tempObj: Object= new Object();
                xDelta = 0.25;
                yDelta = 0.25;
                tempObj.x = currentX + (xDelta * count);
                tempObj.y = currentY + (yDelta * count);
                if ((tempObj.x >= newLoc.x) || (tempObj.y >= newLoc.y)){
                    tempObj.x = newLoc.x;
                    tempObj.y = newLoc.y;
                    callLater(showPoint,[tempObj]);
                    tempArrColl = new ArrayCollection();
                    plotGraphArrayColl.addItem(newLoc);
                    return;
                }
                callLater(showPoint,[tempObj]);
                count++;
                setTimeout(showLabel, singleDuration, oldLoc, newLoc, 
                    totalSteps, count, tempObj.x, tempObj.y, singleDuration);
            }
    
            private function showPoint(loc: Object): void {
                tempArrColl.addItem(loc);
                plotChart.validateNow();
            }
    

    这里,tempArrColl 将保存直线方程的中间点。将其作为数据提供者放在图表上的一系列中,然后在移动所有点后将其删除。 plotGraphArrayColl 是保存新移动点的 dataProvider..

    可能有更好的方法,但它对我有用......请告诉是否有人找到更容易的东西......谢谢

    【讨论】:

      猜你喜欢
      • 2017-05-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-10-19
      • 1970-01-01
      • 2011-07-15
      相关资源
      最近更新 更多