2 Replies Latest reply on Oct 11, 2007 12:57 PM by cf_dev2

    cfchart, cfchartseries, cfchartdata - HELP

    creelove
      I have a feedback table in my database - the fields are: availability, revelancy, timeliness, etc. What I want to do is a bar chart to show the average (user can choose 1-5, 0=N/A) of each of these fields. The beginning of the code is below ...I'm getting all of my data on the page, I just can't get it to display on the chart.

      <cfquery name="qry_data" datasource="mydata">
      select AVG(availability) AS avgAVAIL,
      AVG(revelancy) AS avgREV,
      AVG(timeliness) AS avgTIM
      FROM feedback
      WHERE availability <>0 AND timeliness<>0 AND feedback<>0 <!--this is so that the N/A ones aren't counted in the average-->
      </cfquery>

      <cfchart
      chartWidth = "400"
      chartHeight = "400"
      yaxistitle="Feedback Average"
      xaxistitle="Category">

      Now, this is where it gets screwy...I was thinking that I could do a cfloop list of the field names to get them listed - rather than getting the field names from the db
      <cfset category="availability, revelancy, timeliness">
      <cfloop index="i" list="#category#>

      <cfchartseries type="bar"
      valuecolumn="" <!-- What goes here???-->
      itemcolumn=""> <!-- What goes here???-->

      <cfloop query="qry_data">
      <cfchartdata item=#i# value=""> <!-- What goes here??? I want the item and the value to match, but the value actually changes everytime, ie avgAVAIL, avgTIM-->
      </cfloop>
      </cfloop>
      </cfchart>

      What I want to happen is that is loops through, gets the category "availability" which is displayed on the x-axis and have the average of availablity in bar format on the y-axis (1-5)....then moves on to the next category.

      Let me thank you now for ANY help that you can provide.