coldfusion - cfchart ignores my scalefrom value -
i have following codes in page.
the style variable holds 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 begin, please see chart_good.jpg. how want report come up. on x-axis, there 3 items long @ least 1 of them has values. if item not have values (i.e. 2010), there not marker in chart.
the problem occurs when 1 item has value. please see chart_bad.jpg. can see, 2008 , 2010 not have values; y-axis scaled 0 100. have tried setting 1 of items (ex. 2008) value of 0 or off chart; scale according off-the-chart value , 2009 value. in short, have have @ least 2 items values between 20 , 100 in order cfchart scale 20 100.
my question is, how can correct issue cfchart scale 20 100? running cf9.
what inside style variable?
i suggest not using scalefrom="" , scaleto="" in cfchart tag can buggy sometimes. believe coldfusion's cfchart tag attempts scale chart automatically deems best fit. instead build chart's minimum , maximum scales inside framechart tag.
example of style variable build 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> <!--- bread , butter note: if use variables scalemin , scalemax make sure surround them 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 have load variable style attribute mentioned.
<cfchart format="png" chartwidth="550" chartheight="175" style="#style#">
also great resource use, webcharts program in c:/coldfusion/charting/ directory. open webcharts.bat, create custom chart, copy xml code style variable, , viola!
make sure remove scaleto= , scalefrom= cfchart tag if decide go route.
Comments
Post a Comment