A reader wrote in with an interesting problem. He needed to use CFCHART to plot data points that ranged in value from 0.9 to 1.0. He wanted to use the scaleFrom and scaleTo attributes to limit the chart to this range, but no matter what he did, the chart would range from 0 to 1.

Looking at the docs for cfchart, it does say that both scaleTo and scaleFrom are integers, so I guess it isn't too surprising that it would fail to recognize 0.9 and 1 as a scale. You can try to use 0.9 but it is simply ignored. Here is a chart showing how this data plots out.

Not very nice, is it? As always, I turned to the chart designer. I quickly found the scaling options and tried 0.9 and 1.0 there. I was surprised to see that it worked right away. While there, I tweaked the xAxis labels to be vertical and turned off the legend. Here is the XML I ended up with:

<?xml version="1.0" encoding="UTF-8"?> <frameChart is3D="false"> <yAxis scaleMin="0.9" scaleMax="1.0"> <labelFormat pattern="#,##0.###"/> <parseFormat pattern="#,##0.###"/> <groupStyle> <format pattern="#,##0.###"/> </groupStyle> </yAxis> <xAxis> <labelFormat pattern="#,##0.###"/> <parseFormat pattern="#,##0.###"/> <labelStyle orientation="Vertical"/> </xAxis> <legend allowSpan="true" equalCols="false" isVisible="false" halign="Right" isMultiline="true"> <decoration style="None"/> </legend> </frameChart>

The result?

Much better, right? Not quite sure why cfchart doesn't like the numeric scale values. The charting engine works wonderfully with it. Anyway, I've attached a test file you can download and run to see it yourself.

Download attached file.