Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Google Table Chart not showing

  • ordogz
  • ordogz's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
4 years 7 months ago - 4 years 7 months ago #188835 by ordogz
Google Table Chart not showing was created by ordogz
Hi,

I've added to my survey a Google Table Chart script, which represents some answers completed in an earlier question by the user.
The script is added to a "Text Display" question, which is inserted on another page as {Qtable} to show the information.

The information from where the script should take the data is a "Multiple Short Text" question type(named: Personal), with 4 subquestions.

I want to represent the answers filled in those four subquestions(SQ001, SQ002, SQ003, SQ004) in a javascript type Google Table.



Below is the script:
Code:
<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('string', 'Client details1');
        data.addColumn('string', 'Client Details2');
        data.addColumn('string', 'Observations');
        data.addRows([
            ['Client Name', {Personal_SQ001}, 'obs1'],
            ['Industry Sector', {Personal_SQ005}, 'obs2'],
            ['Date', {Date}, 'obs3'],
            ['Assessor(s)', {Personal_SQ006}, 'obs4'],
            ['Purpose of Assessment', {Personal_SQ007}, 'obs5']
        ]);
 
        var table = new google.visualization.Table(document.getElementById('table_div'));
 
        table.draw(data, {
          showRowNumber: true, width: '100%', height: '100%'
        });
      }
    </script>
<div id="table_div"> </div>
 

I dont't know why it doesn't show the values form the "Personal" Multiple Short Text subquestions?

I have to mention, that I use another Google Bar Chart script type, for representing some score data, which works perfectly fine.
Last edit: 4 years 7 months ago by ordogz.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 7 months ago #188846 by tpartner
Replied by tpartner on topic Google Table Chart not showing
As far as I can see, those should be placed in quotes or you will get "undefined variable" errors.

Code:
['Client Name', '{Personal_SQ001}', 'obs1']

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: DenisChenu
The topic has been locked.
  • ordogz
  • ordogz's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
4 years 7 months ago #188867 by ordogz
Replied by ordogz on topic Google Table Chart not showing
Indeed, now it shows well the answers

Thank you!
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose