Solved

connecting graph points using lines on cfchart

Posted on 2011-09-28
6
454 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
Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

 

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] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

Suggested Solutions

PROBLEM:  How to open a cfwindow or run a function on double click of a cfgrid row. One of my clients wanted to be able to double click on a row item to get more detailed information about a transaction and to be able to modify the line items i…
This is an updated version of a post made on my blog over 3 years ago. It is unfortunately, still very relevant as we continue to see both SQLi (SQL injection) and XSS (cross site scripting) attacks hitting some of the most recognizable website and …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

738 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