Solved

connecting graph points using lines on cfchart

Posted on 2011-09-28
6
448 Views
Last Modified: 2012-05-12
I need help trying to connect the graph points on a linear chart using cfchart.  The problem is that if the responseDates on my query are not concurrent.  It breaks.  The attached file shows what I'm talking about.  

The following is the code that I'm using
<!---The function being called on the cfc page--->
<cffunction name="ftnTrend" access="public" returntype="query">
			<cfargument name="fromDate" required="yes" type="date">
            <cfargument name="toDate" required="yes" type="date">
            <cfargument name="deptID" required="yes" type="numeric">
            
            <cfquery name="qDeptRpt" datasource="#application.dsn#">
                SELECT     o.orgname
                     ,acc.score AS accuracy
                     , tim.score AS timeliness
                     , tude.score AS attitude
                     , access.score as Accessibility
                    ,r.responseDate as responseDate
                FROM   responses r
                  INNER JOIN responseDepts dept ON dept.response_id = r.response_id
                  Inner JOIN org o ON o.orgid = r.orgid
                  LEFT JOIN responseDeptScores acc ON dept.respDept_id = acc.respDept_id
                                 and(acc.scoreType_id = 1)
                                 and(acc.score !=0)
                  LEFT JOIN responseDeptScores tim ON dept.respDept_id = tim.respDept_id
                       and (tim.scoreType_id = 2)
                       and (tim.score !=0)
                  LEFT JOIN responseDeptScores tude ON dept.respDept_id = tude.respDept_id
                      and (tude.scoreType_id = 3)
                      and (tude.score !=0)
                    LEFT JOIN responseDeptScores access ON dept.respDept_id = access.respDept_id
                                    and (access.scoreType_id = 4)
                                    and (access.score !=0)
 WHERE  dept.responseDate >= #createODBCdate(arguments.fromDate)#
                 AND      dept.responseDate <=  #createODBCdate(arguments.toDate)#
				And dept.deptType_id = <cfqueryparam cfsqltype="cf_sql_numeric" value="#arguments.deptID#">
            GROUP BY  o.orgname, acc.score, tim.score,tude.score, access.score, r.responseDate          
            
            </cfquery>
            
            <cfreturn qDeptRpt>
       	</cffunction>

    <!---The Trend Line page--->
    <cfif isDefined("form.submit") and form.submit eq "submit">
    	<cfinvoke 
             component="Review.Components.Review"
             method="ftnTrend"
             returnvariable="ftnTrendRet">
                <cfinvokeargument name="fromDate" value="#form.fromdate#"/>
                <cfinvokeargument name="toDate" value="#form.todate#"/>
                <cfinvokeargument name="deptID" value="#form.selDeptID#"/>
        </cfinvoke>
	</cfif>

<cfchart chartwidth="750" chartheight="400" yaxistitle="Score" xaxistitle="Weeks" showxgridlines="yes" showlegend="yes" scaleto="6" >
	<cfchartseries type="line" query="ftnTrendRet" valuecolumn="accuracy" itemcolumn="#DateFormat(ftnTrendRet.responseDate,'mm/dd/yyyy')#"></cfchartseries>
    <cfchartseries type="line" query="ftnTrendRet" valuecolumn="timeliness" itemcolumn="#DateFormat(ftnTrendRet.responseDate,'mm/dd/yyyy')#"></cfchartseries>
    <cfchartseries type="line" query="ftnTrendRet" valuecolumn="attitude" itemcolumn="#DateFormat(ftnTrendRet.responseDate,'mm/dd/yyyy')#"></cfchartseries>
    <cfchartseries type="line" query="ftnTrendRet" valuecolumn="Accessibility" itemcolumn="#DateFormat(ftnTrendRet.responseDate,'mm/dd/yyyy')#"></cfchartseries>
</cfchart>

Open in new window

cfchart-Line.doc
0
Comment
Question by:Ru1995
  • 3
  • 3
6 Comments
 
LVL 52

Expert Comment

by:_agx_
Comment Utility
I could be wrong. But you might be out of luck for MX7. It doesn't support the "isInterpolated" feature which controls that behavior.  For grins, does the same thing happen with a single series?

http://www.coldfusionjedi.com/index.cfm/2008/9/17/Ask-a-Jedi-Handling-nulls-in-a-chart
0
 

Author Comment

by:Ru1995
Comment Utility
does the same thing happen with a single series?

I'm not sure what you mean by that? If you're referring to if I have just 1 cfchartseries tag then yes the same thing happens

Is this what you were referring too?

<cfchart chartwidth="750" chartheight="250" yaxistitle="Score" xaxistitle="Weeks" showxgridlines="yes" title="Attitude" scaleto="6" >
    <cfchartseries type="line" query="ftnTrendRet" valuecolumn="attitude" itemcolumn="#DateFormat(ftnTrendRet.responseDate,'mm/dd/yyyy')#" seriescolor="##3333FF">
</cfchart>
0
 
LVL 52

Expert Comment

by:_agx_
Comment Utility
> If you're referring to if I have just 1 cfchartseries tag then yes the same thing happens

Yeah, that's what I meant.  If you were using CF8+, I'd suggest trying the "isInterpolated" option mentioned in the link. But unfortunately it doesn't look like mx7 supports it.  I can't think of a clean way around it in the older version. You'd have to fill in the missing data points which is silly.
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:Ru1995
Comment Utility
OK well is there a way for me to display the response dates on the x axis?
0
 
LVL 52

Accepted Solution

by:
_agx_ earned 500 total points
Comment Utility
> itemcolumn="#DateFormat(ftnTrendRet.responseDate,'mm/dd/yyyy')#">

Hmm.. I just noticed your itemcolumn looks wrong. The values are all the same and DateFormat() isn't doing what you think.  You'll have to format the dates in your sql.  "itemcolumn" should be the name of a column in your query.  

<!--- sample query  --->
<cfset ftnTrendRet = queryNew("")>
<cfset queryAddColumn(ftnTrendRet, "RESPONSEDATE ", listToArray("2011-08-01,2011-08-02,2011-08-03,2011-08-04"))>
<cfset queryAddColumn(ftnTrendRet, "accuracy", listToArray("4,5,0,1"))>
<cfset queryAddColumn(ftnTrendRet, "timeliness", listToArray("3,4,0,5"))>
<cfset queryAddColumn(ftnTrendRet, "attitude", listToArray("5,5,4,2"))>
<cfset queryAddColumn(ftnTrendRet, "Accessibility", listToArray("3,5,4,3"))>
<cfchart chartwidth="750" chartheight="400" yaxistitle="Score" xaxistitle="Weeks" showxgridlines="yes" scaleto="5" gridlines="6"  >
	<cfchartseries type="line" query="ftnTrendRet" valuecolumn="accuracy" itemcolumn="responseDate"></cfchartseries>
    <cfchartseries type="line" query="ftnTrendRet" valuecolumn="timeliness" itemcolumn="responseDate"></cfchartseries>
    <cfchartseries type="line" query="ftnTrendRet" valuecolumn="attitude" itemcolumn="responseDate"></cfchartseries>
    <cfchartseries type="line" query="ftnTrendRet" valuecolumn="Accessibility" itemcolumn="responseDate"></cfchartseries>
</cfchart>

Open in new window

0
 

Author Closing Comment

by:Ru1995
Comment Utility
Awesome it worked thank you
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

The technique is by far very Simple! How we can export the ColdFusion query results to DOC file?  Well before writing this I researched a lot in Internet but did not found a good Answer anyways!  So i thought now i should share my small snippet w…
Today, I was working on some optimization and spam-stopping techniques when I encountered Ben Nadel's post to reduce spam feature using Math (http://www.bennadel.com/blog/197-How-I-Stop-Spammers-On-My-ColdFusion-Blog.htm). While this method is not o…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now