cfchart multiple colorlist

I'm trying to create a bar chart with different colored bars for different values.  I have that working using a colorlist.  However, I have a second chartseries that creates a line on the same chart that I would like to be a different color and lie on top of the bar chart.  The first colorlist is applying itself to the second data series.  If I create a new colorlist for the second chartseries it changes the first chartseries. I have also tried using seriesColor but the color list overwrites it. Are ther any work arounds for what appears to be a bug?  I am running CF11.
muellertjAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

gdemariaCommented:
I think we need to see the code (or at least I do).  I haven't experienced this issue and it may be just how it's being done
0
muellertjAuthor Commented:
<cfset cList = "">
<cfloop query="thisChart">
<cfif #ht# GT #optmax#>
<cfset cList = listAppend(cList, "##FF0000")>
<cfelseif #ht# lte #optmax# and #ht# gte #optmin#>
<cfset cList = listAppend(cList, "##008000")>
<cfelse>
<cfset cList = listAppend(cList, "##FFFF00")>
</cfif>
</cfloop>


<cfchart chartheight="#ch#" chartwidth="#cw#" format="html" xaxistitle="Paddock" yaxistitle="#unit#" showlegend="no" seriesplacement="default" showmarkers="no">

<cfchartseries
      query="thisChart"
      type="bar"
      valuecolumn="ht"
      itemcolumn="paddock"
      colorlist="#clist#"
       datalabelstyle="value">
  </cfchartseries>

  <cfchartseries
       query="targetList"
        type="line"
       valuecolumn="tvalue"
      itemcolumn="paddock"
       seriesColor= "##000000">
 </cfchartseries>

 </cfchart>
0
gdemariaCommented:
According to CF documentation, colorList is not applicable to bar..

Sets colors for each data point.  Applies if the cfchartseriestype attribute is pie, pyramid, area, horizontalbar, cone, cylinder, or step.

I have always used seriesColor and specified it for each series...

 <cfset variables.colorList = " ....">   <!---- your color list --->
 <cfchart
	chartwidth="800"
    backgroundColor="white"
    showXGridlines="no"
    showYGridlines="yes"
    showborder="no"
	show3d="no"
	format="png"
	showLegend="no"
	title=""> 

   <cfoutput query="myQuery" group="productCategory">
	
	  <cfset variables.thisColor = listFirst(variables.colorList)>  <!--- get color for this series ---->
	  <cfset variables.colorList = listRest(variables.colorList)>   <!--- remove color from the list --->
	  <cfchartseries 
		    type="line" 
		    seriesColor="#variables.thisColor#" 
		    paintStyle="plain"
		    seriesLabel="#myQuery.productName#">

	       <cfoutput>
		        <cfchartdata item="#theYear#" value="#numberFormat(myQuery.productValue,'99.99')#">
           </cfoutput> <!--- end loop each year ---->
	   </cfchartseries>
   </cfoutput>

 </cfchart>  
 

Open in new window

0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

muellertjAuthor Commented:
The problem I have is that I want different colors for different values in the series.  In CF9 I had each color in a different series and when I stacked them they would show left to right, red then green then yellow with a blue line running across them all.  In CF11 when I stack them they go on top of the first series.  If I don't stack them then each additional series goes in next to the corresponding item from the first series even thought the x-axis variable is different.  So it might go red, green, yellow, red, green, yellow etc. when I want it to go red, red, green, green, yellow, yellow.  Any suggestions?
0
gdemariaCommented:
Not entirely sure what you are saying by stacking, etc.  But if you want to assign a specific color to a specific line/bar, the method I showed is good for that with a couple small changes.   Instead of just popping the next color off the list, you would assign the color based on whatever criteria using CFIF statement or switch statement or a structure.   Given that you are looping your series instead of allowing the cfseries tag to do it for you, you can also change your order; if that would help.
0
muellertjAuthor Commented:
I found this code which seems to be doing what I need.
<cfset plot = {
      "rules": [
      {"rule":"'%v'>#optmax#",
                  "background-color":"red"},
      {"rule":"'%v'<=#optmax#",
                  "background-color":"green"},
      {"rule":"'%v'< #optmin#",
                  "background-color":"yellow"}      
      ]}>
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Gurpreet Singh RandhawaWeb DeveloperCommented:
are you open to some different cfchart options or want to use the inbuild cfchart of coldfusion,

I found chartDirector very good custom based tag which actually runs on top of java and create very nice cfchart tags, there you can find the color combinations to add multiple lines of multiple colors i all the samples they have,

You can use the unregistered version which is good as it shows a label at the bottom as unregistered for any commercial site, license is just 99 usd

so try it, if that solves our issue

cheers
0
muellertjAuthor Commented:
I may have to look into chart director, but I have learned enough json code that I have my charts formated as I would like..
0
muellertjAuthor Commented:
I found my own solution.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ColdFusion Language

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.