[Webinar] Streamline your web hosting managementRegister Today

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 395
  • Last Modified:

having a different color for each bar in a cfchart

We are in the process of upgrading to MX from 4.5.  In 4.5 our bar graphs consisted of different colors for each bar on each graph. How can I make this happen in MX using cfchart and cfchartseries?
  • 2
  • 2
1 Solution
By default it will do so.

<cfchartseries type="bar" paintstyle="shade" serieslabel="#MyDate#">

If you want to specify WHICH colors are used for each series then use:


such as:

<cfchartseries type="bar" paintstyle="shade" serieslabel="#MyDate#" seriescolor="003399">

parikaaAuthor Commented:
thanks for your reply....and now using the example above where every bar in the series would be #003399 lets change that only the first bar of the series is that color, and the rest ummmmmm #993300. how can I make this possible?
I am not sure exactly what you are asking, but here is an example of a chart I did where I rotated through a set of defined colors:

<cfset Colors = "003399,9966CC,009999,CC00CC,FF6633,33CC33,FFCC66">
<cfset colorindex = 1>
      yaxistitle="Order Count"
      <cfoutput query="MyQuery" group="PickupDate">
            <cfchartseries type="bar" paintstyle="shade" serieslabel="#PickupDate#" seriescolor="#ListGetAt(Colors, colorindex)#">
                        <cfchartdata item="#PickupTime#" value="#Quantity#">
            <cfset colorindex = colorindex + 1>
parikaaAuthor Commented:
I thought that this was the solution until I acutally tried it. This is close to what I need, but not exactly.
An example of a graph that I want is the following:
The count of hits on a homepage by month.
I want the graph to display the # of hits and months.
It should be a bar graph.
****The most important part is that all the bars should be different colors.****

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now