House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home /  Groups /  ColdFusion Talk (CF-Talk)

cfchart and bar colors

  << Previous Post |  RSS |  Sort Oldest First |  Sort Latest First |  Subscribe to this Group Next >> 
Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Larry Lyons
03/11/2010 03:49 PM

Greeting, I have a cfchart where we display percent responses by department. While cfchartseries will set the colour for all the bars, the powers that be want the color to be different for each bar depending on the response percentage, as in:. 0 - 49 % red 50-74% orange 75%-89% green 90%+ blue The cfChartSeries attribute colorlist will allow a series of colors, but in this case the X axis is ordered by department name rather than by response percentage. So at this point I'm at a bit of a loss on how to do this, so any help would be very much appreciated. thx, larry

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Leigh
04/15/2010 10:53 PM

> The cfChartSeries attribute colorlist will allow a series > of colors, but in this case the X axis is ordered by > department name rather than by response percentage. Just sifting through a ton of old mailing list items .. I am sure you figured this out already. But for the archives, you could calculate the colorlist dynamically. A simple approach is using a CASE statement in your db query to determine the colors for each value. SELECT  Department, ResponseValue,        CASE        WHEN ResponseValue BETWEEN 0 AND 49 THEN 'Red' -- in hex ...        WHEN ResponseValue BETWEEN 50 AND 74 THEN 'Orange'        ... etc...        END AS BarColor ... or store the color range information in a db table and use a JOIN.

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Larry Lyons
04/16/2010 03:23 PM

Thanks ofr the suggestion. Ray Camden helped me on this one, and ended up blogging about it. Here's the link to Ray's blog post on it: http://www.coldfusionjedi.com/index.cfm/2010/3/12/Coloring-CFCHART-Dynamically ----- Excess quoted text cut - see Original Post for more -----        > CASE        > WHEN ResponseValue BETWEEN 0 AND 49 THEN 'Red' -- in hex ...        > WHEN ResponseValue BETWEEN 50 AND 74 THEN 'Orange'        ... > etc...        > END AS BarColor > ... > or store the color range information in a db table and use a JOIN. > > > >       

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Leigh
04/16/2010 07:03 PM

> Thanks ofr the suggestion. Ray Camden helped me on this > one, and ended up blogging about it. Here's the link to > Ray's blog post on it: You inspired a blog entry, cool! Yes, I can see he was thinking along similar lines. Except he used CF versus SQL + valueList(query.BarColor). Nice follow-up for the archives :) Cheers -Leigh

Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Larry Lyons
03/12/2010 11:23 AM

---  bump  ---


<< Previous Thread Today's Threads Next Thread >>

Search cf-talk

July 31, 2010

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
         1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31