Welcome to the LimeSurvey Community Forum

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

Can I use Google Charts to graph data in Limesurvey?

  • elerega
  • elerega's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 3 months ago #244929 by elerega
Please help us help you and fill where relevant:
Your LimeSurvey version: 6.x
Own serverI have been trying to use Google Charts to graph some data in Limesurvey without success. Any tips?
Additional details: I have run a few equations summarizing the data and now I would like to graph the results of those equations in the survey.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 3 months ago #244930 by Joffm
Hi,
unfortunately you did not show us what you tried "without success"?
Nevertheless:
Here is a sample survey with an implementation of Google Charts.
 

File Attachment:

File Name: limesurvey...3843.lss
File Size:17 KB


Personally I prefer to use the "highcharts" library.

Joffm
 

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

  • elerega
  • elerega's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 3 months ago - 1 year 3 months ago #244931 by elerega
Hi Joffm,Thank you very much for the example graphs! They were very helpful in understanding how to use Google Graphs in Limesurvey.

I am stuck in loading participants’ previous answers into the graph.

For example, in your code you define the values that are displayed in the graph:
Code:
var data = google.visualization.arrayToDataTable([        ['Kenmerk', 'Belangrijkheid', { role: 'style' } ],        ['testa_firstgraph', {80}, 'color: #394165'],        ['testb_firstgraph', {20}, 'color: #0CA5AA'],        ['testc_firstgraph', {30}, 'color: #F2941A'],        ['testd_firstgraph', {40}, 'color: #E64E67']      ]);

I would like to automatically load data from participant’s previous answers (from previous formulas or arrays of the survey, for example). Is this possible to do?

If this question is out of the scope of a community forum, please accept my apologies and let me know.
Last edit: 1 year 3 months ago by elerega. Reason: Formating

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 3 months ago - 1 year 3 months ago #244932 by Joffm
You see, here is 10, 20, 30,... hard coded.
Use ExpressionScript to pipe answers to previous questions, results of your equations, etc. into the chart data.

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 1 year 3 months ago by Joffm.

Please Log in to join the conversation.

  • elerega
  • elerega's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 3 months ago #244933 by elerega
Thank you for your reply. Every time I try to use ExpressionScript to pipe answers to previous questions, the graph does not load and there is only a blank output. I am simply changing the hard coded value (e.g., {10}) for the ExpressionScript expression (e.g., {Q1}). There must be something more to it, in order to pipe answers to previous questions…

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 3 months ago #244934 by Joffm

There must be something more to it,

No, it is not.
.
Here a multiple numerical question to enter same values
 
and the result
 

But how do you expect us to help, if you only say "without success" or "the graph does not load"?
Show us what you are doing.
Send a lss export of the relevant questions.
 

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

  • elerega
  • elerega's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 3 months ago #244937 by elerega
Here is the lss export. I am struggling to use the results of two equations to create the graph. Any solution to this?
Attachments:

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 3 months ago - 1 year 3 months ago #244938 by Joffm
Hi, this is quite easy to see.
Activate the survey, enter some data and have a look at the answer table.

a. You see that in CountQ1 and in CountQ2 there is stored a text.
 
Of course this is not accepted. It is obviously not a number

b. The calculation and the chart shouldn't be on the same page.

c. If you want to display the results - as you did - use a question of type "text display"

Another thing.
You use a scale in both arrays. So you should use numerical codes instead of this silly "AO01", "AO02",...
How do you calculate a mean of "AO01" and "AO04". It is not "AO02.5"
With numerical codes "1,2,3,4,5" your equation is short like this:
{sum(that.Q1.NAOK}

 



I changed all the mentioned things.

 

File Attachment:

File Name: limesurvey...7513.lss
File Size:56 KB


Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 1 year 3 months ago by Joffm.
The following user(s) said Thank You: elerega

Please Log in to join the conversation.

  • elerega
  • elerega's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 3 months ago #244940 by elerega
Hi,

It all makes sense now… Thank you so much for your help, pedagogical approach, and patience!

Best

Please Log in to join the conversation.

Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose