1

I would like to show hours in the Y-axis of a CFChart. Presently it is showing numeric values. I want the Y-axis to display 6am, 9am, 12noon, 3pm etc.. Any help would be highly appreciated.

Thanks in Advance.

Leigh
  • 28,765
  • 10
  • 55
  • 103
pawangera
  • 61
  • 1
  • 4

2 Answers2

0

Look at this link

You have to pattern your y-axis. You need to create a style of the chart and assign pattern to your yaxis.

<CFCHART style="MyFirstDate.xml" .....>
    <CFCHARTSERIES type="line" 
              query=qGetValsByDate 
              itemColumn="xxxx" 
              valueColumn="thedate" 
              dataLabelStyle="none"/>
</CFCHART>

Paste the following into a file and save it as "MyFirstDate.xml".

<?xml version="1.0" encoding="UTF-8"?>
<frameChart is3D="false">    
 <yAxis type="DateTime" isBucketed="true">
  <labelFormat style="DateTimePattern" pattern="h:mm tt"/>
  <parseFormat style="DateTimePattern" pattern="h:mm tt"/>
  <dateTimeStyle majorUnit="Hour" minorUnit="Hour" minorStep="2"/>
  <labelStyle isMultiline="false" isHideOverlapped="true" orientation="Vertical"/>
 </yAxis>    
</frameChart>

I haven't tested the code but I did similar to it so it will work. Hope this will help.

Leigh
  • 28,765
  • 10
  • 55
  • 103
Sweety
  • 159
  • 3
0

The CFChart included in ColdFusion 10 is Zingchart version 120315. More recent versions of ZingChart have this json parameter

"scale-y": {
    "format": "javascript:formatScaleY"
}

then write a function like

formatScaleY(v) {
    return v+"am";
}

You can download a more recent zingchart library from their website and overwrite cfchart-min.js, but i'm not sure whether that is allowed by the CF/ZC license.

andrew lorien
  • 146
  • 1
  • 7