views:

291

answers:

1

Hi All, I'm having a problem with labels disappearing on Flex's datavisualization.swc charts that are built on our build server via ANT and the Flex 3.3 SDK. I've made sure that our license is applied properly on the build server (hence no water marks), and I've made sure the exact same datavisualization.swc was copied from my dev machine into the Flex3.3SDK/frameworks/libs directory.

Any ideas? Could it be a font problem? (Though we're really only using default fonts.)

Here's the problem, missing axis labels on the build server alt text

Here's how it's supposed to look with labels (taken on my local development machine) alt text

A: 

I got it working using the helpful information I found at the Flex Coders archive.

Basically, in an initalize event handler, I added the following code:

var ccClassFactory:ContextualClassFactory = new ContextualClassFactory(ChartAxisTextLabel);
ccClassFactory.moduleFactory=this.moduleFactory;

var hAxisRenderer:AxisRenderer = new AxisRenderer();
hAxisRenderer.axis = hAxis;
hAxisRenderer.labelRenderer=ccClassFactory;

var vAxisRenderer:AxisRenderer = new AxisRenderer();
vAxisRenderer.axis = vertAxis;
vAxisRenderer.labelRenderer=ccClassFactory;

lineChart.horizontalAxis=hAxis;
lineChart.verticalAxis=vertAxis;
lineChart.horizontalAxisRenderers = [ hAxisRenderer ];
lineChart.verticalAxisRenderers = [ vAxisRenderer ];

Also, I had to create the class:

public class ChartAxisTextLabel extends Label
{
    public function ChartAxisTextLabel()
    {
            super();
    }

    override public function set data(value:Object):void
    {
        super.data = value;
        text = value.text;
    }
}
taudep