Monday, February 4, 2008

Integerating Fusion Chart with Dynamics Axapta 4 (Part One)

This tutorial will guide you to view beautiful Fusion Chart on Axapta. Before you follow this tutorial you need to install Flash player on our system or you can click here to download Flash.ocx then you register it to your system using regsvr32 command. You need to download Fusion Free Chart here, copy and paste Chart folder from Fusion Free Chart folder to C:\, create new folder name Data on C:\ and make sure you have this folder structure. Oouch I almost forgot, Fusion Free Chart read parameter from xml file to view data on chart that’s why we need folder Data under the Chart folder.



OK now we start to build the application by creating a Group name IntegeratigFusionChart, then create a new Group name Forms and ProjectGroupType Forms. Create new Form name CustInvoicedList then fill caption with “Integerating Fusion Chart on Axapta”.


Create new Group on Form CustInvoiceList fill the name with “GroupParameter” and Caption with “Parameters” then add new control StringEdit fill the name with “CustAccount” and ExtendedDataType with “CustAccount”, add new control DateEdit fill the name with “FromDate”, Label with “From date” and ExtendedDataType with “TransDate”, add new control DateEdit fill the name with “ToDate”, Label with “To date” and ExtendedDataType with “TransDate”.



Continue to the next step, create new Group on Form CustInvoiceList fill the name with “GroupViewer” and Caption with “Fusion chart viewer” then add new control ActiveX fill the name with “FusionChartViewer”.



Done with making the interface, now create new method on form name initChart() then insert below code to initChart() method :



First marked source mean to write empty data to DataCustInvoiced.xml file and the second marked source send some information to chart about the parameter file path and set the width and height of chart.

Next step, create new method on form name amount2str(), this method will convert amount to string format for Fusion Free Chart parameters. Insert below code to amount2str() method :



Create new method on form name writeXML(), this method will generate xml file that contains parameter for Fusion Free Chart, insert below code to writeXML() method :





Create new method on form name redrawChart(), this method will refresh the chart viewer, then insert below code to redrawChart() method :



Continue to next step by init() on form, then insert below code :



Create new ButtonGroup on Group GroupParamter, then add new control Button fill the name with “ButtonRefresh” and Text with “Refresh”.



The last step is override method Clicked() on ButtonRefresh(), then insert below code to Clicked () method :



Wooogggh try to input the parameter and see how it works.