Sign in to follow this  
Neverguesswho

Exporting

Recommended Posts

So I am trying to enable the exporting feature. It allows me to download it as a jpeg or png. I want to get it to do pdf also and I don't think it is supposed to look like this.<_<Any ideas?

This is my code

"<chart caption = Export Test' PYAxisName ='MSP' SYAxisName = 'MDN' showYAxisValues='0' rotatelabels='0' showToolTip='1' showNames='1' showlabels='1' exportEnabled='1' exportShowMenuItem='1' exportFormats='PDF' exportType='PNG=Export as High Quality Image;JPG;PDF=Export as PDF File' exportatclient='1' ExportFileName='TestFile'>

post-28394-0-08966800-1345229578_thumb.jpg

Share this post


Link to post
Share on other sites

Hi,

 

Can you please paste your sample code here?

 

<%@ Language=VBScript %>
  <!-- #INCLUDE file="FusionCharts.asp" -->
  <!-- #INCLUDE file="DBConn2.asp" -->
  <!-- #INCLUDE file="header2.asp" -->
  <!-- #INCLUDE file="hours.asp" -->




<html>
<head>
   	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

   	<title>BPC</title>
   	<link href="../assets/ui/css/style.css" rel="stylesheet" type="text/css" />
   	<script type="text/javascript" src="jquery.min.js"></script>


		<style type="text/css">

       	body,html,head,div{height:100%; min-height:100%;width:100%; }
   	</style>
	<script LANGUAGE="Javascript" SRC="FusionCharts.js"></SCRIPT>
</head>

<body bgcolor='#FFFFFF'>
<table id="PgHead" width="98%" align="center" style="margin-bottom:7px;border-bottom:1px solid #AFAFA4; bgcolor:#000000">
<tbody>
<tr>
<td width="20%" align="left" style="color:#475B8F;font-family:'Arial Rounded MT Bold',arial;font-size:14pt;"></td>
<td class="NoPrint" width="45%" align="right" style="color:#4D4D5F;font-family:arial;font-size:14pt;">
<a href="../ListRecord.asp?theFormID=96">Back</a>
</td>
</tr>
</tbody>
</table>

<div id="MainContainer">
<table class="grid1" width="100%">
<tbody>
<tr>

<td style="height= 350%; background-color:#F6F5E6;vertical-align:top;" align="center">
<div id="chartdiv1" align="center"></div> 
  </br></br></br>

<%

Dim subjectCode,subjectID,treatmentCode,baseline,count, motherID,x
Dim FC,strQuery,strCategory, strValueMax, strValueMin,strValueTreat,upper, lower
Dim maxFirstNum,maxSecondNum,minFirstNum,minSecondNum,fQuarter,sQuarter,tQuarter,increment



subjectCode = Request.QueryString("subjectCode")

Response.Write("Subject Code: " & subjectCode & "<br />")
Set oConn = Server.CreateObject("ADODB.Connection")	
Set oRs = Server.CreateObject("ADODB.Recordset")
oConn.Open strConnQuery

strQuery="Select z.ID as totOutput, d.zTreatmentCode as totOutput2 from vSubjectDemographics d, zSubject z where z.zsubjectCode = d.zSubjectCode AND z.zSubjectCode = "&subjectCode&" "'get treatment and subjectID
Set oRs = oConn.Execute(strQuery)
if oRS.EOF OR oRs.BOF then 
%><h2>I am sorry but there is no record for that subject</h2>
<%
else
subjectid = oRs("totOutput")
treatmentCode = oRs("totOutput2")

if treatmentCode=1 then 'figure out upper/lower bound of BP from treatment
   	upper=140
   	lower=110
else
   	upper=180
   	lower=141
end if

strQuery="Select  ID as mother from F05 where zsubjectID = "&subjectID&" "  
set oRs = oConn.Execute(strQuery)
if oRS.EOF OR oRs.BOF then 

	for q = 0 to 10
response.write("<br>")
Next
	%>
	<h2>I am sorry but there is no data for that subject</h2>
	<%
	for q = 0 to 20
response.write("<br>")
Next
else
motherID = oRs("mother")

strQuery= "Select count(ID) as totOutput from F05C where MotherRecID = "&motherID&" "'get number of hours assessed 
set oRs = oConn.Execute(strQuery)
count = oRs("totOutput")

'exportFormats='PDF=Export as PDF|JPG=Export as JPG'

x=0
strCategory = "<chart caption = 'Blood Pressure with Treatment' PYAxisName ='Minimum Systikuc Blood Pressure (mmHg)' SYAxisName = 'Maximum Dose of Nicardiphine (mg/hr)' showYAxisValues='0' rotatelabels='0' showToolTip='1' showNames='1' showlabels='1' exportEnabled='1' exportAtClient='1' exportHandler='fcExporter1' > <categories> <category label = 'Base' />"
strCategory = strCategory + "<category label = '"&hours(0)&"' showlabels='1' />"
strCategory = strCategory + "<category label = '"&hours(1)&"' showlabels='1'/>"
strCategory = strCategory + "<category label = '"&hours(2)&"' showlabels='1'/>"
strCategory = strCategory + "<category label = '"&hours(3)&"' /> <vLine color='FF5904' Label='First Hour' />"

strValueMax = "<dataset seriesName = 'Max SBP' parentYAxis = 'P' renderAs='Line' showValues='0'  > <set value = '0'  />"
strValueMin = "<dataset seriesName = 'Min SBP' parentYAxis = 'P' renderAs='Line' showValues='0' > <set value = '0'  />"
strValueTreat = "<dataset seriesName = 'NICARDIPINE' parentYAxis = 'S' renderAs='Line' dashed='1'> <set value = '0'  />"


min=0   
max=0
minFirstNum=0
maxFirstNum=0
reatFirstNum=0

while x < count 
if x > 3 then
   	strCategory = strCategory + "<category label = '' />"
   	strCategory = strCategory + "<category label=' ' />"
   	strCategory = strCategory + "<category label=''/>"
   	strCategory = strCategory + "<category label='"&hours(x)& "' />"


end if
if min=max Then
   	MinimumDashed=1
else 
   	MinimumDashed=0
end if

strQuery= "Select QB as Max, QC as Min, QG as Treatment fromF05C where OrderNb = "&x+1&" AND MotherRecID = "&motherID&" " ' get max,min,treatment
set oRs = oConn.Execute(strQuery)

min = oRs("Min")
max = oRs("Max")
treatinfo=oRs("Treatment")
minSecondNum=min
maxSecondNum=max
treatSecondNum=treatinfo
if x>3 then
   	increment=(minSecondNum-minFirstNum)/4
   	fQuarter=minFirstNum+increment
   	sQuarter=fQuarter+increment
   	tQuarter=sQuarter+increment
   	strValueMin = strValueMin + "<set value = '"&fQuarter&"' anchorRadius='0' tooltext=' '/>"
   	strValueMin = strValueMin + "<set value = '"&sQuarter&"' anchorRadius='0' tooltext=' '/>"
   	strValueMin = strValueMin + "<set value = '"&tQuarter&"' anchorRadius='0' tooltext=' '/>"
   	increment=(maxSecondNum-maxFirstNum)/4
   	fQuarter=maxFirstNum+increment
   	sQuarter=fQuarter+increment
   	tQuarter=sQuarter+increment
   	strValueMax = strValueMax + "<set value = '"&fQuarter&"' anchorRadius='0' toolText=' '/>"
   	strValueMax = strValueMax + "<set value = '"&sQuarter&"' anchorRadius='0' toolText=' '/>"
   	strValueMax = strValueMax + "<set value = '"&tQuarter&"' anchorRadius='0' toolText=' '/>"
   	increment=(treatSecondNum-treatFirstNum)/4
   	fQuarter=treatFirstNum+increment
   	sQuarter=fQuarter+increment
   	tQuarter=sQuarter+increment
   	strValuetreat = strValuetreat + "<set value = '"&fQuarter&"' showvalue='0' anchorRadius='0' toolText=' '/>"
   	strValuetreat = strValuetreat + "<set value = '"&sQuarter&"' showvalue='0' anchorRadius='0' toolText=' '/>"
   	strValuetreat = strValuetreat + "<set value = '"&tQuarter&"' showvalue='0' anchorRadius='0' toolText=' '/>"
  end if   		

strValueMin = strValueMin + "<set value = '"&oRs("Min")&"'  toolText='Min SBP, Hour:"&hours(x)&"'/>"
strValueMax = strValueMax + "<set value = '"&oRs("Max")&"'  toolText='Max SBP, Hour:"&hours(x)&"' />"
strValueTreat = strValueTreat + "<set value = '"&oRs("Treatment")&"' toolText='Hour:"&hours(x)&"' />"
x=x+1
minFirstNum=minSecondNum
maxFirstNum=maxSecondNum
treatFirstNum=treatSecondNum

  wend
strCategory = strCategory + "</categories>"
strValueMax = strValueMax + "</dataset>"
strValueMin = strValueMin + "</dataset>"
strValueTreat = strValueTreat + "</dataset> <trendLines> <line startvalue= '"&upper&"' color = '' displayvalue='Upper SBP Bound'/> <line startvalue= '"&lower&"' color = '' displayvalue='Lower SBP Bound'/> </trendLines></chart>"

Set oRs = Nothing
strCategory = strCategory + strValueMax + strValueMin + strValueTreat 
response.Write(strCategory)
Call FC_SetRenderer("javascript")
Call renderChart("MSCombiDY2D.swf","", strCategory,"BloodPressure",1300,650,"1","1")
oConn.Close

end if
end if
%>
</tr>
</tbody>
</table>
</div>
<%call PageFooter()%>
</body>
</html>

Edited by Neverguesswho

Share this post


Link to post
Share on other sites
Guest Sumedh

Hi,

 

Before you start, you need to follow these steps:

 

> Copy FusionChartsExportComponent.js from Download Package > Charts folder to your server. A good location is where you have placed FusionCharts.js

> Copy FCExporter.swf from Download Package > Charts to your server. A good location is where you have placed the other chart SWF files.

> Include an instance of Exporter Component in your web page.

> Configure the chart (XML) to use this instance of export component.

 

You would have to create a separate div for rendering the FusionCharts Export Component. In this div, you would need to create the instance of FusionChartsExportObject as follows,

 

Ref. Code:

 

<div id="fcexpDiv" align="center">FusionCharts Export Handler Component</div>
<script type="text/javascript">
   var myExportComponent = new FusionChartsExportObject("fcExporter1", "FCExporter.swf");
   myExportComponent.Render("fcexpDiv");
</script>

 

Then add the necessary attributes for client side export in the XML:

 

Ref. Code:

<chart caption='Monthly Unit Sales' xAxisName='Month' yAxisName='Units'  showValues='0' formatNumberScale='0' showBorder='0' unescapeLinks='0' exportEnabled='1' exportAtClient='1' exportFormats='PDF' exportHandler='fcExporter1'>

 

For more information, please refer this URL: http://docs.fusionch...ientSimple.html

 

Also, find attached illustration for your reference.

Chart_ASPExport.zip

Share this post


Link to post
Share on other sites

Hi,

 

Before you start, you need to follow these steps:

 

> Copy FusionChartsExportComponent.js from Download Package > Charts folder to your server. A good location is where you have placed FusionCharts.js

> Copy FCExporter.swf from Download Package > Charts to your server. A good location is where you have placed the other chart SWF files.

> Include an instance of Exporter Component in your web page.

> Configure the chart (XML) to use this instance of export component.

 

You would have to create a separate div for rendering the FusionCharts Export Component. In this div, you would need to create the instance of FusionChartsExportObject as follows,

 

Ref. Code:

 

<div id="fcexpDiv" align="center">FusionCharts Export Handler Component</div>
<script type="text/javascript">
   var myExportComponent = new FusionChartsExportObject("fcExporter1", "FCExporter.swf");
   myExportComponent.Render("fcexpDiv");
</script>

 

Then add the necessary attributes for client side export in the XML:

 

Ref. Code:

<chart caption='Monthly Unit Sales' xAxisName='Month' yAxisName='Units'  showValues='0' formatNumberScale='0' showBorder='0' unescapeLinks='0' exportEnabled='1' exportAtClient='1' exportFormats='PDF' exportHandler='fcExporter1'>

 

For more information, please refer this URL: http://docs.fusionch...ientSimple.html

 

Also, find attached illustration for your reference.

 

I followed your directions and I still got the messed up message.... So I decided to try to create a new page with the exact same ASP and it works!!! I am guessing it was something with my html that was messed up. Also I was able to get it working on another chart just by enabling the export under <chart> and I didn't even include the exportjs or swf(just thought i'd mention that). Anyways thanks again for the help!!!!!!:lol:

Share this post


Link to post
Share on other sites

I have another question. I had to change the rendering type from javascript to flash and now when I try to export/save I right click and select the format. It does its little loading animation then nothing happens. If I render it in javascript then the export works fine.. So my code is the exact same minus changing the SETRenderer(). Any ideas?

Share this post


Link to post
Share on other sites
Guest Sumedh

Hi,

 

Did you include the Chart .swf file as well as FCExporter.swf in your project folder?

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