cfchart 忽略我的scalefrom 值
我的页面中有以下代码。
style 变量保存自定义样式。
<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>
在开始之前,请参阅 chart_good.jpg。这就是我希望我的报告出现的方式。在 x 轴上,始终存在 3 个项目,只要其中至少一项具有值即可。如果某个项目没有任何值(即 2010 年),则图表中不会有标记。
仅当只有一件物品有价值时才会出现问题。请参阅 chart_bad.jpg。如您所见,2008 年和 2010 年没有任何值; y 轴现在从 0 缩放到 100。我尝试将其中一项(例如 2008)设置为 0 或图表之外的值;它将根据这个图表外值和 2009 年的值进行缩放。简而言之,我必须至少有两个值在 20 到 100 之间的项目,以便 cfchart 从 20 扩展到 100。
我的问题是,如何纠正这个问题,以便 cfchart 始终从 20 扩展到 100?我正在运行CF9。
I have the following codes in my page.
The style variable holds the custom style.
<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>
Before I begin, please see chart_good.jpg. This is how I want my report to come up. On the x-axis, there will always be three items as long as at least one of them has values. If an item does not have any values (i.e. 2010), there would not be a marker in the chart.
The problem occurs only when only one item has value. Please see chart_bad.jpg. As you can see, 2008 and 2010 do not have any values; y-axis is now scaled from 0 to 100. I have tried setting one of the items (ex. 2008) a value of 0 or something off the chart; it would scale according to this off-the-chart value and the 2009 value. In short, I have to have at least two items with values between 20 and 100 in order for cfchart to scale from 20 to 100.
My question is, how can I correct the issue so that cfchart would ALWAYS scale from 20 to 100? I am running CF9.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你的样式变量里面有什么?
我建议不要在 cfchart 标签中使用scaleFrom =“”和scaleTo =“”,因为它们有时可能会出现错误。我相信 Coldfusion 的 cfchart 标签会尝试自动将图表缩放到它认为最合适的位置。相反,我会在frameChart 标签内构建图表的最小和最大比例。
用于构建图表的样式变量示例
然后您所要做的就是将变量加载到样式属性中,就像您已经提到的那样。
Webcharts 程序也是一个很好的资源,位于 C:/coldfusion/charting/ 目录中。只需打开 webcharts.bat,创建自定义图表,将 xml 代码复制到样式变量中,然后瞧!
如果您决定采用此方法,请务必从 cfchart 标记中删除 scaleTo= 和 scaleFrom=。
What is inside your style variable?
I would suggest not using scaleFrom="" and scaleTo="" in the cfchart tag as they can be buggy sometimes. I believe that Coldfusion's cfchart tag attempts to scale the chart automatically to what it deems the best fit. Instead I would build the chart's minimum and maximum scales inside a frameChart tag.
Example of a style variable to build a chart
Then all you have to do is load the variable into the style attribute like you already mentioned.
Also a great resource to use, is the Webcharts program that will be in your C:/coldfusion/charting/ directory. Just open webcharts.bat, create your custom chart, copy the xml code into your style variable, and voila!
Make sure to remove the scaleTo= and scaleFrom= from your cfchart tag if you decide to go this route.