Embedding Charts Using <object>/<embed> HTML tags | ||||||||||||||||||||
FusionWidgets XT can also be embedded in web pages using plain HTML and without using FusionCharts JavaScript Class. For this, you need to use the <object>/<embed> HTML tags. This method can be implemented in applications that do not support JavaScript. You can also use this method where the entire chart embedding code is fetched using an AJAX request (e.g., ASP.NET UpdatePanel) and the AJAX response should contain the <object>/<embed> tags. We always recommend that you use FusionCharts JavaScript Class method for embedding the charts in an HTML page. This is the only way to get JavaScript (HTML5) fallback for the charts. When embedding using <object>/<embed> method, only Flash charts will show up. Additionally, the following features will not be supported as they are dependent on the FusionCharts JavaScript Class:
|
||||||||||||||||||||
HTML embedding with XML data provided as URL | ||||||||||||||||||||
Let us create a new HTML file, cust-satisfaction-html-xml-url.html and copy the following code into it: |
||||||||||||||||||||
<html> <head> <title>My First chart using FusionWidgets XT - Using HTML embedding method - XML from URL</title> </head> <body> <object width="400" height="200" id="AngularGauge" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com /pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" > <param name="movie" value="Charts/AngularGauge.swf" /> <param name="FlashVars" value="&dataURL=Data.xml &chartWidth=400&chartHeight=200 &DOMId=myChartId®isterWithJS=1&debugMode=0"> <param name="quality" value="high" /> <embed src="Charts/AngularGauge.swf" flashVars="&dataURL=Data.xml &chartWidth=400&chartHeight=200 &DOMId=myChartId®isterWithJS=1&debugMode=0" width="400" height="200" name="Angular Gauge" quality="high" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /> </object> </body> </html> See it live! |
||||||||||||||||||||
The code in bold is responsible for embedding FusionWidgets XT into the HTML page. In the above code, we've done the following:
To render a Flash movie in a browser, the HTML page must contain certain tags for initiating the Flash movie. <object> and <embed> tags are used for this purpose. The <object> tag is recognized by Internet Explorer under Microsoft Windows and the <embed> tag is recognized by other browsers. |
||||||||||||||||||||
HTML embedding using XML data embedded in HTML page | ||||||||||||||||||||
You can also embed the XML in the <object>/<embed> tag itself without depending on the external source. |
||||||||||||||||||||
We modify our first sample cust-satisfaction-html-xml-url.html and rename it as cust-satisfaction-html-string.html.<html> <head> <title>My First chart using FusionWidgets XT - Using HTML embedding method - XML from String</title> </head> <body> <object width="400" height="200" id="AngularGauge" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/ shockwave/cabs/flash/swflash.cab#version=8,0,0,0" > <param name="movie" value="Charts/AngularGauge.swf" /> <param name="FlashVars" value="&chartWidth=400&chartHeight=300 &DOMId=myChartId®isterWithJS=1&debugMode=0 &dataXML=<chart lowerLimit='0' upperLimit='100' lowerLimitDisplay='Bad' upperLimitDisplay='Good' numberSuffix='%25' showValue='1'> <colorRange> <color minValue='0' maxValue='75' code='FF654F'/> <color minValue='75' maxValue='90' code='F6BD0F'/> <color minValue='90' maxValue='100' code='8BBA00'/> </colorRange> <dials> <dial value='92'/> </dials> </chart>"/> <param name="quality" value="high" /> <embed src="Charts/AngularGauge.swf" flashVars="&chartWidth=400&chartHeight=300 &DOMId=myChartId®isterWithJS=1&debugMode=0 &dataXML=<chart lowerLimit='0' upperLimit='100' lowerLimitDisplay='Bad' upperLimitDisplay='Good' numberSuffix='%' showValue='1'> <colorRange> <color minValue='0' maxValue='75' code='FF654F'/> <color minValue='75' maxValue='90' code='F6BD0F'/> <color minValue='90' maxValue='100' code='8BBA00'/> </colorRange> <dials> <dial value='92'/> </dials> </chart>" width="400" height="200" name="AngularGauge" quality="high" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /> </object> </body> </html> See it live! |
||||||||||||||||||||
As you can note from the bold text in the code above, we have only replaced &dataURL FlashVars variable with &dataXML and to this variable we have passed the chart XML data. The resultant chart will be the same. Depending on your coding practice, you’d be enclosing the entire XML string using either single quotation marks (') or double quotation marks ("). So, if you are enclosing the entire XML in double quotes, then the XML attributes must be encapsulated in single quotes. Using, single quotes for encapsulation of the entire XML string and also for individual attributes, will lead to a conflict. |
||||||||||||||||||||
FusionWidgets XT FlashVars details | ||||||||||||||||||||
When using HTML embedding, all variables to the chart are passed using FlashVars. The table below lists all such variables supported:
|
||||||||||||||||||||
Limitations of using HTML embed method | ||||||||||||||||||||
There are some limitations of HTML embedding method. Let us get a comprehensive list of the limitations:
|