Sign in to follow this  
djjwp

CodeCharge Studio

Recommended Posts

I will be purchasing Fusion Charts and will need to get it working within CCS projects. I'm looking for anyone who has done this before and can offer any type of "how to". :w00t:

Thanks

Don

Share this post


Link to post
Share on other sites

Hi,

As of now, we've not yet integrated FusionCharts with CCS. However, if someone is willing to take this initiative, we can help in all possible ways.

Share this post


Link to post
Share on other sites

I have made some progress in that I can get some of the data using the db examples but can I get pointed to an example like the BasicDBExample.asp with only one table involved. The data I need to pull in would come from a query like this...

 

 

 

Table:

 

ID, TktNbr, Fname, LName, Lead, Agent

 

1,123,John,Smith,1,0

 

2,124,Jane,Doe,0,1

 

3,125,Bob,Jones,1,0

 

4,126,John,Smith,1,0

 

 

 

select count(id) as Tickets, concat(FName," ",LName) as Name where Lead =1 Group by Lname

 

 

 

Resulting in:

 

2, John Smith

 

1, Bob Jones

 

 

 

Now I would need that in to an xmlString

 

 

 

Once I get that working, I will be able to see and document how to make CodeCharge Studio use it. I know this may be simple but I just have never had to do this, CCS makes it so easy and does not use XML.

Share this post


Link to post
Share on other sites

Made some headway but I'm getting an error when it goes to render the chart:

Line: 10

Char: 3

Error: 'FusionCharts' is undefined

Code: 0

URL: http:// IP /ReportsV1/DEV/NewPage1.asp

 

Do you want to continue running scripts on this page.

I select yes and I get a blank page with "Chart." on top.

I have seen referance to this on several sites but no resolution.

Share this post


Link to post
Share on other sites

Got past that error.

I created a sub folder called include and placed the .JS, .asp, and the Pie3d.swf file in it and made sure it points to the file.

I added a print atatement and see my data on the page when it does the loop.

I see no chart at all or attempt to render it. :w00t: The page is blank except the data printed from within the loop.

Share this post


Link to post
Share on other sites

I may nave the reason but not the answer as to why. :w00t:

 

 

 

here is the code after it runs...

 

 

 

<!-- START Script Block for Chart stats -->

<div id='statsDiv' align='center'>

Chart.



</div>



<script type="text/javascript">

//Instantiate the Chart

var chart_stats = new FusionCharts("/Includes/Pie3D.swf", "stats", "600", "300", "0", "0");



//Provide entire XML data using dataXML method 

chart_stats.setDataXML("<chart caption=' Tickets' subCaption='' pieSliceDepth='30' 

showBorder='1' formatNumberScale='0' numberSuffix=' Tickets'>

<set label='CRAG' value='1738'/><set label='RUT' value='2955'/>

<set label='SWEET' value='799'/><set label='YANO' value='24'/></chart>");



//Finally, render the chart.

chart_stats.render("statsDiv");

</script>

<!-- END Script Block for Chart stats -->

<%@ Language=VBScript %>

<html>

<head>



<TITLE>

NOC Test Page

</TITLE>

<style type="text/css">

<!--

body {

font-family: Arial, Helvetica, sans-serif;

font-size: 12px;

}

.text{

font-family: Arial, Helvetica, sans-serif;

font-size: 12px;

}

-->

</style>

<SCRIPT LANGUAGE="Javascript" SRC="Includes/FusionCharts.js"></SCRIPT>

</head>



<body>





<p align="center"><br>

<br>

<a href="/ReportsV1/DEV/Includes/NoChart.html" target="_blank">Unable to see the chart above?</a> </p>

</body>

</html>

 

 

 

It appears that when I place the code into the "before show" event it executes before loading the html, its backwards. In CodeCharge Studio (CCS) using PHP, this works, in ASP it will not.

Edited by Guest

Share this post


Link to post
Share on other sites

This is the Before Show code:

dim stats
dim rs
dim sql
dim cn
dim field1
dim field2
'strXML will be used to store the entire XML document generated
Dim strXML
'Make db conx
cn = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=1.1.1.1;
DATABASE=netops;USER=root;
PASSWORD=password;OPTION=3"
set rs = server.createobject("adodb.recordset")
sql = "SELECT Count(tkt_tickets.ID) AS field1, Tkt_tickets.ResolvedBy 
as field2 FROM contacts INNER JOIN Tkt_tickets ON 
contacts.LName = Tkt_tickets.ResolvedBy 
Where LEAD=1 GROUP BY Tkt_tickets.ResolvedBy"
'Start XML data
strXML = "<chart caption=' Tickets' subCaption='' pieSliceDepth='30' 
showBorder='1' formatNumberScale='0' numberSuffix=' Tickets'>" 

'Open db and grab records
 rs.open sql, cn
   do while not rs.eof
'Write the data line
strXML = strXML & "<set label='" & rs("field2") & "' value='" & rs("field1")& "'/>"
'Print data to 
Print rs("field2") & " " & rs("field1") & "<br>"
'Go to next record
   rs.movenext
   loop
'Close loop and conx
rs.close
set rs = nothing
'Finally, close <chart> element
 'Finally, close <chart> element
 strXML = strXML & "</chart>"
 
'Create the chart - Pie 3D Chart with data from strXML
Call renderChart("/Includes/Pie3D.swf", "", strXML, "stats", 600, 300, false, false)
Set rs = nothing

Edited by Guest

Share this post


Link to post
Share on other sites

Don,

I've not understood this part, as I'm not familiar with CodeCharge Studio (though, I've a lot of experience in ASP). If you can please elaborate more on the process flow, I can help you with this.

Share this post


Link to post
Share on other sites

CCS separates the code during development and the HTML is included in the ASP when it runs.

The html page gets the .js include

 

A label is then added to the page and the Code for the chart is placed in the before show event on the label which is in the ASP file.

 

What appears to be happening is the before event triggers and displays what it has from the ASP file and then goes back to include the .js from the html which then will render an empty chart.

 

I have it working in PHP but can not get it to do what I need it to ASAP. :w00t:

Edited by Guest

Share this post


Link to post
Share on other sites

So, effectively before the FusionCharts.js is being included, the chart code is being invoked?

In that case, can you try using the renderChart() (ASP Function) from FusionCharts.asp? That will make CCS think of the code as ASP - and this code outputs HTML code for the chart.

Share this post


Link to post
Share on other sites

Solution:

Create a folder called Charts, then a subfolder called Includes and then one in there of ChartsSWF. You end up with this structure:

 

Charts

Includes

  ChartsSWF

Now put your SWF files into the ChartsSWF folder

In the Includes folder place FusionCharts.asp and FusionCharts.js.

Now in the Charts Folder, create two pages; Charts.asp and ChartsData.asp

 

Edit Charts.asp and add

<script language="Javascript" src="Includes/FusionCharts.js"></script>

just above the </head> tag in the HTML tab.

Switch to the Code tab and insert:

<!-- #INCLUDE VIRTUAL="/ReportsV1/Charts/Includes/FusionCharts.asp" -->

to the 'Includes Common Files' section at the page top and then move to the bottom of the page and add:

 

'Variable to contain dataURL
 Dim strDataURL
'Set DataURL with animation property to 1
'NOTE: It's necessary to encode the dataURL if you've added parameters to it
  'strDataURL = encodeDataURL("ChartsData.asp?animate=1")
  strDataURL = "ChartsData.asp"
'Create the chart - Pie 3D Chart with dataURL as strDataURL
  Call renderChart("Includes/ChartsSWF/Column3D.swf", strDataURL, "", "stats", 600, 400, false, false)

Open the ChartsData.asp

Open the HTML tab and remove all code, leave it blank.

Add Custon Code to On Initialize Code and add the following, edit as needed:

dim statsdim rs
dim sql
dim cn
dim field1 'Hold data returned
dim field2 'Hold name
dim strXML 'strXML will be used to store the entire XML document generated

'Default.asp has passed us a property animate. We request that.
 Dim animateChart
 animateChart = Request.QueryString("animate")
'Set default value of 1
 if animateChart="" then
  animateChart = "1"
 end if
'Make db conx
cn = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=Your server IP;DATABASE=YourDB;USER=root;PASSWORD=YourPassword;OPTION=3"
set rs = server.createobject("adodb.recordset")
'Create your SQL here, this was mine
sql = "SELECT Count(tkt_tickets.ID) AS field1, Tkt_tickets.ResolvedBy as field2 FROM contacts INNER JOIN Tkt_tickets ON contacts.LName = Tkt_tickets.ResolvedBy Where DAYLIGHT=1 GROUP BY Tkt_tickets.ResolvedBy"
'Start XML data
strXML = "<chart caption=' Tickets Closed By Daylight Operators' subCaption='1/1/2006 to 12/31/2006' pieSliceDepth='30' showBorder='0' formatNumberScale='0' numberSuffix=' Tickets' animation='0'>"

'Open db and grab records
 rs.open sql, cn
   do while not rs.eof
'Write the data line
 strXML = strXML & "<set label='" & rs("field2") & "' value='" & rs("field1")& "'/>"
'Go to next record
   rs.movenext
   loop
'Finally, close <chart> element
 strXML = strXML & "</chart>"
'Close loop and conx
 rs.close
Set rs = nothing
'Set Proper output content-type
 Response.ContentType = "text/xml"
'Just write out the XML data
'NOTE THAT THIS PAGE DOESN'T CONTAIN ANY HTML TAG, WHATSOEVER
 Response.Write(strXML)

Good luck, It does work well and can be replicated just by coping the pages and changing the query.

Thanks to all who helped me get this working.

Edited by Guest

Share this post


Link to post
Share on other sites

This is the Before Show code:

dim stats
dim rs
dim sql
dim cn
dim field1
dim field2</P><P>'strXML will be used to store the entire XML document generated
Dim strXML</P><P>'Make db conx
cn = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=1.1.1.1;
DATABASE=netops;USER=root;
PASSWORD=password;OPTION=3"
set rs = server.createobject("adodb.recordset")
sql = "SELECT Count(tkt_tickets.ID) AS field1, Tkt_tickets.ResolvedBy 
as field2 FROM contacts INNER JOIN Tkt_tickets ON 
contacts.LName = Tkt_tickets.ResolvedBy 
Where LEAD=1 GROUP BY Tkt_tickets.ResolvedBy"</P><P>'Start XML data
strXML = "<chart caption=' Tickets' subCaption='' pieSliceDepth='30' 
showBorder='1' formatNumberScale='0' numberSuffix=' Tickets'>" </P><P>
'Open db and grab records
rs.open sql, cn</P><P>   do while not rs.eof
'Write the data line
strXML = strXML & "<set label='" & rs("field2") & "' value='" & rs("field1")& "'/>"
'Print data to 
Print rs("field2") & " " & rs("field1") & "<br>"</P><P>'Go to next record
rs.movenext
loop</P><P>'Close loop and conx
rs.close
set rs = nothing</P><P>'Finally, close <chart> element
'Finally, close <chart> element
strXML = strXML & "</chart>"

'Create the chart - Pie 3D Chart with data from strXML
Call renderChart("/Includes/Pie3D.swf", "", strXML, "stats", 600, 300, false, false)</P><P>Set rs = nothing

 

 

 

 

 

Hola! me podrias pasar el codigo que pones en el html y en el codigo de eventos, en que parte se pone el #include Virtual = /FusionCharts.asp??? y en que form incluis el codigo del before event. gracias!

 

 

 

 

 

Share this post


Link to post
Share on other sites
Guest Angshu

Hi,

 

Welcome to FusionCharts Forum!smile.gif

 

Could you please elaborate your query a bit more in english?

 

Awaiting for your response.

Share this post


Link to post
Share on other sites

Hi,

 

Welcome to FusionCharts Forum!smile.gif

 

Could you please elaborate your query a bit more in english?

 

Awaiting for your response.

 

 

 

Hi,

I am working with CCS and I have to make graphics with FusionChart

I wonder if I could say how to apply with CodeCharge FusionCharts in asp.

where in place the #include virtual = /fusioncharts.asp

as the code in the html label Before show

In short, what is the code I have to put the html and code in CodeCharge, and in the event show the label Before and if possible an example thanks

Share this post


Link to post
Share on other sites
Guest Angshu

Hi,

 

Glad to know that you have managed to resolve your problem.

 

Could you please share the solution in this forum thread?

 

Happy FusionCharting!biggrin.gif

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