I want to fo开发者_开发百科rmat the date on the x-axis of my cfchart as mm/yyyy as opposed to the full datetime value that is returned from sql server (yyyy-mm-dd hh:mm:ss).
How do I do this?
I haven't dealt with this in a while, but I recall post-processing the date fields in a special "clean things up for cfchart" loop. So, given query q
and datefield thedate
one approach would be to loop through the query, replacing your date values with sanitized date values. Something like:
<cfloop from="1" to="#q.recordcount#" index="i">
<cfset q.thedate[i] = dateformat(q.thedate[i],'mm/yyyy')>
</cfloop>
Depending on what your data look like, you may want to do further tweaks, like re-sorting the recordset with query-of-queries, etc.
精彩评论