Coldfusion CFCHART-如何使Y轴从1开始而不是从0开始
以下是我正在使用的示例样式:Coldfusion CFCHART-如何使Y轴从1开始而不是从0开始,coldfusion,cfchart,Coldfusion,Cfchart,以下是我正在使用的示例样式: <?xml version="1.0" encoding="UTF-8"?> <frameChart is3D="false"> <frame xDepth="3" yDepth="1" leftAxisPlacement="Back" isHStripVisible="true"> <background minColor="#FDFEF6"/> </frame&g
<?xml version="1.0" encoding="UTF-8"?>
<frameChart is3D="false">
<frame xDepth="3" yDepth="1" leftAxisPlacement="Back" isHStripVisible="true">
<background minColor="#FDFEF6"/>
</frame>
<yAxis scaleMin="1" scaleMax="500">
<labelFormat pattern="#,##0.###"/>
<parseFormat pattern="#,##0.###"/>
</yAxis>
<legend>
<decoration style="None"/>
</legend>
<elements place="Default" shape="Line" drawShadow="true">
<morph morph="Grow"/>
</elements>
</frameChart>
上面的代码将显示0而不是1
这似乎是使用cfchart时的常见问题,但在web图表程序中也是一个问题
有人有好的解决方案吗?简短回答:这是可能的,但在您的具体情况下会有一些副作用 更长的回答: 通过指定
标签的数量(即网格线),可以强制y轴从1开始。但只要范围是奇数(ie500-1==>499
),一些y轴值可能不会均匀排列
<!--- labelCount is number of grid lines + 1 --->
<yAxis scaleMin="1" scaleMax="500" labelCount="6">
<labelFormat style="Integer" pattern="#,##0"/>
</yAxis>
对所有y轴值进行完全控制的唯一方法是确保范围/网格线计算为整数
Actual => Rounded Value
500.0 => 500
400.2 => 400
300.4 => 300
200.6 => 201 **
100.8 => 101 **
1.0 => 1