Hi,

This is how we use webcharts.

1. We save the project (WCP file) in a folder accessible by the CF server.
We use to save just WC3D style sheet but realised that we could just grab
that from the WCP file at run time and saving one project file is easier to
maintain than 2 files for each chart.

2. Create the XML Style from the WCP project.  Could have parsed the
document into XML then then grabbed the frameChart element but this appeared
to be simplier and quicker. (example below)

            <!--- Read the WCP file --->

            <!--- Get the frameChart component --->
                    <cfset iStart = findNoCase("<frameChart",sChartStyle)>
                    <cfset iEnd = findNoCase("</frameChart>",sChartStyle)>
                    <cfsavecontent variable="chartStyle">
                        <cfoutput><?xml version="1.0" encoding="UTF-8"?>
                        #mid(sChartStyle,iStart,iEnd-iStart+13)#
                        </cfoutput>
                    </cfsavecontent>

3. Create the chart model XML (example below)

<cffunction name="getChartModel" returntype="string" access="public"
hint="Get chart model">
    <cfargument name="qChartData" type="query" required="true">

    <cfset var qChartDataStructure = arguments.qChartData>

    <cfsavecontent variable="chartModel">
<cfoutput><?xml version="1.0" encoding="UTF-8"?>
<XML type="default">
<COL>Beef</COL>
<COL>Sheep</COL>
<ROW col0="100.0" col1="100.0">1990</ROW>
<ROW col0="111.790393" col1="108.9197225">1991</ROW>
<ROW col0="116.1572052" col1="94.54905847">1992</ROW>
<ROW col0="113.5371179" col1="80.57482656">1993</ROW>
<ROW col0="121.8340611" col1="86.0753221">1994</ROW>
<ROW col0="114.4104803" col1="67.34390486">1995</ROW>
<ROW col0="126.6375546" col1="78.49355798">1996</ROW>
<ROW col0="123.580786" col1="70.31714569">1997</ROW>
<ROW col0="146.7248908" col1="63.67690783">1998</ROW>
<ROW col0="144.5414847" col1="68.43409316">1999</ROW>
<ROW col0="117.0305677" col1="56.98711596">2000</ROW>
<ROW col0="122.7074236" col1="59.96035679">2001</ROW>
<ROW col0="135.371179" col1="58.67195243">2002</ROW>
<ROW col0="124.4541485" col1="47.32408325">2003</ROW>
<ROW col0="141.0480349" col1="47.27452924">2004</ROW>
</XML></cfoutput>
    </cfsavecontent>
    <cfreturn chartModel>
</cffunction>

4.  Call the webcharts engine directly
    <cfscript>
                oMyWebChart = createObject("Java","
com.gp.api.jsp.MxServerComponent");
                oMyApp = getPageContext().getServletContext();
                oSvr = oMyWebChart.getDefaultInstance(oMyApp);
                oMyChart2 = oSvr.newImageSpec();
                oMyChart2.width = this.chartXSize;
                oMyChart2.height= this.chartYSize;
                oMyChart2.type = this.chartType;
                oMyChart2.style = "#chartStyle#";
                oMyChart2.model = "#chartModel#";
            </cfscript>
            <!--- Create html tag set --->
            <cfsavecontent variable="chartImgTag">

<cfoutput>#oSvr.getImageTag(oMyChart2,"#this.analURL#")#</cfoutput>
           </cfsavecontent>
           <!--- Good old Webcharts loves to add an extra /Images/ to the
URL --->
           <cfset chartImgTag =
replace(chartImgTag,"#this.analURL#Images/","#this.analURL#","All")>

5.  Use the resultant HTML in your web page.


So there is probably some errors in the code presented here as I have just
cut and past from our analysis engine but it will work with a little
tweeking.

Hope it helps.

Simon Haddon


On 18/01/2008, Simon Haddon <[EMAIL PROTECTED]> wrote:
>
> Yes. You can bypass the limitations with the XML and a little Java.  Or
> you can bypass by using all Java.  In the Webcharts3D designer you can cut /
> paste / modify the generated Java to use or you can use the XML and hook
> directly into the charts engine.  Entierh way you totally bypass any
> limitation presented by the cfcharts tags.  This is how we generate our
> graphs for exactly that reason
>
> I will find the examples and attach them in a short while
>
> Cheers,
> Simon
>
>
> On 18/01/2008, Raymond Camden < [EMAIL PROTECTED]> wrote:
> >
> >
> > So wait - you mean using the Java engine from CF, right? Because even
> > if you use the XML approach, taking the XML from the designer tool,
> > the limitations apply.
> >
> > Are you saying that a CFer could bypass these limitations?
> >
> > On Jan 17, 2008 3:10 PM, Simon Haddon < [EMAIL PROTECTED]> wrote:
> > > You are right if you are using the CF tags but what Steve is talking
> > about
> > > is accessing the Webcharts3D engine directly.  This allows you to
> > access the
> > > styles that are available in the designer with no limitations that I
> > have
> > > come across yet.
> > >
> > > You just have to approach the charting system differently using the
> > xml or
> > > java code directly.
> > >
> > > Cheers,
> > > Simon
> > >
> > >
> > >
> > > On 18/01/2008, Raymond Camden < [EMAIL PROTECTED]> wrote:
> > > >
> > > >
> > > >
> > > >
> > > > Just don't forget that the Chart Editor supports chart types that CF
> > > > doesn't - like the guages.
> > > >
> > > > On Jan 17, 2008 5:00 AM, Steve Onnis <[EMAIL PROTECTED]> wrote:
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > Would love some.  As i said i cant seem to find the import path so
> > any
> > > help
> > > > > would be greatJ
> > > > >
> > > > >
> > > > >
> > > > > steve
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > From: cfaussie@googlegroups.com [mailto: cfaussie@googlegroups.com
> > ] On
> > > Behalf
> > > > > Of Simon Haddon
> > > > >  Sent: Thursday, 17 January 2008 9:32 PM
> > > > >  To: cfaussie@googlegroups.com
> > > > >  Subject: [cfaussie] Re: CFCHART question
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > Absolutely.  You can use the webcharts3D package to build the XML
> > for
> > > you
> > > > > then use it directly or you can open up the java objects.  However
> > the
> > > > > easiest way is to use the XML directly .  That way you can just
> > cut and
> > > past
> > > > > a new XML format document in when required.
> > > > >
> > > > >  If you want some sample code I can give it to you tomorrow.
> > > > >
> > > > >  Cheers,
> > > > >  Simon
> > > > >
> > > > >
> > > > > On 17/01/2008, Steve Onnis < [EMAIL PROTECTED] > wrote:
> > > > >
> > > > >
> > > > > Does anyone know if you can access the underlying chart functions
> > like
> > > they
> > > > > show you in the webCharts builder?
> > > > >
> > > > > for example they show this is a way to access it using JSP
> > > > >
> > > > > <%@ taglib prefix="ct" uri="/WEB-INF/wc3d50.tld" %>
> > > > >  <ct:webchart type="PNG" width="400" height="300"
> > > > > getImageURL="/getImage.jsp"
> > > > >      style=" <frameChart is3D=\"false\"> <frame xDepth=\"3\"
> > > yDepth=\"1\"
> > > > > leftAxisPlacement=\"Back\"> <background minColor=\"#FDFEF6\"/>
> > </frame>
> > > > > <xAxis type=\"DateTime\" scaleMin=\"0\"> <labelFormat
> > > > > style=\"DateTimePattern\" pattern=\"yyyy-mm-dd\"/> <parseFormat
> > > > > pattern=\"#,##0.###\"/> <dateTimeStyle majorUnit=\"Month\"/>
> > </xAxis>
> > > > > <elements place=\"Stacked\" shape=\"Line\" drawOutline=\"false\"
> > > > > showMarkers=\"false\"> <morph morph=\"Grow\"/> </elements>
> > > </frameChart>"
> > > > >      >
> > > > >  <?xml version="1.0" encoding="UTF-8"?>
> > > > >  <XML type="default">
> > > > >  <COL>2006-12-01</COL>
> > > > >  <COL>2006-12-06</COL>
> > > > >  <COL>2006-12-11</COL>
> > > > >  <COL>2006-12-18</COL>
> > > > >  <COL>2006-12-25</COL>
> > > > >  <COL>2007-01-02</COL>
> > > > >  <ROW col0="100.0" col1=" 200.0" col2="100.0" col3="180.0" col4="
> > 200.0"
> > > > > col5="400.0">Sample 0:</ROW>
> > > > >  <ROW col0=" 150.0" col1="300.0" col2="250.0" col3=" 230.0" col4="
> > 250.0"
> > > > > col5="420.0">Sample 1:</ROW>
> > > > >  </XML>
> > > > >  </ct:webchart>
> > > > >
> > > > > Can this be converted to CFML? I tried to convert the import to a
> > > CFIMPORT
> > > > > but didnt work
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > Steve Onnis
> > > > > Director / Head Developer
> > > > >
> > > > > [EMAIL PROTECTED]
> > > > >
> > > > > Australia : 1300 856 623
> > > > >  International : +61 3 9882 5875
> > > > >
> > > > > 0401 667 996
> > > > >
> > > > > www.inevative.com.au
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >  --
> > > > >  Cheers
> > > > >  Simon Haddon
> > > > >
> > > > >
> > > > >
> > > > >  >
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > >
> > > >
> > >
> > ===========================================================================
> > > > Raymond Camden, Camden Media
> > > >
> > > > Email    : [EMAIL PROTECTED]
> > > > Blog      : www.coldfusionjedi.com
> > > > AOL IM : cfjedimaster
> > > >
> > > > Keep up to date with the community:
> > http://www.coldfusionbloggers.org
> > > >
> > > >
> > >
> > >
> > >
> > > --
> > >
> > >
> > > Cheers
> > > Simon Haddon
> > >  >
> > >
> >
> >
> >
> > --
> >
> > ===========================================================================
> > Raymond Camden, Camden Media
> >
> > Email    : [EMAIL PROTECTED]
> > Blog      : www.coldfusionjedi.com
> > AOL IM : cfjedimaster
> >
> > Keep up to date with the community: http://www.coldfusionbloggers.org
> >
> > > >
> >
>
>
> --
> Cheers
> Simon Haddon




-- 
Cheers
Simon Haddon

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"cfaussie" group.
To post to this group, send email to cfaussie@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cfaussie?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to