taudep
taudep

Reputation: 2881

Problem with Flex DataVisualization Charting components Rendering Labels on Build Server

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 http://img687.imageshack.us/img687/5038/chartwithmissingaxislab.png

Here's how it's supposed to look with labels (taken on my local development machine) alt text http://img683.imageshack.us/img683/1504/chartwithaxislabels.png

Upvotes: 1

Views: 1111

Answers (1)

taudep
taudep

Reputation: 2881

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;
    }
}

Upvotes: 1

Related Questions