Solved

connecting graph points using lines on cfchart

Posted on 2011-09-28
6
455 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
Raise the IQ of Your IT Alerts

From IT major incidents to manufacturing line slowdowns, every business process generates insights that need to reach the people required to take action. You need a platform that integrates with your business tools to create fully enabled DevOps toolchains.

You need xMatters.

 

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

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

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…
Recently while working on a project I got a very annoying cfdocument has no body error message. I had never seen this error before. So I checked the code. The code was pretty simple; it was Just showing me the cfdocumnt tag and inside that tag a …
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

695 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