Skip to main content
Inspiring
May 25, 2006
Answered

cfchartseries seriescolor specifications

  • May 25, 2006
  • 1 reply
  • 268 views
I am trying to color bars different colors based on their value but it appears as though I can't use a cfif statement in the cfchartseries tag. Does anyone haave any ideas on how I can work around this to color the bars different colors?

I get this error: Invalid token 'c' found on line....

This is what I tried and failed with:
<cfchartseries query="chartdata" type="bar" valuecolumn="drymatter" itemcolumn="paddock"
<cfif chartdata.drymatter GTE 2750>seriescolor="red"
<cfelseif chartdata.drymatter LTE 1100>seriescolor="yellow"
<cfelse>seriescolor="green"
</cfif>>
</cfchartseries>
This topic has been closed for replies.
Correct answer Tonyam
I found a way around this.
I ended up creating three queries one for >2750, one for <1100, and one for <=2750 and >=1100.
Then I created three chartseries for each query and colored them accordingly.
I have included the cfchart code below.

<cfchart style="chart.xml" chartheight="350" chartwidth="600">
<cfchartseries
query="chartdata2750"
type="bar"
valuecolumn="drymatter"
itemcolumn="paddock"
seriescolor="red">
</cfchartseries>
<cfchartseries
query="chartdata"
type="bar"
valuecolumn="drymatter"
itemcolumn="paddock"
seriescolor="green">
</cfchartseries>
<cfchartseries
query="chartdata1100"
type="bar"
valuecolumn="drymatter"
itemcolumn="paddock"
seriescolor="yellow">
</cfchartseries>
</cfchart>

1 reply

TonyamAuthorCorrect answer
Inspiring
May 25, 2006
I found a way around this.
I ended up creating three queries one for >2750, one for <1100, and one for <=2750 and >=1100.
Then I created three chartseries for each query and colored them accordingly.
I have included the cfchart code below.

<cfchart style="chart.xml" chartheight="350" chartwidth="600">
<cfchartseries
query="chartdata2750"
type="bar"
valuecolumn="drymatter"
itemcolumn="paddock"
seriescolor="red">
</cfchartseries>
<cfchartseries
query="chartdata"
type="bar"
valuecolumn="drymatter"
itemcolumn="paddock"
seriescolor="green">
</cfchartseries>
<cfchartseries
query="chartdata1100"
type="bar"
valuecolumn="drymatter"
itemcolumn="paddock"
seriescolor="yellow">
</cfchartseries>
</cfchart>