Charts aren't appearing ($.plot is not a function)

It seems the stats charts have quit appearing for me with Anki 2.1.15 under Debian unstable - the result looks something like this:

I noticed a repeated error message when starting Anki from the terminal - “$.plot is not a function” - which after doing a little bit of digging led me to try to reinstall the libjs-jquery-flot package, as it seems that’s what that message is referring to, but that didn’t work. Any further advice or ideas would be greatly appreciated.

You could use the AnkiWebView Inspector, to inspect the webview the stats run in. But it seems most likely that this is caused by an add-on. Did you try whether the same error comes up, if you start Anki without add-ons (holding the Shift key during startup)?

Starting without add-ons didn’t change anything - I didn’t have any installed before installing the WebView inspector. After some peeking around, it turned out the file jquery.flot.min.js in /usr/share/javascript/jquery-flot (which is where Anki was getting the source from) was inexplicably empty. I grabbed a copy from flot - Libraries - cdnjs - The #1 free and open source CDN built to make life easier for developers and replaced the local file with that, and the charts are reappearing, if they look a little odd:

The number of new cards seems to be way too many (I do maybe 10 a day in comparison to reviewing about 100 on average), but this is definitely progress. I also notice the pie chart at the bottom isn’t displaying, despite the WebView inspector not reporting any errors, nor any errors showing up in the terminal:


Could honestly be related to me messing around with flot. I tried reinstalling ibjs-jquery-flot after my manual fix and jquery.flot.min.js ended up empty again, so I might need to file a bug report with Debian on that as well.

(Ignore the weird rectangle with the second screenshot. I think it’s something to do with how I’m using scrot to take screenshots.)

Try it with the plot.js file directly from the anki repository: anki/plot.js at master · ankitects/anki · GitHub

Please see Third party Linux packages and source builds are not supported - Frequently Asked Questions