• The browser console show the following error, I assume it is JavaScript error:

    admin.php?page=qmn_stats:358 Uncaught TypeError: (intermediate value).Line is not a function at window.onload (admin.php?page=qmn_stats:358) window.onload @ admin.php?page=qmn_stats:358 load (async) (anonymous) @ admin.php?page=qmn_stats:356

    Consequently, the statistics page is blank.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support expresstechsupport


    Hi Budiony,

    Please share the quizz’s URL with me so that I can look into the issue.


    Hi, the problem is not with the quiz, but with the Admin panel -> Statistics, i.e. (admin.php?page=qmn_stats). Unfortunately I cannot share the internal credentials. The JavaScript error is (I assume you are using Chart.js library to display data?):

    window.onload = function(){
      var graph_ctx = document.getElementById("graph_canvas").getContext("2d");
      window.stats_graph = new Chart(graph_ctx).Line(graph_data, {
      responsive: true

    So the error means that either the charting library is not loaded when you are trying to create a line graph, or the library was loaded, but the syntax of the command is different. As far as I can see from the source code at line 120-142 in stats-page.php, the library is loaded before the request to create canvas, so it is the latter option.

    The resolution of the problem is as follows (edit was made in file stats-page.php between lines 120-142):

    window.onload = function(){
       var graph_ctx = document.getElementById("graph_canvas").getContext("2d");
       var myLineChart = new Chart(graph_ctx, {
                    type: 'line',
                    data: {
                      labels : [<?php echo $labels; ?>],
                      datasets : [
                        label: "",
                        fillColor : "rgba(220,220,220,0.2)",
                        strokeColor : "rgba(220,220,220,1)",
                        pointColor : "rgba(220,220,220,1)",
                        pointStrokeColor : "#fff",
                        pointHighlightFill : "#fff",
                        pointHighlightStroke : "rgba(220,220,220,1)",
                        data : [<?php echo rtrim($value,","); ?>]
                        }						      ]                
                    options: {
                        title: {
                          display: true,
                          text: "<?php _e('Statistics', 'quiz-master-next'); ?>"

    As you can see, the problem is that there is new syntax when creating line graph with Chart.js library.

    The old code creates chart line with, which is no longer supported in 2.9.3 version of library:
    `new Chart(graph_ctx).Line(graph_data, {
    responsive: true

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Error while previewing statistics’ is closed to new replies.