Infuence pie chart with variables

Hi everyone,

 

I'm working on a survey kind of project where there will be a lot of questions that sorts your personality into five types. For example based on what answers the user gives he has 60% personality type 1 35%, type 2 and 5% type 3.  

I want to visualize those result into a pie chart. I found some JavaScript based things but I can't seem to influence the results with some variables.


Could someone please help me? :)

Kind regards,
Nurdianna

34 Replies
Jon Ellinor

Hi Owen

I'm getting somewhere now. I have a pie chart. Thank you very much!

Changing the subject slightly, out of interest how would I go about creating a quiz such as the one in this link?

https://www.mindtools.com/pages/article/newHTE_88.htm

The possible answers to the questions assigned a score (1-5) and at the end the learner is given a score total.

What would be the triggers that I need to assign to each radio button and what settings would I need to apply to the results page in order to get a total score?

Thanks again for all of your help.

Jon

Media Innowijs

Jon,

You could create a trigger that gives a certain amount of points if the user chooses an answer.
This trigger is similar to the one we used for the JS piechart.

Adjust variable
Add **points** to var1
When the user clicks Submit button
If Radiobutton1 is equal to Selected

Instead of the **points** you set the points you had in mind.

Media Innowijs
Owen Holt

Lastly, this works in I.E. but does not seem to be valid for chrome.

Owen,
I thought about it and I was wondering if you published the project on a webserver or did you opened it local on your PC? Because it contains a extern JS file the project needs to be published online otherwise it would not work.

OWEN HOLT

That was exactly it. I published to our LMS and it opens fine. However, after modifying my slide to include an input form to change the variables, I ran into an issue where the new numbers are not reflected. I believe it is due to the window.onload = function() command in the code. I wonder if there is another way of triggering the function or delaying when the window loads or refreshing the iframe to get the current data....
Any ideas?

Media Innowijs

Owen,

That's great to hear that it works! 

Do you have your results on the same slide as the variable input?
As far as I know the JS script will load when the slide appears, this means he's tracking the values of the variable at that moment. When you change your variables and don't refresh the slide in some way, the results appear the same. This is why I put my result slide after the variable input.
Or you can put a button in your slide that "calculates" the results.

I hope that this helps. :)