cfchart 忽略我的scalefrom 值

发布于 2024-08-31 07:05:57 字数 935 浏览 1 评论 0原文

我的页面中有以下代码。

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

如日中天 2024-09-07 07:05:57

你的样式变量里面有什么?

我建议不要在 cfchart 标签中使用scaleFrom =“”和scaleTo =“”,因为它们有时可能会出现错误。我相信 Coldfusion 的 cfchart 标签会尝试自动将图表缩放到它认为最合适的位置。相反,我会在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#">

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

<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>

Then all you have to do is load the variable into the style attribute like you already mentioned.

<cfchart format="png" chartWidth="550" chartHeight="175" style="#style#">

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文