WebASP
Open Flash Chart 2 as a SWC component

After a long fight with Open Flash Chart 2 here is peaceful output of OFC 2 as SWC Flex component. This SWC flex component based on Open Flash Chart 2 (Jörmungandr-2) .

Since below code not able to copy past and try, you can download from [demo.mxml] [Updated]

Any feedback would be welcome.

Things not working in this component:

    Stack Bar Chart Pie Chart Tooltip

How to included SWC files:

In Flex 3.3 SDK – the files are included at flex-install-dir/frameworks/libs directory.

Sample code: 

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:ofc="*" width="100%" height="100%">
   <mx:Script> <![CDATA[
   [Bindable]
   private var dataJSON:String='{ "elements": [ { "type": "bar","alpha":0.8,"colour":"#663366", "values": [ 9.5, 9, 8.5,8, 7.5, 7, 6.5, 6, 5.5,5, 4.5, 4, 3.5, 3, 2.5, 2, 1.5, 1 ] } ], "title": { "text": "Wed May 20 2009" },"bg_colour":"#fcfcfc" }';
   ]]></mx:Script>
   <mx:Panel id="chartContainer" title="Flex Chart" width="100%" height="100%">
    <ofc:Chart id="myChart" width="900" height="600" loadingString="Loading..." chartData="{dataJSON}"/>
   </mx:Panel>
</mx:Application>

Note:

  • If you change the chartData it will automatically reload the chart.
  • If you change width and height after chart load you need to call “myChart.load();” to reload the chart to right size.
  1. webasp posted this
blog comments powered by Disqus