首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >CFChart所有的X轴标签都没有显示

CFChart所有的X轴标签都没有显示
EN

Stack Overflow用户
提问于 2014-09-11 11:51:53
回答 1查看 1.8K关注 0票数 0

我的申请中有很多挂图。在我的一张挂图中有32个X轴标签,但只有18个在显示。除此之外,图表显示正常,但x轴标签缺失.

我使用JSON样式将样式应用于图表,ScaleXScaleX属性设置为false

如何在不跳过任何标签的情况下以X轴显示所有标签?

编辑

代码语言:javascript
复制
 <cfchart  
        format="jpg"
        chartheight="320"  
        chartwidth="690"  showborder="yes" 
        title="Trend In Subject Rents"  style="20currency.js"  name="Qtr1">
        <cfchartseries type="line" 
            serieslabel="Gross"
            seriescolor="navy"  markerStyle="diamond" paintStyle="plain" >
            <cfloop query="qry_subproperty">
                <cfset variables.Yearquarter=ObjPropDetails.JoinYearQuarter(qry_subproperty.Yearquarter)>
                <cfchartdata item="#variables.Yearquarter#" value="#round(qry_subproperty.Gross)#" >
            </cfloop>
        </cfchartseries>
        <cfchartseries type="line" 
            serieslabel="Net"
            seriescolor="red"  markerstyle="rectangle">
            <cfloop query="qry_subproperty">
                <cfset variables.Yearquarter=ObjPropDetails.JoinYearQuarter(qry_subproperty.Yearquarter)>
                <cfchartdata item="#variables.Yearquarter#" value="#round(qry_subproperty.Net)#" >
            </cfloop>
        </cfchartseries>
        <cfchartseries type="line" 
            serieslabel="Economic"
            seriescolor="green" markerstyle="triangle">
            <cfloop query="qry_subproperty">
                <cfset variables.Yearquarter=ObjPropDetails.JoinYearQuarter(qry_subproperty.Yearquarter)>
                <cfchartdata item="#variables.Yearquarter#" value="#round(qry_subproperty.Economic)#" >
            </cfloop>
        </cfchartseries>
     </cfchart>

编辑JS风格

代码语言:javascript
复制
{
"graphset":[
    { 

       "legend":{
        "layout":"x4",
            "border-color":"#CCCCCC",
            "background-color":"#FFFFFF",
           "position":"50% 100%",
             "margin-bottom":5,
             "width":"250",

            "shadow":false,
            "adjust-layout":true,
            "item":{
                "font-family":"Arial",
                "font-size":"12px",
                "font-color":"#777878"
            }


        },

        "background-color":"#ffffff",
        "type":"mixed",
        "scale-x":{
        "items-overlap":false,
         "item":{ 

         "font-angle":90,
         "guide":{
        "visible":false
    }


    }

        },

        "scale-y":{

             "format":"$%v",
             "negation":"currency",
            "guide":{
        "visible":false
    }



        },
         "title":{

            "font-color":"#000000",
            "background-color":"#ffffff",
            "background-color-2":"#000000"
            },

     "plot":{

            "line-width" : "1px"
        },
        "series":[
           {
               "tooltip":{
      "background-color":"navy",
      "padding":"5 10",
      "border-color":"#009",
      "border-width":2,
      "border-radius":5,
      "alpha":0.75,
      "text":"The Gross Rent in this Qtr is %v ."
    }  



            },
            {
             "tooltip":{
      "background-color":"red",
      "padding":"5 10",
      "border-color":"#009",
      "border-width":2,
      "border-radius":5,
      "alpha":0.75,
      "text":"The Net Rent in this Qtr is %v ."
    }
            },
             {
             "tooltip":{
      "background-color":"green",
      "padding":"5 10",
      "border-color":"#009",
      "border-width":2,
      "border-radius":5,
      "alpha":0.75,
      "text":"The Economic Rent in this Qtr is %v ."
    }
            }



        ]
    }
]
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-09-23 14:37:48

你可以用两种方法。一个是通过js样式表,但您需要知道xAxis项的数量。对于32的例子,您可以在scale-x样式中添加“max- the”:“32”。

代码语言:javascript
复制
"scale-x":{
        "max-items":"32",
        "items-overlap":false,
        "item":{ 
            "font-angle":90,
            "guide":{
                    "visible":false
                }
             }
}

但听起来你需要让这件事更有活力。因此,在创建图表之前,您需要确定xAxis的数量。通过cfchart的xAxis属性设置此值,如下所示。

代码语言:javascript
复制
<!--- set max-items to recordcount of qry_subproperty --->
<cfset xAxis = {"max-items":"#qry_subproperty.recordcount#"}>
<cfchart  
    format="jpg"
    chartheight="320"  
    chartwidth="690"  showborder="yes" 
    title="Trend In Subject Rents"  style="20currency.js"  name="Qtr1"  xAxis='#xAxis#'>
    <cfchartseries type="line" 
        serieslabel="Gross"
        seriescolor="navy"  markerStyle="diamond" paintStyle="plain" >
        <cfloop query="qry_subproperty">
            <cfset variables.Yearquarter=ObjPropDetails.JoinYearQuarter(qry_subproperty.Yearquarter)>
            <cfchartdata item="#variables.Yearquarter#" value="#round(qry_subproperty.Gross)#" >
        </cfloop>
    </cfchartseries>
    <cfchartseries type="line" 
        serieslabel="Net"
        seriescolor="red"  markerstyle="rectangle">
        <cfloop query="qry_subproperty">
            <cfset variables.Yearquarter=ObjPropDetails.JoinYearQuarter(qry_subproperty.Yearquarter)>
            <cfchartdata item="#variables.Yearquarter#" value="#round(qry_subproperty.Net)#" >
        </cfloop>
    </cfchartseries>
    <cfchartseries type="line" 
        serieslabel="Economic"
        seriescolor="green" markerstyle="triangle">
        <cfloop query="qry_subproperty">
            <cfset variables.Yearquarter=ObjPropDetails.JoinYearQuarter(qry_subproperty.Yearquarter)>
            <cfchartdata item="#variables.Yearquarter#" value="#round(qry_subproperty.Economic)#" >
        </cfloop>
    </cfchartseries>
 </cfchart>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/25786749

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档