3 Replies Latest reply on Mar 13, 2014 2:16 PM by BKBK

    CFcart and CFchartseries

    Matthew C. Parks Level 1

      I have a char that has Students Class Scores in each class.  So in this example, we have 50 kids in each class.  I want to create this Chart and show each student the report for them.


      Meaning using this same Chart for each student, but Place an Arrow Above each series that the Students Score is within.  So it will look like 6 classes with Honors, Pass Fail Bar chart side by side for each class but is Joe is a Pass then place an arrow each bar the Joe's grade fell into.



      <cfchart format="html" showLegend="false" chartwidth="800" chartheight="300">



                <cfchartseries type="bar" seriesColor="red" query="honor" valueColumn="count" itemColumn="class" serieslabel="Honors">




                <cfchartseries type="bar" query="pass" valueColumn="count" itemColumn="class" serieslabel="Pass">




                <cfchartseries type="bar" query="failed" valueColumn="count" itemColumn="class" serieslabel="Fail">







      Nothing to crazy, but just one arrow above each Bar data?


      Does anyone have any suggestions?


      Using CF10, Windows and UNIX os



      Matthew C. Parks

        • 1. Re: CFcart and CFchartseries
          BKBK Adobe Community Professional & MVP

          The reasoning is unclear to me. The bars, namely, honors, pass, fail, etc., are for the whole class, so what do these bars mean? In other words, what does the vertical axis - the height of each bar - measure?

          • 2. Re: CFcart and CFchartseries
            Matthew C. Parks Level 1

            The bars are for the Whole Class and the Arrows will represent where a student falls in relation to his/her peer.


            The Bars are the Number of Peers got said Grade in Class.  The Height of the bar then is how many students got Honors grade and so on.  I hope that helps explain the business problem.


            I was able to solve this issue with ZingChart library.  There is an Arrow attribute that you can include within the graph.


            So in CFCHART, <cfchart format="html" style="label.txt"...>  one would have the label.txt have soemthing like this:


            ....(other stuff might be in here) .....




                                                    "hook":"node:plot=1, index=0",







            ....(other stuff might be in here) .....


            ....(other stuff might be in here) .....


            ZingChart has a nice docuementation on how to go about this. (http://www.zingchart.com/docs/features/arrows/)


            But this from offsets the start point of the arrow above the top of the plot we want it to point too.  I hope that make since.


            Thanks for responding to my post.  I did find quite a few other "CF Experts" Blogs on similar topic, but not my exact problem, but they helped to get me going in the right direction.

            • 3. Re: CFcart and CFchartseries
              BKBK Adobe Community Professional & MVP

              Matthew C. Parks wrote:


              The bars are for the Whole Class and the Arrows will represent where a student falls in relation to his/her peer.

              You've already solved the problem, so this is just an extra idea. You could use one or more cfchartseries to display bars corresponding to the whole class, and then a separate cfchartseries to display the result of the individual student.


              To illustrate, I have borrowed the following code from the Adobe documentation on cfchart. It uses the in-built cfdocexamples datasource which ships with ColdFusion. Hence you can run it directly.


              It displays the average salaries of various departments of a company as a bar chart. In the same chart, the salary of Employee 19 is displayed.


              <!---The following example analyzes the salary data in the cfdocexamples database and

                  generates a bar chart showing average salary by department. The body of the

                  cfchartseries tag includes one cfchartdata tag to include data that is not available

                  from the query. --->


              <!--- Get the raw data from the database. --->

              <cfquery name="GetSalaries" datasource="cfdocexamples">

                  SELECT Departmt.Dept_Name,



                  FROM Departmt, Employee

                  WHERE Departmt.Dept_ID = Employee.Dept_ID


              <cfquery name="getEmployeeSal" datasource="cfdocexamples">

                  SELECT salary

                  FROM  Employee

                  WHERE emp_id=19



              <!--- Use a query of queries to generate a new query with --->

              <!--- statistical data for each department. --->

              <!--- AVG and SUM calculate statistics. --->

              <!--- GROUP BY generates results for each department. --->


              <cfquery dbtype = "query" name = "DataTable">

                  SELECT Dept_Name,

                  AVG(Salary) AS avgSal,

                  SUM(Salary) AS sumSal

                  FROM GetSalaries

                  GROUP BY Dept_Name




              <h1>Employee Salary Analysis</h1>

              <!--- Bar graph, from Query of Queries --->

              <cfchart format="flash"


                  yaxistitle="Salary Average">


              <cfchartseries type="bar"



                  valuecolumn="avgSal" />


              <cfchartseries type="line" serieslabel="Employee 19" ><cfchartdata value="#getEmployeeSal.salary#"></cfchartseries>