Solved

connecting graph points using lines on cfchart

Posted on 2011-09-28
6
451 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_
ID: 36718498
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
ID: 36718559
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_
ID: 36718657
> 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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 

Author Comment

by:Ru1995
ID: 36718719
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
ID: 36719057
> 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
ID: 36719322
Awesome it worked thank you
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

PROBLEM: How to add your own buttons to the bottom toolbar with paging info ( result count ). While creating a cfgrid, I ran into an issue where I wanted to embed my own custom buttons where the default ones ( insert / delete / etc… ) are for aes…
Hi, Even though I have created this Tutorial on My personal Blog, Some people might not able to find my website, So here i am posting it again Today, from the topic it is very clear that i will be showing you here the very basic usage of how we …
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

770 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