1系列有多条未连接的线路?

时间:2013-06-18 11:22:21

标签: actionscript-3 flex flex4.5 flex4.6

  • 如何通过1个图表系列实现下面绘制的图表,它可以表示多个未连接,如果可能不是顺序(在X轴上)线?

enter image description here

1 个答案:

答案 0 :(得分:1)

    var sprite:Sprite = new Sprite();   
    drawChart([ [0,50], [70, 100], [120, 190] ], sprite);

    private function drawChart(data:Array, sprite:Sprite):void {

            var grachics:Graphics = sprite.graphics;
            grachics.beginFill(0xffff00);

            for (var i:int = 0; i < data.length; i++) {
                var obj:Array = data[i] as Array;

                var startX:int = obj[0];
                var endX:int = obj[1];

                grachics.drawRect(startX, 0, endX - startX, 30);
            }

            graphics.endFill();
    }