4 Replies Latest reply on Mar 21, 2016 3:18 AM by biene22

    cfchart yaxis2 title

    biene22

      Hello,

       

      how do I set the title of a second yaxis?

      There is no attribute like yaxis2title in <cfchart>  tag.

       

      I'm working on ColdFusion 11  Standard.

      regards

      Claudia

        • 1. Re: cfchart yaxis2 title
          sdsinc_pmascari Level 2

          Go over the CFChart documentation and you'll find an attribute for yaxis2 that requires a "JSON string representation".

           

          Adobe makes no mention of how to actually build this JSON string.  The answer is here:

           

          Docs | JSON Attributes | Graph Objects | Scale-Y, Scale-Y-N | ZingChart

          • 2. Re: cfchart yaxis2 title
            biene22 Level 1

            Thank you, I know the ZingChart docs.

            I think my main problem is the "JSON string representation" syntax inside the cfchart attribute.

            I try this, but it does not work.

             

            yAxis2= #[{"label":{

                    "text":"Label Text",

                    "font-size":"20px",       

                    "font-color":"red"}}]#

            • 3. Re: cfchart yaxis2 title
              sdsinc_pmascari Level 2

              I think your JSON formating is wrong.  Here's an example I did a while back.  It doesn't affect the Y axis you're looking for but should point you in the right direction:

               

              <cfset plotarea ={

                                  "adjustLayout"=true,

                                  "alpha"=1,

                                  "margin-top"=5,

                                  "margin-right"=5,

                                  "margin-left"=5,

                                  "margin-bottom"=0

                              }>

                      <cfset title = {

                                  "visible"=false,

                                  "backgroundColor"="##dcdcdc"

                              }>

                      <cfset border = {

                                  "borderColor"="none"

                              }>

                      <cfset legend = {

                                  "visible"=false

                              }>

                      <cfset plot = {

                                  "highlight"=false,

                                  "value-box"={

                                      "placement"="out",

                                      "connected"=false,

                                      "text"="%t",

                                      "font-color"="##5A5A5A",

                                      "type"="all"

                                  }

                              }>

               

              <cfchart

                          databackgroundcolor="##dcdcdc"

                          backgroundColor="##dcdcdc"

                          plotarea="#plotarea#"

                          title="#title#"

                          border="#border#"

                          legend="#legend#"

                          plot="#plot#"

                          chartwidth="460"

                          chartheight="260"

                          show3d="yes"

                          name="ret.pieChartchartImg"><!--- style="#prodJSONFile#" --->

                          <cfchartseries type="pie">

                              <cfloop query="myqry">

                                  <cfchartdata item="#numberFormat(myqry.perc,'___._')#%" value="#myqry.perc#">

                              </cfloop>

                          </cfchartseries>

              </cfchart>

              • 4. Re: cfchart yaxis2 title
                biene22 Level 1

                Okay, that was a good hint.

                 

                Now I have this solution:

                 

                Because it's dynamic, I get the AxisTitle from a query.

                <cfset yAxis2Title= #evaluate("select_y2_axis_#n#.unit")#>

                 

                <cfchart

                ....

                yaxis2=#{"label":{"text":"#yAxis2Title#"}}#

                >