Skip to main content
Participant
September 17, 2021
Question

<cfchart data on bar chart the numbers are converted to Alphabets

  • September 17, 2021
  • 1 reply
  • 141 views

Hi all,

So I have data with numeric values and also alphabets (mix of both) to diplay on the barchart X-axis. 

Like 1 2 3 4 5 6 7 8 9 A B C D E F G H I J ... etc...

The problem is - The numeric values on X-axis data on Bar chart is being converted to Alphabets, 

 and displaying all alpabets..

Looks like the datatype I need to specify it somewhere so that It reads it right. Please help wit a solution if you have ran in to this issue and fixed.

 

Thanks,

 

 

    This topic has been closed for replies.

    1 reply

    BKBK
    Community Expert
    Community Expert
    September 19, 2021

    Could you share the code you use?

    I can confirm the error, and have in fact reported a cfchart bug: https://tracker.adobe.com/#/view/CF-4212392 

     

    Bala5FC7Author
    Participant
    September 19, 2021
    Thank so verymuch for the repsonse, and reproducing bug.
     
    Here is my code, the data coming to chart is dynamic, and is in the loop,  
    sect.blocks[b].rows[j3].Code - is the data to be presented on the x-axiz chart. please let me know if you have more questions to me. 
     
    <cfscript>                                                   
            border = { "width": 0 };
            yAxis = { "label" : { "bold" : false, "color" : "black" } };
            border = { "width": 0 };
    </cfscript>
    <cfset xAxs = {"max-items":"20",  "label" : { "bold" : false, "color" : "black" },  "items-overlap":false,
        "item":{ "guide":{ "visible":false } }}>
        <cfchart format="png" xAxisType = "category" chartwidth="800" chartheight="500" xAxis="#xAxs#" yAxis = "#yAxis#" show3D="no" 
        title="#com2#" showBorder="false" xAxisTitle = "#com2#" yAxisTitle = "Total">
        <cfchartseries type="bar" border="#border#">
        <cfloop index="j3" from="1" to="#ArrayLen(sect.blocks[b].rows)#">
            <cfset num = Val("#sect.blocks[b].rows[j3].TSUMS#")>
            <cfif FindNoCase("Geography",sect.header)>
                <cfchartdata  item="#sect.blocks[b].rows[j3].Code#"  value="#num#">
            <cfelse>
                <cfif #ArrayLen(sect.blocks[b].rows)# GT 6>
                <cfchartdata item = "#sect.blocks[b].rows[j3].Code#" value="#num#">
                <cfelse>
                <cfchartdata item = "#sect.blocks[b].rows[j3].Text#" value="#num#">
                </cfif>
            </cfif>
            </cfloop>
        </cfchartseries>
        </cfchart>
    BKBK
    Community Expert
    Community Expert
    September 20, 2021

    My pleasure, @Bala5FC7 . Thanks to you too for sharing your code. It confirms the code of my reproduction of the bug.