1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Need help with JS in google chart -will paypal you a few bucks

Discussion in 'Programming' started by -jay-, Mar 25, 2019.

  1. #1
    Will paypal someone a few bucks if they can help me with this.

    I have a php page that gets an array back in a response. Its JSON.
    I want to display that data in a google table chart. here is the google chart.
    https://developers.google.com/chart/interactive/docs/gallery/table



    I echo'd out the response as an example. This is it.

    [{
    "ts":1552903183141,
    "sk":"testing123",
    "val":0,
    "qual":0,
    "tg":"hb"
    },{
    "ts":1552903173141,
    "sk":"testing123",
    "val":0,
    "qual":0,
    "tg":"hb"
    },{
    "ts":1552903163141,
    "sk":"testing123",
    "val":0,
    "qual":0,
    "tg":"hb"
    },{
    "ts":1552903153141,
    "sk":"testing123",
    "val":0,
    "qual":0,
    "tg":"hb"
    },{
    "ts":1552903143141,
    "sk":"testing123",
    "val":0,
    "qual":0,
    "tg":"hb"
    },{
    "ts":1552903133141,
    "sk":"testing123",
    "val":0,
    "qual":0,
    "tg":"hb"
    },{
    "ts":1552903123141,
    "sk":"testing123",
    "val":0,
    "qual":0,
    "tg":"hb"
    },{
    "ts":1552903113141,
    "sk":"testing123",
    "val":0,
    "qual":0,
    "tg":"hb"
    },{
    "ts":1552903103141,
    "sk":"testing123",
    "val":0,
    "qual":0,
    "tg":"hb"
    }]

    This is the Javascript, tried a bunch of things cant get it to work.
    I want just a table that displays all the rows with the column headers.

    I dont know what to put in the add rows.




    <html>
    <head>
    <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
    <script type="text/javascript">
    google.charts.load('current', {'packages':['table']});
    google.charts.setOnLoadCallback(drawTable);
    function drawTable() {
    var data = new google.visualization.DataTable();
    data.addColumn('number', 'ts');
    data.addColumn('string', 'sk');
    data.addColumn('number', 'val');
    data.addColumn('number', 'qual');
    data.addColumn('string', 'tg');
    data.addRows([


    ]);

    var table = new google.visualization.Table(document.getElementById('table_div'));

    table.draw(data, {showRowNumber: true, width: '50%', height: '50%'});
    }
    </script>
    </head>
    <body>
    </br>
    <div id="table_div"></div>
    </body>
    </html>
     
    -jay-, Mar 25, 2019 IP
    StaSen likes this.
  2. -jay-

    -jay- Well-Known Member

    Messages:
    2,311
    Likes Received:
    47
    Best Answers:
    0
    Trophy Points:
    160
    As Seller:
    100% - 8
    As Buyer:
    100% - 0
    #2
    anyone that is good with JS ?
     
    -jay-, Mar 26, 2019 IP