Chart.js error - bar graph not displaying

Bug #1976449 reported by Dianne Tennent
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
High
Unassigned

Bug Description

Related to the upgrade from 2.9.4 to 3.7.1 (Bug 1962118)

To test:
1. Add an institution and some people
2. Add some blocks to a page
3. Run the cron, ensuring that the weekly cron jobs run after you've created the data
4. View the reports page: Admin menu>Reports

Expected results:
 - A horizontal bar graph under the heading 'Most frequently used blocks in portfolio pages' showing number of each blocktype

Actual results:
 - No results

Errors in console:

Chart.min.js?v=8443:13 Invalid scale configuration for scale: xAxes
(anonymous) @ Chart.min.js?v=8443:13
(anonymous) @ Chart.min.js?v=8443:13
Us @ Chart.min.js?v=8443:13
(anonymous) @ Chart.min.js?v=8443:13
Js @ Chart.min.js?v=8443:13
dn @ Chart.min.js?v=8443:13
(anonymous) @ mahara.js?v=8443:1023
(anonymous) @ mahara.js?v=8443:375
c @ jquery.js?v=8443:2
fireWith @ jquery.js?v=8443:2
l @ jquery.js?v=8443:2
(anonymous) @ jquery.js?v=8443:2
load (async)
send @ jquery.js?v=8443:2
ajax @ jquery.js?v=8443:2
sendjsonrequest @ mahara.js?v=8443:345
fetch_graph_data @ mahara.js?v=8443:926
(anonymous) @ statistics.php:537
e @ jquery.js?v=8443:2
t @ jquery.js?v=8443:2
setTimeout (async)
(anonymous) @ jquery.js?v=8443:2
c @ jquery.js?v=8443:2
fireWith @ jquery.js?v=8443:2
fire @ jquery.js?v=8443:2
c @ jquery.js?v=8443:2
fireWith @ jquery.js?v=8443:2
ready @ jquery.js?v=8443:2
B @ jquery.js?v=8443:2
mahara.js?v=8443:378 sendjsonrequest() callback failed: Error: "horizontalBar" is not a registered controller.
    at Object._get (Chart.min.js?v=8443:13:84583)
    at Object.getController (Chart.min.js?v=8443:13:83650)
    at dn.buildOrUpdateControllers (Chart.min.js?v=8443:13:94805)
    at dn.update (Chart.min.js?v=8443:13:95565)
    at new dn (Chart.min.js?v=8443:13:91945)
    at mahara.js?v=8443:1023:27
    at Object.<anonymous> (mahara.js?v=8443:375:17)
    at c (jquery.js?v=8443:2:28327)
    at Object.fireWith [as resolveWith] (jquery.js?v=8443:2:29072)
    at l (jquery.js?v=8443:2:79901) {data: {…}}
(anonymous) @ mahara.js?v=8443:378
c @ jquery.js?v=8443:2
fireWith @ jquery.js?v=8443:2
l @ jquery.js?v=8443:2
(anonymous) @ jquery.js?v=8443:2
load (async)
send @ jquery.js?v=8443:2
ajax @ jquery.js?v=8443:2
sendjsonrequest @ mahara.js?v=8443:345
fetch_graph_data @ mahara.js?v=8443:926
(anonymous) @ statistics.php:537
e @ jquery.js?v=8443:2
t @ jquery.js?v=8443:2
setTimeout (async)
(anonymous) @ jquery.js?v=8443:2
c @ jquery.js?v=8443:2
fireWith @ jquery.js?v=8443:2
fire @ jquery.js?v=8443:2
c @ jquery.js?v=8443:2
fireWith @ jquery.js?v=8443:2
ready @ jquery.js?v=8443:2
B @ jquery.js?v=8443:2
mahara.js?v=8443:378 sendjsonrequest() callback failed: TypeError: chartobject.generateLegend is not a function
    at mahara.js?v=8443:1024:81
    at Object.<anonymous> (mahara.js?v=8443:375:17)
    at c (jquery.js?v=8443:2:28327)
    at Object.fireWith [as resolveWith] (jquery.js?v=8443:2:29072)
    at l (jquery.js?v=8443:2:79901)
    at XMLHttpRequest.<anonymous> (jquery.js?v=8443:2:82355) {data: {…}}
(anonymous) @ mahara.js?v=8443:378
c @ jquery.js?v=8443:2
fireWith @ jquery.js?v=8443:2
l @ jquery.js?v=8443:2
(anonymous) @ jquery.js?v=8443:2
load (async)
send @ jquery.js?v=8443:2
ajax @ jquery.js?v=8443:2
sendjsonrequest @ mahara.js?v=8443:345
fetch_graph_data @ mahara.js?v=8443:926
(anonymous) @ statistics.php:508
e @ jquery.js?v=8443:2
t @ jquery.js?v=8443:2
setTimeout (async)
(anonymous) @ jquery.js?v=8443:2
c @ jquery.js?v=8443:2
fireWith @ jquery.js?v=8443:2
fire @ jquery.js?v=8443:2
c @ jquery.js?v=8443:2
fireWith @ jquery.js?v=8443:2
ready @ jquery.js?v=8443:2
B @ jquery.js?v=8443:2
mahara.js?v=8443:378 sendjsonrequest() callback failed: TypeError: chartobject.generateLegend is not a function
    at mahara.js?v=8443:1024:81
    at Object.<anonymous> (mahara.js?v=8443:375:17)
    at c (jquery.js?v=8443:2:28327)
    at Object.fireWith [as resolveWith] (jquery.js?v=8443:2:29072)
    at l (jquery.js?v=8443:2:79901)
    at XMLHttpRequest.<anonymous> (jquery.js?v=8443:2:82355) {data: {…}}

Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review
Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/c/mahara/+/12833
Committed: https://git.mahara.org/mahara/mahara/commit/afc341dfe92eda4b13a82b3a16f2ddd4fb411b8f
Submitter: "Robert Lyon <email address hidden>"
Branch: main

commit afc341dfe92eda4b13a82b3a16f2ddd4fb411b8f
Author: Dianne Tennent <email address hidden>
Date: Wed Jun 1 17:19:01 2022 +1200

Bug 1976449: Chart.js error - bar graph not displaying

- Remove deprecated generateLegend() function
- Change deprecated hoizontalBar to bar, with extra config to
display horizontally
- Configure bar graph legends not to display (same as
before chart.js upgrade)
- Ensure scale on bar graphs uses whole numbers

To test: Add a few blocks to a page, run cron, check the
Reports page bar graph 'Most frequently used blocks in portfolio pages'

Change-Id: Ia02dcbb5fbef2d440ee23be0b1d7ac37be35a58c

Robert Lyon (robertl-9)
Changed in mahara:
milestone: none → 22.10.0
importance: Undecided → Medium
importance: Medium → High
status: New → Fix Committed
Doris Tam (doristam)
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.