Copy link to clipboard
Copied
I am displaying a chart using CFCHART. It works fine in local development on CF2016 Developer edition, however when I run the code on the server (also CF2016) I just get a blank white screen.
Looking at the source code, everything appears to be there
I looked at the CF Administrator and the "Charting" settings are the same. I don't see anything else that is related to the charts.
I stripped it back to a very basic call for a chart with no data which will display an empty graph, this works on the local side (see attached screenshot), but not on the server, again, a white screen, no graph.
Code below.
<CFCHART
title="My Graph"
format="html"
show3d="no"
showlegend="yes"
chartheight="400"
chartwidth="500"
labelFormat = "number"
showborder="true"
pieSliceStyle="sliced"
sortXAxis = "yes">
<cfchartseries type="bar" dataLabelStyle="pattern" seriescolor="4199d1" valuecolumn="totalclicks" itemcolumn="click_country">
</cfchartseries>
</cfchart>
It's not throwing and error, the source looks okay, and I don't see any errors in the log either.
Anybody have any ideas?
Copy link to clipboard
Copied
Did you perhaps forget about the cfchart attribute
query="someQuery"
Copy link to clipboard
Copied
No, I do have it running with a query, just for the example in this thread I slimmed it down. The code I posted is enough for me to see something is not working, on my local side I get an empty graph, on the server, the blank screen.
Copy link to clipboard
Copied
... just for the example in this thread I slimmed it down.
By @ACS LLC
You shouldn't have. Add the query attribute, and my bet is, it will then work as expected.
Copy link to clipboard
Copied
To illustrate I shall use a query that I have derived from your previous thread . Run the following code and you will see that the query attribute is necessary:
<cfset getClick = queryNew("click_country,totalclicks", "varchar,integer")>
<cfset queryAddRow(getClick, {"click_country"="us","totalclicks"=1})>
<cfset queryAddRow(getClick, {"click_country"="fr","totalclicks"=3})>
<cfset queryAddRow(getClick, {"click_country"="se","totalclicks"=4})>
<cfset queryAddRow(getClick, {"click_country"="de","totalclicks"=4})>
<cfset queryAddRow(getClick, {"click_country"="uk","totalclicks"=8})>
<h1> With <span style="color:purple">query</span> attribute: chart bars are displayed</h1>
<cfchart query="getClick"
title="My Graph"
format="html"
show3d="no"
showlegend="yes"
chartheight="400"
chartwidth="500"
labelFormat = "number"
showborder="true"
pieSliceStyle="sliced"
sortXAxis = "yes">
<cfchartseries type="bar" dataLabelStyle="pattern" seriescolor="4199d1" valuecolumn="totalclicks" itemcolumn="click_country">
</cfchartseries>
</cfchart>
<h1> Without <span style="color:purple">query</span> attribute: chart bars are not displayed</h1>
<cfchart
title="My Graph"
format="html"
show3d="no"
showlegend="yes"
chartheight="400"
chartwidth="500"
labelFormat = "number"
showborder="true"
pieSliceStyle="sliced"
sortXAxis = "yes">
<cfchartseries type="bar" dataLabelStyle="pattern" seriescolor="4199d1" valuecolumn="totalclicks" itemcolumn="click_country">
</cfchartseries>
</cfchart>
The result is:
Copy link to clipboard
Copied
Hi @BKBK
I tried the code on my server, no graph
https://www.aspirenet.com/chart.cfm
It works locally.
It charting something that has to be part of the install that perhaps I omitted when installing CF some years ago?
Copy link to clipboard
Copied
No, charting is not an optional feature in the CF installer. It's also not one of the features listed during the install that can be turned off (like cfreport support and some other things can be).
While you're in CF2016, I'll say for the sake of completeness that charting is indeed true that in CF2021 and above, it's one of the 50+ "packages/modules" that one can add or remove--and the traditional full installer installs them all. You can look at the CF Admin and its "package manager" page, to see both all modules installed and not installed--if you want to confirm that. You could add it there. But if that was a problem, one would be getting an error rather than a blank page.
I'll offer other thoughts in a separate message, not as a reply to this discussion of needing a query (which never quite made sense to suggest, since you showed your original code to be working without one).
Copy link to clipboard
Copied
Hi @ACS LLC , in that case, we then have to look into what @Momna33907036fj9n said. For example, does your production server run on ColdFusion Standard? If so, then that might be the explanation. The Developer Edition is practically ColdFusion Enterprise.
Copy link to clipboard
Copied
The CFCHART code you've provided appears to be syntactically correct for generating a basic bar chart in ColdFusion. The issue you're experiencing with the chart not displaying on the server, despite working locally, is likely not due to a problem in this code snippet itself. Instead, it might be related to environmental differences between your local setup and the server, such as configuration settings, resource access, or browser compatibility issues. It's important to investigate these areas to identify the root cause of the issue.
Copy link to clipboard
Copied
Bummer to see you've still not gotten resolution to this. I have some thoughts to consider.
You mention the "source looks okay", but it's unclear: do you mean the CFML source code? or do you mean you did a vew>source on the resulting page which should be rendering the chart? It would be useful for you to compare both that of the page from the server where it works and the page from the server where it does not. Is there any difference? It may be a subtle one (or perhaps an obvious, once you look).
One may wonder "how could identical CFML code create different results", but as momna noted, there may be some environmental difference in your machines. I have a few possibilities:
Those are a few ideas off the top of my head.
Copy link to clipboard
Copied
ACS, did you ever resolve things? I hoped that something I shared above may have helped you.
Indeed, I happened to notice that the demo page you offered produces no result because there are javascript errors. If you use your browser dev tools feature, you'll see that all the requests made back to the server for files with the cf_scripts directory (code which CF generates for you in HTML) all fail with a 404.
If that was the problem back then when you first wrote here, then the reason things didn't work on this server (compared to your local machine) is that someone had removed the cf_scripts virtual directory that would have been put in place by the CF web server configuration tool (wsconfig), creating a connection between your web server (IIS or Apache) and CF.
If you add that back (to this site serving your aspirenet.com domain), pointing at the [coldfusion]\cfusion\wwwroot\cf_scripts folder, you should then find that the charts render. Or you may see some new error (in the dev tools, at its "console" feature) which you could use (along with its "network" feature) to identify whatever may remain as such an error (in the call from the browser to the server).
Hop you'll let us know how things turn out.
Copy link to clipboard
Copied
Hi @Charlie Arehart As I moved the new platform to a server with Lucee I found that I didn't have to resolve the issue in ACF as it worked right out of the box with Lucee.
Copy link to clipboard
Copied
Well sure, things can differ between the two, for better or worse. I hope what I shared may serve others then, as a simple solution.
We all simply overlooked the misconfiguration back then. It can happen with any product, of course--even lucee. 🙂