Open Flash Chart 2 (Kvasir) as a Flex SWC component with source code
This SWC flex component based on Open Flash Chart 2 (Kvasir) .
Other working example [Open Flash Chart 2 (Kvasir) - Explorer] Any feedback would be welcome.
Bug fixed from previous version:
Things not working in this component:
How to included SWC files:
In Flex 3.3 SDK – the files are included at flex-install-dir/frameworks/libs directory.
Note: I patched against the latest Open Flash Chart Version 2 Kvasir (16th, June 2009).
You can get more information about changes from previous posts.
Let me know if you need any help.
Open Flash Chart 2 (Kvasir) - Explorer
This chart explorer is developed in flex based on Open Flash Chart 2 (Kvasir). Now you can adjust the width and height separately. Any feedback would be welcome.
[Version 2 Kvasir (16th, June 2009) Demo] by WebASP
List of charts in this chart explorer:
This chart explorer has all charts that previous explorer has. New charts:
- Candlestick Chart or Stock Chart
- Line Chart
- Shape Chart
- Horizontal Bar Chart
- Stack Bar Chart (with animation)
- Scatter Charts
- Sketch Bar Chart [Updated]
Note: It has extra chart animation and new styles
Bugs fixed:
- Stack Bar chart
Open Flash Chart 2 as a SWC component - source code
Here is the source code for Open Flash Chart 2 as a SWC component.
Download [OFC2library-src] source code by WebASP.
Things i modified from original Open Flash Chart 2 (Jörmungandr-2)
Modified Files:
- Loading.as
- Tooltip.as
- BackGround.as
- Keys.as Title.as
- YAxisBase
- YAxisLeft
- YAxisRight
- XLegend.as
- YLegendBase
- YLegendLeft.as
- YLegendRight.as
- Menu.as
so what i modified, add new two extra parameter to all classes that using “stageWidth” and “stageHeight”(pWidth:Number,pHeight:Number). Open Flash Chart 2 used lot of “stageWidth” and “stageHeight” to draw chart. As it only get size of main drawing area (EG: most times we need chart less than the size of the container and we have other elements around). Above modicifation accept width/height values from the parent container and size itself accordingly.
- pWidth —— Parent Width
- pHeight —- Parent Height
New Added File :
Chart.as(as it only work as to generate flex component) : From main.as with some changes. I didn’t add any comments in it, most things are understandable.
Links (for more understanding):
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.
Open Flash Chart 2 (Jörmungandr) - Explorer
Open Flash Chart 2 - Explorer
Thanks for the excellent framework for developing flash charting solutions and making it open source. I couldn’t find any quick chart explorer for OFC in Internet, so i created this chart explorer in flex. This chart explorer showcases all the charts present in Open Flash Chart 2 (inspiration from fusion-charts/flex-chart explorer).
Any feedback would be welcome. [Version 2 Ichor (20th March 2009) Demo] by WebASP
List of charts in this chart explorer:
- Bar chart
- Horizontal Bar chart
- Stack Bar chart
- Floating Bar chart
- 3D Bar chart
- Sketch Bar chart
- Glass Bar chart
- Cylinder Bar chart
- Line chart
- Pie chart
- Shape chart
- Area chart
- Scatter Chart
- Radar chart
[Version 2 Ichor (20th March 2009) Demo] by WebASP