Closed bondjimbond closed 4 years ago
This is ringing a bell... did you open another issue recently about a chart not showing up? My first guess is that it's a caching issue. Did you just dial up page caching?
I brought it up on Slack, but didn't make an issue. Caching is my thought too, but I don't know what to do about it... can't turn off the caching.
@bondjimbond only thing I can think of, and it's just a guess, is that at the moment the cache was built, there was a glitch in downloading the Chart.js javascript file from cloudfare. If that is true (and I have absolutely no idea if it is), I wonder if using a local copy, as described in #6, would help reduce the risk of it happening again.
That could work!
@bondjimbond do you want me to work on #7 to see if that helps?
Do you mean #6? (#7 is closed.) That would be great if you have the time, thanks!
Yes, sorry #6
@bondjimbond looks like to use a local copy of Chart.js, you need to build it with npm or Bower (https://www.chartjs.org/docs/latest/getting-started/installation.html). It's not a single file JavaScript library. Do you still want to try this option?
Sure... Is there a way maybe for the module to first check if a local copy is installed, and then if not try for the remotely hosted copy?
@bondjimbond can you try this?
drupal/sites/all/libraries
directory, create a subdirectory chartjs
wget https://github.com/chartjs/Chart.js/releases/download/v2.9.3/Chart.bundle.js
admin/islandora/tools/islandora_usage_stats_charts
, enter the URL to the newly downloaded Chart.bundle.js file, e.g. https://arcabc.ca/sites/all/libraries/chartjs/Chart.bundle.js
I'm entirely sure this will work, since I can't get either npm or bower to install Chart.js (untrusted certificate error). But it should.
Error when loading:
Failed to load resource: the server responded with a status of 404 () js_UMFtXMK85ue7pvck9drFrxxl8t-gwzIY6GQWiWk59b4.js:55 Uncaught ReferenceError: Chart is not defined at js_UMFtXMK85ue7pvck9drFrxxl8t-gwzIY6GQWiWk59b4.js:55
In the module code the URL to the Chart library is marked as 'external', which according to https://api.drupal.org/api/drupal/includes%21common.inc/function/drupal_add_js/7.x should not be aggregated. Yet the filename in the 404 error you are seeing suggests it is being aggregated.
Can you confirm that the URL to Chart.bundle.js as defined in step 4 above is correct? Test it by copying it and then visiting it in a private window.
On my dev VM, using the URL http://localhost:8000/sites/all/libraries/chartjs/Chart.bundle.js and with Javascipt aggregation enabled, charts are working for me. I'm not getting the 404 error you are seeing. Let me know if your URL is correct and we'll take it from there.
Whoops, made a mistake in my wget apparently. Yep, it's working now!
Very good. I've documented this over at #6 and will update the readme accordingly.
Not sure why, but charts are not showing, and there are no errors reported.
See https://dc.arcabc.ca/islandora/object/dc%3Aroot -- the "Usage Statistics" dropdown appears at the bottom of the page, and expands as well, but no actual content appears. Nothing is revealed in the console.
Tried changing the JQuery version, no effect.
Even weirder -- the dropdown appears when logged out, but disappears when logged in.
Any ideas what could be happening?