This topic contains 1 reply, has 2 voices, and was last updated by Sean Sean 3 years, 5 months ago.

Dashboard Site Statistics From JSON

  • efendi

    Member Reply #3951


    I have some changes in assets/admin/pages/scripts/index.js

    (Layout: admin2)
    Original code block;

    var visitors = [
    ['02/2013', 1500],
    ['03/2013', 2500],
    ['04/2013', 1700],
    ['05/2013', 800],
    ['06/2013', 1500],
    ['07/2013', 2350],
    ['08/2013', 1500],
    ['09/2013', 1300],
    ['10/2013', 4600]

    My changes;

    var visitors = [];

    $.getJSON('/ga/report.php', function(data) {
    visitors = data;

    I’ve removed visitors array and create empty array called visitors. Report.php has an array exactly same visitors data.

    It should be work but it does not work.

    If I add an alert code like alert(‘hi’); after the getJSON command, it works.

    I couldnt understand, why?
    Please help me to figure it out.

    You must be logged in to view attached files.

    Posts: 4527
    Support Staff Reply #3972


    You should initialize the chart after you got the data from AJAX request:

    $.getJSON(‘/ga/report.php’, function(data) {
    visitors = data;

    // init here the chart.

    If you need any further clarifications please let us know.


You must be logged in to reply to this topic.