سؤال

Please consider the following code:

Parameters I have used :

<cfparam name="Form.startdate" default="#dateformat(now()-5, 'mm/dd/yyyy')#">
<cfparam name="Form.enddate" default="#dateformat(now()-1, 'mm/dd/yyyy')#">
<cfparam name="Form.selectdate" default="#dateformat(now(), 'mm/dd/yyyy')#">

The cfquery I'm using is as follows:

Information: MyDatabase = Name of the Database

Events = Column name with several different events(First,Second,Third etc).In this case I have just included FIRST.

Timestamp = Name of the column which contains date and time.

<cfquery datasource = "XX.XX.X.XX" name="qQuery">


SELECT Timestamp , Count(*) as COUNT
FROM MyDatabase WHERE Events = "FIRST"
AND Timestamp >= <cfqueryparam value="#form.startdate#" cfsqltype="cf_sql_date"> 
AND Timestamp <=  <cfqueryparam value="#dateAdd('d', 1, form.enddate)#" cfsqltype="cf_sql_date"> GROUP BY Timestamp;
</cfquery>

The above query is just displaying one dot in the line chart which is obvious because I have used there count clause with condition for Events = FIRST.

The way I'm displaying is as follows (Please consider the following code):

<cfform format="flash" preloader ="false">

<cfformgroup type="horizontal">
  <cfinput type="dateField" name="startdate" label="Start Date" width="100" value="#form.startdate#">
  <cfinput type="dateField" name="enddate" label="End Date" width="100" value="#Form.enddate#">
  <cfinput name="submitApply" type="submit" value = "Apply">
  <cfinput name="cancel" type="submit" value="Download CSV">

</cfformgroup>

<cfformitem type = "hrule" style="" ></cfformitem>
</cfform>

<cfchart format="flash" chartwidth="500" chartheight="500" scalefrom="0" scaleto="2500" showxgridlines="no"  >


        <cfchartseries type="line" itemColumn="Timestamp" valueColumn="COUNT"  query="qQuery">

        </cfchartseries>
</cfchart> 

Problem I'm getting facing:

Nothing is displayed on the web browser except cfform fields. :(

When I right click on it, it says Movie not loaded.

Please let me know if there are some questions I can answer.

هل كانت مفيدة؟

المحلول

Error Occurred While Processing Request For input string: "2013-07-11".

<cfchartseries itemColumn="COUNT" valueColumn="Timestamp" ...>

The Y-Axis value should be numeric. The string "2013-07-11" is obviously not numeric, hence the error. Looks like you accidentally swapped itemColumn and valueColumn.

Update:

The chart code posted works fine with date strings and numeric counts (once you swap item/value).

<cfset qQuery = queryNew("")>
<cfset queryAddColumn(qQuery, "TimeStamp", "date", listToArray("2013-07-30,2013-08-01,2013-08-02"))>
<cfset queryAddColumn(qQuery, "Count", "integer", listToArray("10,8,6"))>

<cfchart format="flash" chartwidth="500" chartheight="500" showxgridlines="no">
    <cfchartseries type="line" 
        itemColumn="Timestamp" 
        valueColumn="Count"  
        query="qQuery" />
</cfchart> 

So if it is not working for you, you are doing something different in the code than what you have shown us. Please update your question with a small, self-contained, example that demonstrates the problem. Also "not working" is very vague description. You need to tell what IS happening and how it differs from what you expected. ie Actual versus expected results.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top