[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1532
  • Last Modified:

Fusioncharts xml from Coldfusion query

Hello experts, What i need to do is create an xml page from a sql query in Coldfusion. I have it working for a basic cfloop using set label and value. But i am running into problems using datasets. Below i will copy the working cf code and output xml and i will include the xml structure i need to have.
Im using fusioncharts to graph out the following queries and folloowed there tutorials as best i could but they dont have anything on the combo chart  so i ave been trying for hours to figure out how to loop through the DB.... and can easily do it the forst way but fail the second.

Thanks in advance for any help
<!--- WORKING CODE --->
<!--- check to see if someone has selected to view past transactions, if not load current month --->
<cfif IsDefined("form.month")>
<cfset reportMonth = "#form.month#">
<cfset reportYear = "#form.year#">
<cfelse>
<cfset reportMonth  = #month(now())#>
<cfset reportYear  = #year(now())#>
</cfif>

<!--- main query to pull activity and link forecast best etc--->
<cfquery name="getActivityRelate">
SELECT  
  dbo.company.companyName, 
  dbo.products.prodName, 
  dbo.products.prodID, 
  dbo.users.fName, 
  dbo.users.lName, 
  SUM(dbo.activityTransactions.activityCnt) AS activityCnt, 
  MAX(dbo.activityTransactions.updateDate) AS updateDate, 
  dbo.best.best, 
  dbo.forecast.forecast 
FROM 
 dbo.products 
 INNER JOIN dbo.company ON (dbo.products.compID=dbo.company.compID) 
 INNER JOIN dbo.users ON (dbo.users.compID=dbo.company.compID) 
  AND (dbo.products.userID=dbo.users.userID) 
 INNER JOIN dbo.activityTransactions ON (dbo.company.compID=dbo.activityTransactions.compID) 
  AND (dbo.users.userID=dbo.activityTransactions.userID) 
  AND (dbo.products.prodID=dbo.activityTransactions.prodID) 
  AND (dbo.users.compID=dbo.activityTransactions.compID) 
  AND (dbo.products.userID=dbo.activityTransactions.userID) 
  AND (dbo.products.compID=dbo.activityTransactions.compID) 
 INNER JOIN dbo.forecast ON (dbo.forecast.prodID=dbo.activityTransactions.prodID) 
  AND (dbo.forecast.userID=dbo.activityTransactions.userID) 
  AND (dbo.forecast.compID=dbo.activityTransactions.compID) 
  AND (dbo.forecast.compID=dbo.company.compID) 
  AND (dbo.forecast.prodID=dbo.products.prodID) 
  AND (dbo.forecast.userID=dbo.users.userID) 
 INNER JOIN dbo.best ON (dbo.best.userID=dbo.activityTransactions.userID) 
  AND (dbo.best.prodID=dbo.activityTransactions.prodID) 
WHERE 
  users.userID = #session.userID# AND 
  (dbo.activityTransactions.activeMM = #reportMonth#) AND  
  (dbo.activityTransactions.activeYYYY = #reportYear#) 
GROUP BY dbo.company.companyName, dbo.products.prodName, dbo.products.prodID, dbo.users.fName, dbo.users.lName, dbo.best.best, dbo.forecast.forecast 
</cfquery>


<!---start graph functins--->

<!--- dashboard.cfm has passed us a property animate. We request that. --->
<cfparam name="URL.animate" default="1">
<cfset animateChart = URL.animate>

     <cfset currentDate = #DateFormat(Now(), "mm/dd/yyyy")#>
<!--- Generate the chart element --->
<cfset strXML = "<chart caption='#getActivityRelate.fname# #getActivityRelate.lname#' subCaption='Current Activity as of #currentDate#' formatNumberScale='0' numberSuffix=' sales' animation=' " & animateChart & "'>">

<!--- Iterate through each product --->

<cfloop query="getActivityRelate">
   <cfset prodName = getActivityRelate.ProdName>
   <cfset activityCount = getActivityRelate.activityCnt>
   <!--- Generate <set label='..' value='..'/> --->
   <cfset strXML = strXML & "<set label='#prodName#' value='#activityCount#' />">
</cfloop>

<!--- Finally, close <chart> element --->
<cfset strXML = strXML & "</chart>">
<cfoutput>#renderChart("Charts/Column3D.swf", "", strXML, "FactorySum", 600, 300, false, false)#</cfoutput>

<!--- The above code returns thsi xml --->
<chart caption='fname lname' subCaption='Current Activity as of 12/18/2009 formatNumberScale='0' numberSuffix=' sales' animation='1'>
  <set label="Product1" value="462" /> 
  <set label="Product2" value="857" /> 
  <set label="Product3" value="671" /> 
  <set label="Product4" value="494" /> 
  <set label="Product5" value="761" /> 
</chart>

<!--- I need to output the xml something like this example---->
<chart palette='1' caption='Sales' shownames='1' showvalues='0' numberPrefix='$' sYAxisValuesDecimals='2' connectNullData='0' PYAxisName='Revenue' SYAxisName='Quantity'  numDivLines='4' formatNumberScale='0'>
<categories>
<category label='currentMonth' />
<category label='lastmonth' />
</categories>
<dataset seriesName='ProdName' color='AFD8F8' showValues='0'>
<set value='232' />
</dataset>
<dataset seriesName='Best' color='F6BD0F' showValues='0' >
<set value=240' /> 
</dataset>
<dataset seriesName='ForeCast' color='8BBA00' showValues='0' parentYAxis='S' >
<set value='45000' />
</dataset>
</chart>

Open in new window

0
joedfuse
Asked:
joedfuse
  • 7
  • 6
1 Solution
 
azadisaryevCommented:
the xml you are trying to create for a combination chart seems to be wrong.
according to fusioncharts docs for combination charts each <dataset> node must have as many <set> nodes as you have categories. so in your case you should have 2 <set> nodes in each <dataset> node - one for each category.

furthermore, your query does not return necessary data to create a multi-categories combo chart.
your query only returns data for 1 month, while the chart you are trying to create requires data for current and previous months.

can you please clarify which type of chart you want to create? a combination chart, or maybe just a multi-series chart? and if it is a combination chart, is it going to be single Y-axis or dual Y-axis chart?

and also, which version of fusioncharts are you using?

fyi, v3 docs about combination charts is here: http://www.fusioncharts.com/Docs/Contents/CombiXML.html
or go to http://www.fusioncharts.com/Docs/Index.html, then expand "FusionCharts and XML" section and click on "Combination chart XML" link.

Azadi



Azadi
0
 
joedfuseAuthor Commented:
Thanks for your response

I went through your post and the docs you linked and looking at my initial example your right i was way off. elimitate the months from categories.

Below snipped is copied from there site and i added the fields for each chart element . I dont really care to much about the trend line but added the best field since there can be only one best number for each product for each month.

My problem now lies in writing the loops to populate this from DB

Thanks again

Joe
<chart caption='Sales Volume' PYAxisName='Revenue' SYAxisName='Quantity' showvalues='0' numberPrefix='$'>

   <categories>
      <category label='ProdName' />
      </categories>

   <dataset seriesName='Sales' parentYAxis='P'>
      <set value='activityCnt' />
   </dataset>

   <dataset seriesName='ForeCast' parentYAxis='S'>
      <set value='340' />
   </dataset>

   <trendLines>
      <line startValue='Best' color='009933' displayvalue='Target' /> 
   </trendLines>

   <styles>

      <definition>
         <style name='CanvasAnim' type='animation' param='_xScale' start='0' duration='1' />
      </definition>

      <application>
         <apply toObject='Canvas' styles='CanvasAnim' />
      </application>   

   </styles>
</chart>

Open in new window

0
 
joedfuseAuthor Commented:
Posting code again i forgot a couple fields
<chart caption='Sales Volume' PYAxisName='Sales' SYAxisName='Forecasr' showvalues='0' numberPrefix='$'> 
 
   <categories> 
      <category label='#ProdName#' /> 
      </categories> 
 
   <dataset seriesName='Sales' parentYAxis='P'> 
      <set value='#activityCnt#' /> 
   </dataset> 
 
   <dataset seriesName='ForeCast' parentYAxis='S'> 
      <set value='#forecast#' /> 
   </dataset> 
 
   <trendLines> 
      <line startValue='Best' color='009933' displayvalue='Best' />  
   </trendLines> 
 
   <styles> 
 
      <definition> 
         <style name='CanvasAnim' type='animation' param='_xScale' start='0' duration='1' /> 
      </definition> 
 
      <application> 
         <apply toObject='Canvas' styles='CanvasAnim' /> 
      </application>    
 
   </styles> 
</chart>

Open in new window

0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
azadisaryevCommented:
ok, it looks like you are after just a multi-series chart (i.e. displaying Sales and Forecast for products of specific user in selected month - right?)

try the attached code. it is quiet simple, as you can see.
the <cfsavecontent> tag creates a chartXML cf variable which contains the xml for your chart. use this variable in your renderChart() function call.

you will notice that i have removed the trendline. that is because i am not sure if the 'best' value you want to plot as trendline is same for all products displayed in the chart or not. and if it is not the same for all products, then i do not think you can use it as a trendline...

Azadi
<cfsavecontent variable="chartXML">
<chart caption='Sales Volume' showvalues='0' numberPrefix='$'>
  <categories>
    <cfoutput query="getActivityRelate"><category label='#xmlformat(prodName)#' /></cfoutput>
  </categories>
  <dataset seriesName='Sales'>
    <cfoutput query="getActivityRelate"><set value='#activityCnt#' /></cfoutput>
  </dataset>
  <dataset seriesName='Forecast'>
    <cfoutput query="getActivityRelate"><set value='#forecast#' /></cfoutput>
  </dataset>
  <styles>
    <definition><style name='CanvasAnim' type='animation' param='_xScale' start='0' duration='1' /></definition>
    <application><apply toObject='Canvas' styles='CanvasAnim' /></application>   
  </styles>
</chart>
</cfsavecontent>

Open in new window

0
 
azadisaryevCommented:
i posted my code before i saw your re-post of required xml. you will see that my code omitted some of attributes you used in your xml, but i think you can figure out where to add those in my code.

Azadi
0
 
joedfuseAuthor Commented:
you absolutly right about what i was looking for ... i tried your code posted and recieved the following error

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2)
Timestamp: Sat, 19 Dec 2009 15:17:24 UTC

Message: Unterminated string constant
Line: 296
Char: 34
Code: 0

Line 296 is this part of query   (dbo.activityTransactions.activeYYYY = #reportYear#)
Doesnt make sense to me why this would throw an error considering im not even using activeYYYY in the xml
Below is exact code i used
<cfsavecontent variable="chartXML"> 
<chart caption='Sales Volume' showvalues='0' numberPrefix='$'> 
  <categories> 
    <cfoutput query="getActivityRelate"><category label='#xmlformat(prodName)#' /></cfoutput> 
  </categories> 
  <dataset seriesName='Sales'> 
    <cfoutput query="getActivityRelate"><set value='#activityCnt#' /></cfoutput> 
  </dataset> 
  <dataset seriesName='Forecast'> 
    <cfoutput query="getActivityRelate"><set value='#forecast#' /></cfoutput> 
  </dataset> 
</chart> 
</cfsavecontent>
<cfoutput>#renderChart("Charts/MSColumn3D.swf", "", chartXML, "FactorySum", 600, 300, false, false)#</cfoutput>

Open in new window

0
 
azadisaryevCommented:
IE is not to be trusted with the errors it shows you...

do any of your procuts have ' (single quote) in their name?

is this page of yours available on-line? it'll help if i could see it...

you can also try removing the xmlformat() function and see if it causes the problem:
change label='#xmlformat(prodName)#' to just label='#prodName#'

Azadi
0
 
joedfuseAuthor Commented:
Ok i moved the page to the root directory so you could see
http://64.78.32.63/dashboard.cfm
Its the same error with or without the xmlformat added

Im thinking the include .js file is having a problem with chartXML when rendering the chart.

I will add the js and fusionchart.cfm include code below
<--- fusioncharts.js --->

/**
 * FusionCharts: Flash Player detection and Chart embed 
 * 
 * Morphed from SWFObject (http://blog.deconcept.com/swfobject/) under MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */
if(typeof infosoftglobal == "undefined") var infosoftglobal = new Object();
if(typeof infosoftglobal.FusionChartsUtil == "undefined") infosoftglobal.FusionChartsUtil = new Object();
infosoftglobal.FusionCharts = function(swf, id, w, h, debugMode, registerWithJS, c, scaleMode, lang){
	if (!document.getElementById) { return; }
	
	//Flag to see whether data has been set initially
	this.initialDataSet = false;
	
	//Create container objects
	this.params = new Object();
	this.variables = new Object();
	this.attributes = new Array();
	
	//Set attributes for the SWF
	if(swf) { this.setAttribute('swf', swf); }
	if(id) { this.setAttribute('id', id); }
	if(w) { this.setAttribute('width', w); }
	if(h) { this.setAttribute('height', h); }
	
	//Set background color
	if(c) { this.addParam('bgcolor', c); }
	
	//Set Quality	
	this.addParam('quality', 'high');
	
	//Add scripting access parameter
	this.addParam('allowScriptAccess', 'always');
	
	//Pass width and height to be appended as chartWidth and chartHeight
	this.addVariable('chartWidth', w);
	this.addVariable('chartHeight', h);

	//Whether in debug mode
	debugMode = debugMode ? debugMode : 0;
	this.addVariable('debugMode', debugMode);
	//Pass DOM ID to Chart
	this.addVariable('DOMId', id);
	//Whether to registed with JavaScript
	registerWithJS = registerWithJS ? registerWithJS : 0;
	this.addVariable('registerWithJS', registerWithJS);
	
	//Scale Mode of chart
	scaleMode = scaleMode ? scaleMode : 'noScale';
	this.addVariable('scaleMode', scaleMode);
	//Application Message Language
	lang = lang ? lang : 'EN';
	this.addVariable('lang', lang);
}

infosoftglobal.FusionCharts.prototype = {
	setAttribute: function(name, value){
		this.attributes[name] = value;
	},
	getAttribute: function(name){
		return this.attributes[name];
	},
	addParam: function(name, value){
		this.params[name] = value;
	},
	getParams: function(){
		return this.params;
	},
	addVariable: function(name, value){
		this.variables[name] = value;
	},
	getVariable: function(name){
		return this.variables[name];
	},
	getVariables: function(){
		return this.variables;
	},
	getVariablePairs: function(){
		var variablePairs = new Array();
		var key;
		var variables = this.getVariables();
		for(key in variables){
			variablePairs.push(key +"="+ variables[key]);
		}
		return variablePairs;
	},
	getSWFHTML: function() {
		var swfNode = "";
		if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { 
			// netscape plugin architecture			
			swfNode = '<embed type="application/x-shockwave-flash" src="'+ this.getAttribute('swf') +'" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'"  ';
			swfNode += ' id="'+ this.getAttribute('id') +'" name="'+ this.getAttribute('id') +'" ';
			var params = this.getParams();
			 for(var key in params){ swfNode += [key] +'="'+ params[key] +'" '; }
			var pairs = this.getVariablePairs().join("&");
			 if (pairs.length > 0){ swfNode += 'flashvars="'+ pairs +'"'; }
			swfNode += '/>';
		} else { // PC IE			
			swfNode = '<object id="'+ this.getAttribute('id') +'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'">';
			swfNode += '<param name="movie" value="'+ this.getAttribute('swf') +'" />';
			var params = this.getParams();
			for(var key in params) {
			 swfNode += '<param name="'+ key +'" value="'+ params[key] +'" />';
			}
			var pairs = this.getVariablePairs().join("&");			
			if(pairs.length > 0) {swfNode += '<param name="flashvars" value="'+ pairs +'" />';}
			swfNode += "</object>";
		}
		return swfNode;
	},
	setDataURL: function(strDataURL){
		//This method sets the data URL for the chart.
		//If being set initially
		if (this.initialDataSet==false){
			this.addVariable('dataURL',strDataURL);
			//Update flag
			this.initialDataSet = true;
		}else{
			//Else, we update the chart data using External Interface
			//Get reference to chart object
			var chartObj = infosoftglobal.FusionChartsUtil.getChartObject(this.getAttribute('id'));
			if (!chartObj.setDataXML)
        {
            __flash__addCallback(chartObj, "setDataXML");
        }

		}
	},
	setDataXML: function(strDataXML){
		//If being set initially
		if (this.initialDataSet==false){
			//This method sets the data XML for the chart INITIALLY.
			this.addVariable('dataXML',strDataXML);
			//Update flag
			this.initialDataSet = true;
		}else{
			//Else, we update the chart data using External Interface
			//Get reference to chart object
			var chartObj = infosoftglobal.FusionChartsUtil.getChartObject(this.getAttribute('id'));
			chartObj.setDataXML(strDataXML);
		}
	},
	render: function(elementId){
		var n = (typeof elementId == 'string') ? document.getElementById(elementId) : elementId;
		n.innerHTML = this.getSWFHTML();
		return true;		
	}
}

// ------------ Fix for Out of Memory Bug in IE in FP9 ---------------//
/* Fix for video streaming bug */
infosoftglobal.FusionChartsUtil.cleanupSWFs = function() {
	if (window.opera || !document.all) return;
	var objects = document.getElementsByTagName("OBJECT");
	for (var i=0; i < objects.length; i++) {
		objects[i].style.display = 'none';
		for (var x in objects[i]) {
			if (typeof objects[i][x] == 'function') {
				objects[i][x] = function(){};
			}
		}
	}
}
// Fixes bug in fp9
infosoftglobal.FusionChartsUtil.prepUnload = function() {
	__flash_unloadHandler = function(){};
	__flash_savedUnloadHandler = function(){};
	if (typeof window.onunload == 'function') {
		var oldUnload = window.onunload;
		window.onunload = function() {
			infosoftglobal.FusionChartsUtil.cleanupSWFs();
			oldUnload();
		}
	} else {
		window.onunload = infosoftglobal.FusionChartsUtil.cleanupSWFs;
	}
}
if (typeof window.onbeforeunload == 'function') {
	var oldBeforeUnload = window.onbeforeunload;
	window.onbeforeunload = function() {
		infosoftglobal.FusionChartsUtil.prepUnload();
		oldBeforeUnload();
	}
} else {
	window.onbeforeunload = infosoftglobal.FusionChartsUtil.prepUnload;
}

/* Add Array.push if needed (ie5) */
if (Array.prototype.push == null) { Array.prototype.push = function(item) { this[this.length] = item; return this.length; }}

/* Function to return Flash Object from ID */
infosoftglobal.FusionChartsUtil.getChartObject = function(id)
{
  if (window.document[id]) {
      return window.document[id];
  }
  if (navigator.appName.indexOf("Microsoft Internet")==-1) {
    if (document.embeds && document.embeds[id])
      return document.embeds[id]; 
  } else {
    return document.getElementById(id);
  }
}
/* Aliases for easy usage */
var getChartFromId = infosoftglobal.FusionChartsUtil.getChartObject;
var FusionCharts = infosoftglobal.FusionCharts;

<!--- fusioncharts.cfm --->

<!--- 
encodeDataURL function encodes the dataURL before it's served to FusionCharts.
If you've parameters in your dataURL, you necessarily need to encode it.
Param: strDataURL - dataURL to be fed to chart
Param: addNoCacheStr - Whether to add aditional string to URL to disable caching of data
--->
<cffunction name="encodeDataURL">
	<cfargument name="strDataURL">
	<cfargument name="addNoCacheStr">
	<cfif Find("?", strDataURL) GT 0>
		<cfreturn URLEncodedFormat("#strDataURL#&FCCurrTime=#getTickCount()#")>
	<cfelse>
		<cfreturn URLEncodedFormat("#strDataURL#?FCCurrTime=#getTickCount()#")>	
	</cfif>	
</cffunction>

<!--- 
renderChart renders the JavaScript + HTML code required to embed a chart.
This function assumes that you've already included the FusionCharts JavaScript class
in your page.
--->
<cffunction name="renderChart">
	<cfargument name="chartSWF">
	<cfargument name="strURL">
	<cfargument name="strXML">
	<cfargument name="chartId">
	<cfargument name="chartWidth">
	<cfargument name="chartHeight">
	<cfargument name="debugMode">
	<cfargument name="registerWithJS">

	<cfsavecontent variable="str"><cfoutput>
		<!-- START Script Block for Chart #chartId# -->
		<div id='#chartId#Div' align='center'>
			Chart.
			<!---
			The above text "Chart" is shown to users before the chart has started loading
			(if there is a lag in relaying SWF from server). This text is also shown to users
			who do not have Flash Player installed. You can configure it as per your needs.
			--->
		</div>
			<!---
			Now, we render the chart using FusionCharts Class. Each chart's instance (JavaScript) Id 
			is named as chart_"chartId".		
			--->
		<script type="text/javascript">	
			//Instantiate the Chart	
			var chart_#chartId# = new FusionCharts("#chartSWF#", "#chartId#", "#chartWidth#", "#chartHeight#", "<cfif debugMode>1<cfelse>0</cfif>", "<cfif registerWithJS>1<cfelse>0</cfif>");
			<!--- Check whether we've to provide data using dataXML method or dataURL method --->
			<cfif strXML Is "">
			//Set the dataURL of the chart
			chart_#chartId#.setDataURL("#strURL#");
			<cfelse>
			//Provide entire XML data using dataXML method 
			chart_#chartId#.setDataXML("#strXML#");
			</cfif>
			//Finally, render the chart.
			chart_#chartId#.render("#chartId#Div");
		</script>	
		<!-- END Script Block for Chart #chartId# --></cfoutput>
	</cfsavecontent>
	<cfreturn str>
</cffunction>

<!--- 
renderChartHTML function renders the HTML code for the JavaScript. This
method does NOT embed the chart using JavaScript class. Instead, it uses
direct HTML embedding. So, if you see the charts on IE 6 (or above), you'll
see the "Click to activate..." message on the chart.
 chartSWF - SWF File Name (and Path) of the chart which you intend to plot
 strURL - If you intend to use dataURL method for this chart, pass the URL as this parameter. Else, set it to "" (in case of dataXML method)
 strXML - If you intend to use dataXML method for this chart, pass the XML data as this parameter. Else, set it to "" (in case of dataURL method)
 chartId - Id for the chart, using which it will be recognized in the HTML page. Each chart on the page needs to have a unique Id.
 chartWidth - Intended width for the chart (in pixels)
 chartHeight - Intended height for the chart (in pixels)
 debugMode - Whether to start the chart in debug mode
--->
<cffunction name="renderChartHTML">
	<cfargument name="chartSWF">
	<cfargument name="strURL">
	<cfargument name="strXML">
	<cfargument name="chartId">
	<cfargument name="chartWidth">
	<cfargument name="chartHeight">
	<cfargument name="debugMode">

	<cfif strXML Is "">
		<cfset strFlashVars = "&chartWidth=#chartWidth#&chartHeight#chartHeight#&debugMode=#debugMode#&dataURL=#strURL#">
	<cfelse>
		<cfset strFlashVars = "&chartWidth=#chartWidth#&chartHeight=#chartHeight#&debugMode=#debugMode#&dataXML=#strXML#">
	</cfif>
	
	<cfsavecontent variable="str"><cfoutput>
		<!-- START Code Block for Chart #chartId# -->
		<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab##version=8,0,0,0" width="#chartWidth#" height="#chartHeight#" id="#chartId#">
			<param name="allowScriptAccess" value="always" />
			<param name="movie" value="#chartSWF#"/>
			<param name="FlashVars" value="#strFlashVars#" />
			<param name="quality" value="high" />
			<embed src="#chartSWF#" FlashVars="#strFlashVars#" quality="high" width="#chartWidth#" height="#chartHeight#" name="#chartId#" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
		</object>
		<!-- END Code Block for Chart #chartId# --></cfoutput>
	</cfsavecontent>
	<cfreturn str>
</cffunction>

Open in new window

0
 
joedfuseAuthor Commented:
When i view the source of the page to see what IE is seeing it looks perfect dont understand why its not rendering chart
<!-- START Script Block for Chart FactorySum -->
		<div id='FactorySumDiv' align='center'>
			Chart.
			
		</div>
			
		<script type="text/javascript">	
			//Instantiate the Chart	
			var chart_FactorySum = new FusionCharts("secure/Charts/MSColumn3D.swf", "FactorySum", "600", "300", "0", "0");
			
			
			//Provide entire XML data using dataXML method 
			chart_FactorySum.setDataXML("  
<chart caption='Sales Volume' showvalues='0' numberPrefix='$'>  
  <categories>  
    <category label='New Activations' /><category label='Upgrades' /><category label='H-Tier Plan' /><category label='Accessory Volume' /><category label='Equipment Protection Plan' />  
  </categories>  
  <dataset seriesName='Sales'>  
    <set value='59' /><set value='15' /><set value='12' /><set value='11' /><set value='10' />  
  </dataset>  
  <dataset seriesName='Forecast'>  
    <set value='11' /><set value='7' /><set value='9' /><set value='11' /><set value='9' />  
  </dataset>  
</chart>  
");
			
			//Finally, render the chart.
			chart_FactorySum.render("FactorySumDiv");
		</script>	
		<!-- END Script Block for Chart FactorySum -->

Open in new window

0
 
azadisaryevCommented:
ok, it is the linebreaks in the xml generated by <cfsavecontent> that are the problem.

use this instead of corresponding your code:

<cfoutput>#renderChart("Charts/MSColumn3D.swf", "", rereplace(chartXML, "\n", "", "all"), "FactorySum", 600, 300, false, false)#</cfoutput>

Azadi
0
 
azadisaryevCommented:
PS: alternatively, you can just put all code inside <cfsavecontent> tag on a single line:

<cfsavecontent variable="chartXML"><chart caption='Sales Volume' showvalues='0' numberPrefix='$'>  <categories><cfoutput query="getActivityRelate"><category label='#xmlformat(prodName)#' /></cfoutput></categories><dataset seriesName='Sales'><cfoutput query="getActivityRelate"><set value='#activityCnt#' /></cfoutput></dataset><dataset seriesName='Forecast'><cfoutput query="getActivityRelate"><set value='#forecast#' /></cfoutput></dataset></chart></cfsavecontent>

<cfoutput>#renderChart("Charts/MSColumn3D.swf", "", chartXML, "FactorySum", 600, 300, false, false)#</cfoutput>

Azadi
0
 
joedfuseAuthor Commented:
worked great when i added code to one line

Thanks !!!!!
0
 
joedfuseAuthor Commented:
Very well done
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

  • 7
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now