BitStream Flash Chart Generation

Creating a Flash Chart Without Downloading a File

This technique is used when a Flash chart will be generated by the server side component. The idea is as simple as including the <Object> tag wherever you want the chart to be displayed and the value parameter points to the file that generates the BitStream by invoking the getHtmlData method. The HTML should read as follows:


<OBJECT name="Chart1" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/
flash/swflash.cab#Version=5,0,0,0" WIDTH="450" HEIGHT="280">
<param name="movie" value="chart.jsp"/>
<EMBED name="Chart1" type="application/x-shockwave-flash"
src="chart.jsp" pluginspage="http://www.macromedia.com/shockwave
/download/index.cgi?P1_Prod_Version=ShockwaveFlash"
WIDTH="450" HEIGHT="280" ></EMBED>
</OBJECT>

The chart.jsp file will contain the necessary code that generates the desired chart and invokes the getHtmlData method as a result of the page. A very important issue when generating this JSP is to make sure there are no other HTML tags or Line feeds in the resulting file as the chart may not be correctly returned and displayed in the browser. In other words, make sure the chart.jasp file only returns the results of the getHtmlData method with no additional characters. For example a valid chart.jsp file may look like:


<%@page import="SoftwareFX.ChartFX.*"%>
<%ChartServer chart1 = new ChartServer(application,request,response);
FlashWriter w = new FlashWriter();
chart1.setOutputWriter(w);
chart1.getHtmlData("400","240","FLASH");%>

Please remember there must not be any spaces or carriage returns before the start of the jsp code (<%). If you press [Enter] then a carriage return will be generated in the result of the jsp and the IMG source will not be able to read the image generated by Chart FX for Java. Therefore it is strongly advised that you use a plain text editor when generating these files as many advanced editors may include undesired HTML tags in the resulting file.