Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

cfchart yaxis2 title

Participant ,
Mar 17, 2016 Mar 17, 2016

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.0K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 17, 2016 Mar 17, 2016

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Mar 17, 2016 Mar 17, 2016

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"}}]#

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 17, 2016 Mar 17, 2016

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>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Mar 21, 2016 Mar 21, 2016
LATEST

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#"}}#

>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources