Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I don't think you can without first outputting the queries to a structure and then sorting it and outputting the data from that with the cfchartdata tag inside each cfchartseries.</p> <p>Something like this, maybe. I did this locally and it worked, but then I tried to convert the code to work with your queries and column names, so it might not work off a straight copy and paste. (But it might!) It also assumes that the length of the two queries will always be the same. If that isn't true, you might need to code around that.</p> <pre><code>&lt;cfset data = {}&gt; &lt;cfloop from="1" to="#clusterPrivateReferrals.recordCount#" index="x"&gt; &lt;cfset structInsert(data, clusterPrivateReferrals["organisationName"][x], {})&gt; &lt;cfset data['#clusterPrivateReferrals["organisationName"][x]#'].private = clusterPrivateReferrals["msgCount"][x]&gt; &lt;cfset data['#clusterNHSReferrals["organisationName"][x]#'].nhs = clusterPrivateReferrals["msgCount"][x]&gt; &lt;cfset data['#clusterPrivateReferrals["organisationName"][x]#'].total = data['#clusterNHSReferrals["organisationName"][x]#'].private + data['#clusterNHSReferrals["organisationName"][x]#'].nhs&gt; &lt;/cfloop&gt; &lt;cfset sorted = structSort(data, "numeric", "desc", "total")&gt; &lt;cfchart format="flash" title="data" chartWidth="470" chartHeight="380" fontSize="12" seriesPlacement = "stacked" showLegend = "yes"&gt; &lt;cfchartseries type="bar" seriescolor="##FFD800" seriesLabel="Private"&gt; &lt;cfloop from="1" to="#arrayLen(datas)#" index="x"&gt; &lt;cfchartdata item="#sorted[x]#" value="#data['#sorted[x]#'].private#"&gt; &lt;/cfloop&gt; &lt;/cfchartseries&gt; &lt;cfchartseries type="bar" seriescolor="##F47D30" seriesLabel="NHS"&gt; &lt;cfloop from="1" to="#arrayLen(datas)#" index="x"&gt; &lt;cfchartdata item="#sorted[x]#" value="#data['#sorted[x]#'].nhs#"&gt; &lt;/cfloop&gt; &lt;/cfchartseries&gt; &lt;/cfchart&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload