1

I have many charts in my application Is there any way to make the y axis more dynamic with json . I am using coldfusion 11. Please see my code

 <cfchart  
         format="#format#"
           chartheight="320" chartwidth="690"  showborder="yes" 
        title="Trend in Subject Rents" style="20currency.js" name="TwntyQtrGraph1" tipstyle="mouseOver" 
        tooltip="#Deserializejson(stc_fields)#"  gridlines="#GraphInterval#">  
         <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>
Lakshmi
  • 19
  • 9
  • The question is not clear. What does your y axis look like now and how would you like it to look? – Dan Bracuk Oct 03 '14 at 12:10
  • Honesty, using ZingCharts directly, rather than through the use `cfhart`, is actually easier. They even have a 'Chart Builder' that allows you to build a JSON string that allows you to play with chart type, formatting, styling, etc. You can then use CF to build a comparable JSON string. - http://www.zingchart.com/ – Scott Stroz Oct 03 '14 at 12:31
  • @Divya what exactly do you want to make more dynamic? The number of y axis items? – Alan Bullpitt Oct 06 '14 at 15:14
  • @AlanBullpitt I want to make my y axis more dynamic according to the values plot in graph, i know in json we have 'values'to specify the scalefrom ,scaletop and the interval(eg values:100:500:10) then how can i use this in my cf page with dynamic values – Lakshmi Oct 07 '14 at 06:50
  • @ScottStroz I got 'Values' attribute from the zingchart.com but i want to use the 'values' in my cf page with dynamic numbers . i dont know how to represent that json in my cf page . i am new to CF please help – Lakshmi Oct 07 '14 at 07:00
  • @AlanBullpitt: I have a problem with my x axis values in my chart. my x axis values are 1N,2N,2S,3,11,9,22W but my chart only shows the values with characters(1N,2N,2S) it skips the 3,11,9..etc.When i tested the json the 1N,2N,2S values are quoted with " " and the integers are not.How can i display all my x values – Lakshmi Nov 26 '14 at 06:36
  • @Divya can you post your json file so I can take a look. – Alan Bullpitt Nov 26 '14 at 14:50
  • @AlanBullpitt: I am using coldfusion 11 i have posted my code below. – Lakshmi Nov 27 '14 at 12:22
  • @AlanBullpitt :i have cf chart with dual y axis. I want to make the y axis synchronized with the other.both y axis should start from the same point.please help me. – Lakshmi Jan 30 '15 at 08:41
  • @AlanBullpitt I have posted this as a question,please see – Lakshmi Jan 30 '15 at 09:00

1 Answers1

1

You can set the max-value and step interval through the yAxis property in cfchart. These values can be dynamic. You can also set an array of values if you want "values":[0,200,400,600,800,1000]. The scalefrom ,scaletop and the interval(eg values:100:500:10) technique doesn't appear to work. But like I said you can get the same result using max-value and step.

<cfset yAxis = {"min-value":"0","max-value":"1000","step":"200"}>
<cfchart  
     format="#format#" yAxis="#yAxis#" 
       chartheight="320" chartwidth="690"  showborder="yes" 
    title="Trend in Subject Rents" style="20currency.js" name="TwntyQtrGraph1" tipstyle="mouseOver" 
    tooltip="#Deserializejson(stc_fields)#"  gridlines="#GraphInterval#">  
     <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>
</cfchart>
Alan Bullpitt
  • 456
  • 4
  • 13