Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

connecting graph points using lines on cfchart

Posted on 2011-09-28
6
Medium Priority
?
462 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

 

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 2000 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Hi. There are several upload tutorials using jquery and coldfusion. I found a very interesting one here Upload Your Files using Jquery & ColdFusion and Preview them (http://www.randhawaworld.com/) . I did keep the main js functions but made sever…
Sometimes databases have MILLIONS of records and we need a way to quickly query that table to return the results me need. Sure you could use CFQUERY but it takes too long when there are millions of records. That is why SOLR was invented. Please …
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

604 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