5 Replies Latest reply on May 30, 2006 8:53 AM by Fernis

    CFCHART and currentRow

    GuyPhempoompanitch Level 1
      I am referencing a query for CFCHART. On the URL parameter, I need to pass the currentRow within the URL for that series. Here's an example:

      <cfchart title="MyTitle" chartwidth="#graphWidth#" url="xyz.cfm?action=drillDownDeeper&label=#myQuery.CurrentRow#" pieslicestyle="sliced" showborder="Yes" show3d="Yes">

      I can get it to display a row by referencing myQuery.columnName[1], but its the same for all. I need this to increment for every row in the query result.

      Anyone have an idea on how to do this? thanks.

        • 1. Re: CFCHART and currentRow
          Fernis Level 3
          There are a couple of dynamic variables, which you can put in the URL.
          $ITEMLABEL$ - the label of the item
          $VALUE$ - the value of the item.

          You could use this:
          <cfchart title="MyTitle" chartwidth="#graphWidth#" url="xyz.cfm?action=drillDownDeeper&label=$ITEMLABEL$" pieslicestyle="sliced" showborder="Yes" show3d="Yes">

          Above, we expect of course that your itemlabels are unique - and judging from your chart style, they are. Just modify your xyz.cfm to deal with the item labels instead of the row numbers. Hope this helped.
          • 2. Re: CFCHART and currentRow
            GuyPhempoompanitch Level 1
            Thank you, but I have to have the CurrentRow variable.
            • 3. Re: CFCHART and currentRow
              Fernis Level 3
              In that case, I have an interesting idea, which just might work ... at least if I add "Well, this might be a longshot, but..." (which always makes all crazy ideas work in tv series)...

              Create a javascript array (or two arrays), containing your currentrows and the item labels in two "columns".

              Then, have a chart like:
              <cfchart title="MyTitle" chartwidth="#graphWidth#" url="javascript:myWickedFunction('$ITEMLABEL$')" pieslicestyle="sliced" showborder="Yes" show3d="Yes">

              Third, have your myWickedFunction() search for the item label, returning the rownumber, and automatically redirecting the current window (or the desired frame) where you want.
              • 4. Re: CFCHART and currentRow
                GuyPhempoompanitch Level 1
                That is a good idea, although I cannot guarantee that the data for ItemLabel is unique. The data as a whole is a mess, so we're forced to pass a unique row number.

                I can access the java class that drives the CFCHART tag, but I cannot locate a method or command that would give me the current row number. I'm stumped.

                • 5. Re: CFCHART and currentRow
                  Fernis Level 3
                  Maybe combining both $ITEMLABEL$ and $VALUE$ in the javascript checking would ensure an acceptable rate of success, when using approach I last suggested. As a bonus, your javascript routine could check for duplicate value-itemlabel key pairs, and warn with an alert, if there the details cannot be drilled down safely.

                  There's still another approach I just came up with... if you could present a number before your item labels in the chart, then you could extract that rownumber from the label with javascript. Of course it would be irritating if the number didn't mean anything for the viewer, but what if you returned the query in the right order so that the numbers would indicate the order - the largest/lowest value first, etc...? You could use CF's queryAddColumn and querySetCell to modify your item labels...

                  Getting weird already? ;-)