tracker issue : CF-4203130

select a category, or use search below
(searches all categories and all time range)

Cfchart format="html" does not work when using <!DOCTYPE html>

| View in Tracker

Status/Resolution/Reason: To Fix//HaveNewInfo

Reporter/Name(from Bugbase): Priyank Shrivastava / ()

Created: 07/23/2018

Components: Charting/Graphing, Documentation

Versions: 2018

Failure Type: Incorrectly functioning

Found In Build/Fixed In Build: 310739 /

Priority/Frequency: Major / Most users will encounter

Locale/System: English / Win 2016

Vote Count: 2

Problem Description:  Cfchart type="html" does not work when using <!DOCTYPE html>

Steps to Reproduce:

<!DOCTYPE html>

<cfchart format="html" type="bar" showlegend="false" chartHeight="400" chartWidth="600" title="Sales report">


        <cfchartdata item="2012" value=#randrange(10,100)#>

        <cfchartdata item="2013" value=#randrange(10,100)#>

        <cfchartdata item="2014" value=#randrange(10,100)#>

        <cfchartdata item="2015" value=#randrange(10,100)#>

        <cfchartdata item="2016" value=#randrange(10,100)#>

        <cfchartdata item="2017" value=#randrange(10,100)#>



Actual Result: It is showing the blank page.

Expected Result: it should display the chart.

Any Workarounds: Remove the <!DOCTYPE html> from the code.



If you are using <!DOCTYPE html> it is standard html mode and if not using DOCTYPE, it uses quarks mode that is supported by browsers. For Standard html width and height must have html standard units i.e. px, % etc. Whereas in quarks mode width and height with units fallback to pixel. That's why you not getting chart when using DOCTYPE. Zingchart also expects in same way.
Comment by Ajay R.
29433 | July 30, 2018 11:08:32 AM GMT
Can you please provide the specific syntax we need to use? It is not clear in the explanation provided, not is it clear in the documentation. Thanks!
Comment by Alberto G.
29441 | August 07, 2018 04:24:13 PM GMT
Sorry Ajay... I re-read your post and understand your explanation. Is there anywhere these type of behavior changes are documented? It would be a helpful guide to get ahead of known required code changes in CF2018.
Comment by Alberto G.
29442 | August 07, 2018 07:00:58 PM GMT
To answer Alberto's last quetion, the documentation change for this is at, where they added a new alert box, indicating the following: "If you are using <!DOCTYPE html>, and not DOCTYPE, cfchart uses quarks mode that is supported by browsers. For standard HTML output, the width and height must have html standard units i.e. px, % etc. In quarks mode, the width and height with units falls back to pixel" Even so, I'm still confused by that phrasing, for a number of reasons. I'd love to hear from Ajay, Alberto, or others interested in this topic. First, what is meant by "If you are using <!DOCTYPE html>, and not DOCTYPE"? Someone mis-represented what Ajay said here, which was instead that the difference was simply whether you were using that doctype declaration, or not. The "and not DOCTYPE" in the doc makes no sense to me. Second, even then, the rest reads unclearly as to which leads to "standard mode" and which to "quarks mode". Third, shouldn't the reference to height and width be to the specific chartheight and chartwidth attributes of cfchart? This does not clarify (here or the doc). Finally, I'm STILL confused what Ajay really was saying above about how the units are interpreted (though Alberto, as you understood it, maybe you can explain) Is he saying that if the doctype IS NOT there (thus "quarks mode"), then the chartheight and width are presumed to be pixels, only? (And is that why the rest of the docs indicate simply that "pixels" are used for the units of chartheight and chartwidth? Did it presume people would NOT use that doctype declaration?) And that if the doctype IS there, then is it that the chartheight and chartwidth values can NOT be just pixels, but must have px or % appended, to be clarified? Did it then just ignore the values if there was no appended unit indicator? That's not clear here or in the doc. Finally, both this note and that doc change mistakenly use the term "quarks mode". It's "quirks mode", instead: I'd love to come up with a proposal of what the new "box" should say, but without clarity on the above, I'm at a loss.
Comment by Charlie A.
31326 | September 12, 2019 04:24:57 PM GMT
Also, that text box added for the doc (see my last comment) does not indicate that it's referring to the format="html" attribute (though it begs the question what would happen for the other supported values of "format" in CF2018, "jpg" and "png"). Further, shouldn't the other references in document to the chartheight and chartwidth attributes be modified to indicate how this distinction changes whether the value should be just pixels or not? Right now, again, they both indicate simply that the value should be pixels, which I think is what it always was and why I assume this "change" (if the doctype is there or not) bit Alberto.
Comment by Charlie A.
31327 | September 12, 2019 04:34:01 PM GMT