Sign in to follow this  
squizoid

how to create chart with data from db?

Recommended Posts

I am using classic asp to get data from database and loading into an xml string, how do I setup the new fusioncharts? It was working fine, but now we have upgraded to XT for single developer it is all different.
 
I had an include file which does all the calcs from db then adds to strXML as below:

<% 		
		'strXML will be used to store the entire XML document generated
   Dim strXML
 strXML = "<graph xaxisname='' yaxisname='Percent' numberSuffix='%25' basefontsize='12' basefont='Arial' hovercapbg='DEDEBE' decimalPrecision='0' hovercapborder='889E6D' rotateNames='0' animation='1' yAxisMaxValue='100' numdivlines='9' divLineColor='CCCCCC' divLineAlpha='80' decimalPrecision='0' showAlternateHGridColor='1' AlternateHGridAlpha='30' AlternateHGridColor='CCCCCC' caption='Percentage of Engagement' subcaption='' >"
 'Generate <set name='..' value='..'/> 
      strXML = strXML & " <categories font='Arial' fontSize='12' fontColor='000000'> <category name='" & date_1 & "' hoverText=''/> <category name='" & date_2 & "' /> <category name='" & date_3 & "' /> <category name='" & date_4 & "' /> </categories>"
	  strXML = strXML & "<dataset seriesname='Actively Disengaged' color='CD8517' showValues='0' alpha='100'> <set value='" & Cint(disen1*100) & "' /> <set value='" & Cint(disen2*100) & "' /> <set value='" & Cint(disen3*100) & "' /> <set value='" & Cint(disen4*100) & "' /> </dataset>"
	  strXML = strXML & "<dataset seriesname='Not Engaged' color='FEEEBB' showValues='0' alpha='100'> <set value='" & Cint(noten1*100) & "' /> <set value='" & Cint(noten2*100) & "' /> <set value='" & Cint(noten3*100) & "' /> <set value='" & Cint(noten4*100) & "' /> </dataset>"
 	  strXML = strXML & "<dataset seriesname='Engaged' color='F9B240' showValues='0' alpha='100'> <set value='" & Cint(engaged1*100) & "' /> <set value='" & Cint(engaged2*100) & "' /> <set value='" & Cint(engaged3*100) & "' /> <set value='" & Cint(engaged4*100) & "' /> </dataset>"
 'Finally, close <chart> element
   strXML = strXML & "</graph>"
%> 

Then from ASP page load the chart as below:

        <script type="text/javascript">
       var myChart = new FusionCharts("../../../FusionCharts/FCF_StackedColumn2D.swf", "myChartId", 450, 450); 
        myChart.setDataXML("<%=strXML%>"); 
	   myChart.render("chartdiv");
   </script>

Can I still use this method to create a chart using current version??? Can't find much help on how to format new FusionCharts
 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this