我的页面上有以下代码。
样式变量保存自定义样式。
<cfchart chartheight="450" chartwidth="550" gridlines="9" yaxistitle="Score" scalefrom="20" scaleto="100" style="#style#" format="png" >
<cfchartseries query="variables.chart_query" type="scatter" seriescolor="##000000" itemcolumn="MyItem" valuecolumn="MyScore"/>
</cfchart>在我开始之前,请看good.jpg。这就是我想要我的报告出来的方式。在x轴上,只要其中至少有一个有值,就总是有三个项。如果一个项目没有任何值(即2010年),图表中就不会有标记。
只有当只有一个项具有值时,才会出现此问题。请看bad.jpg。如您所见,2008年和2010年没有任何值;y轴现在从0缩放到100。我试过设置其中一个项目(例如。(2008年)0或图表上的值;它将根据这个表外的值和2009年的值进行缩放。简而言之,我必须至少有两个项目,其数值介于20到100之间,这样cfchart才能从20扩展到100。
我的问题是,我怎样才能纠正这个问题,使can总是从20到100?我正在运行CF9。
发布于 2011-11-22 16:34:23
你的风格变量里面是什么?
我建议不要在can标签中使用scaleFrom=“和scaleTo=”,因为它们有时可能是错误的。我相信Cold聚变的chart标签试图将图表自动缩放到它认为最合适的。相反,我会在frameChart标记中构建图表的最小和最大比例尺。
构建图表的样式变量示例
<cfsavecontent variable="style">
<?xml version="1.0" encoding="UTF-8"?>
<frameChart is3D="false" font="Arial-11-bold">
<frame xDepth="0" yDepth="0" outline="black" lightColor="#CCCCCC" darkColor="#CCCCCC"
wallColor="#CCCCCC" frameSize="5" dashSize="3" gridColor="#333333">
<background type="HorizontalGradient" maxColor="#828EB0"/>
</frame>
<!--- THE BREAD AND BUTTER
NOTE: if you use variables for the scaleMin and scaleMax
make sure to surround them with a cfoutput tag
--->
<yAxis scaleMin="20" scaleMax="100">
<!--- --------------------- --->
<labelFormat style="Currency" pattern="#,##0"/>
<parseFormat pattern="#,##0"/>
<titleStyle></titleStyle>
</yAxis>
<legend allowSpan="true" isVisible="false" placement="Bottom" valign="Bottom" foreground="black"
isMultiline="true">
<decoration style="None"/>
</legend>
<elements outline="black" shapeSize="40"/>
<popup background="#748BA6" foreground="white"/>
<paint palette="Modern" paint="Plain" isVertical="true"/>
<insets right="5"/>
</frameChart>
</cfsavecontent>然后,您所要做的就是像前面提到的那样,将变量加载到样式属性中。
<cfchart format="png" chartWidth="550" chartHeight="175" style="#style#">还有一个很好的资源可供使用,那就是你的C:/coldfusion/charting/目录中的will图表程序。只需打开webcharts.bat,,创建您的自定义图表,将xml代码复制到您的样式变量中,然后瞧!
如果您决定走这条路线,请确保从cfchart标记中删除scaleTo=和scaleFrom=。
https://stackoverflow.com/questions/2740863
复制相似问题