Skip to main content
Participant
Sep 17, 2021 3:08 PM UTC
Question

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

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 is closed to new replies. Start a new post to keep the conversation going.

    3 replies

    BKBK
    Community Expert
    Community Expert
    Sep 19, 2021 10:00 AM UTC

    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 

     

    Translate
    Bala5FC7Author
    Participant
    Sep 19, 2021 7:04 PM UTC
    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>
    Translate
    BKBK
    Community Expert
    Community Expert
    Sep 20, 2021 7:42 AM UTC

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

    Translate