2 Replies Latest reply on Aug 23, 2006 2:16 PM by TrickyFishy

    Trouble creating custom AreaRenderer for AreaChart

      Quick first question: if I purchase the charting package, do I get the source code? That would certainly solve my problems.

      OK the real question: Does anyone have a quick example class that is a custom AreaRenderer for an AreaChart?

      I'm trying to create a custom AreaRenderer implementation. According to the docs, I need to implement the "AreaRenderer" interface (not IAreaRenderer (?)) which supposedly lives in mx.charts.renderers.interfaces but Flex Builder complains that the interface is not found.

      Link to the docs: http://livedocs.macromedia.com/flex/15/asdocs_en/mx/charts/renderers/interfaces/AreaRender er.html

      Alternatively I've tried simply extending AreaRenderer but the methods: beginDraw, draw and endDraw don't seem to be there or are not overridable?
        • 1. Re: Trouble creating custom AreaRenderer for AreaChart
          TrickyFishy Level 1
          OK first mistake... I was looking at the Flex 1.5 docs. They must have come up from a search :S

          Anyone have more clues?
          • 2. Re: Trouble creating custom AreaRenderer for AreaChart
            TrickyFishy Level 1
            Ugh I always figure these things out just after I post. I've been banging my head on this for over a day too.

            Anyway, for anyone else all you do is extend ProgrammaticSkin and implement IDataRenderer. Here is my sample class:

            import mx.core.IDataRenderer;
            import mx.skins.ProgrammaticSkin;
            import mx.charts.series.items.AreaSeriesItem;
            import mx.charts.series.renderData.AreaSeriesRenderData;
            import flash.display.Graphics;

            public class MyAreaRenderer extends ProgrammaticSkin implements IDataRenderer
            private var _data:AreaSeriesRenderData;

            public function get data():Object
            return _data;

            public function set data(d:Object):void
            _data = d as AreaSeriesRenderData;

            override protected function updateDisplayList(width:Number, height:Number):void
            super.updateDisplayList(width, height);

            var g:Graphics = graphics;


            for (var index:String in _data.filteredCache)
            var item:AreaSeriesItem = _data.filteredCache[index];

            g.lineTo(item.x, item.y);

            I'd still like to know if you get the source code to the charting package though.