adding a pie chart by using the embedded data - javascript

I have three embedded data ED1, ED2, ED3 in my survey. They are numbers generated by math operations. I want to use those embedded data to show the respondents a pie chart based on the calculated embedded data values.
Could you help me how can i do that by using JavaScript in Qualtrics.
Thank you

You can add javascript libraries to Qualtrics by either embedding it in your template (preferred) or the html for one of your questions. From there, it's matter of selecting your preferred charting library (e.g., chart.js), linking it to your template, pulling your embedded data variables, and letting your selected library work it's magic.
The details are going to depend on which library you select.

Related

Embedding a dynamically changing R htmlwidget into a webpage

I need to use javascript-visualization packages in R like plotly and dygraphs and show the generated plots in my web page. The generated plot needs to be updated whenever the user interacts with other HTML elements in the webpage.
I have considered and have been disappointed in the Shiny server way to integrate the UI with plotting because it limits the developer's way of having full control over the UI using javascript, otherwise it's great.
Until now I have found that I can embed the htmlwidgets file in an IFrame to show the plot, but as discussed in this post: Embedding an R htmlwidgets into existing webpage, and in general, Iframes are considered bad practice, and thus would like to do this: Answer to the above-linked question.
But the problem is that every time I regenerate a plot using plotly or dygraph and save them using saveWidget() function of htmlwidgets package the generated plot file has a different id for the div of the plot generated. How can I embed a div present in an external HTML file(with srcs to even more html/css/js files) whose id is changing every time I generate the plot file?
I would suggest I frame to pass form and using Shiny. That would not result in recreating the wheel effort in using a ready made server.

Creating charts in java or javascript without images

One of the project requirements for my new java web project is to have dynamic charts that will load really fast.
While in discussion , it was asked if we could implement charts without using images ie without loading jpg, png files etc. Also files like pdf cannot be used.
Basically my question is
Can charts be implemented in jsp/javascript without using images,pdf etc ?
ie even api's used should not provide end result as image,or pdf etc.
I did not say no right away , as I have implemented charts in console applications in C on screen. Can we do something like that on a webpage ? ie show a graph by drawing on screen dots,lines,circles etc.But it should be possible inside a div ?
PS : Comments and answer from Lucien Stals helped to understand that the technology i was looking for was svg.
I am looking for some nudging in the right direction from some of the experienced java , javascript programmers in SO.
Many JavaScript chart libraries exist that render in HTML5 on your page. You can probably find one that meets other requirements or wishes of your team, since each have feature areas in which they excel. http://www.zingchart.com has also been adding many ways to include them in your charts if you decide to go with something other than vanilla JavaScript (jQuery, Angular, etc). Full disclosure: I'm on the ZingChart team. I can help you weigh the pro's and con's if you find a few that catch your interest.
A simple bar chart would be easy enough to create with DIVs and CSS.
Anything more complicated and I think you are talking SVG, which could be drawn using http://raphaeljs.com/, or maybe http://d3js.org/ .
Also look at the HTML5 canvas element.
I would suggest to use Google Chart Framework. I did use it in past for my project and it is good.
You can check highcharts http://www.highcharts.com/ . This can be integrated easily with your javascript .
Most of this js chart plugins expects data in array or json format and can dynamically render the charts.Easy to integrate in the web pages
jgccharts.js Jquery charts
jquery charts plugin

How to create graph in an HTML file using the jOrgChart?

Is it possible to draw a graph in an HTML file using the jOrgChart jQuery plugin, as in the example below?
If that's not possible then what are other options are available for drawing such chart, without using Drupal?
Assuming that this question is about the jOrgChart jQuery plugin, and assuming that Drupal is an option to consider, then for sure it's worth considering the jOrgChart sandbox ... at least that's where I'll start from if some day I want to start using jOrgChart in Drupal.
For other Drupal based alternatives for charting, checkout the Comparison of charting modules I created (note to myself: add this jOrgChart plugin and sandbox project to that comparison).
Curious to hear to what extend this attempt is an answer to this charting question ...
PS: Checkout my profile for more details about my charting background, etc.
Very easy to use given a nested unordered list element.
Drag-and-drop functionality allows reordering of the tree and
underlying structure.
Showing/hiding a particular branch of the tree by clicking on the
respective node.
Nodes can contain any amount of HTML except and . Easy to
style.
You can specify that sub-trees should start collapsed, which is
useful for very large trees
for html
https://dl.dropboxusercontent.com/u/4151695/html/jOrgChart/example/example.html

How do I hide the code for the chart data in highcharts?

I have seen websites that use jquery chart programs and if you do a right click -> view source you cannot see the data for their charts.
How do I do this with highcharts?
Since the code is javascript I figure it's a matter of hiding javascript. Can you load it from an external file? Or if ther is any other way of keeping the data from appearing in the source in highcharts how do you do it?
What is the purpose of hiding code, when someone can compare your chart with i.e public and reproduce your chart ?
Best bet is to load the chart via ajax.
But this is not anything that can be considered remotely 'secure', nor is there any way to present your data on the web and yet not let people see your data on the web...
In fact, the concept is quite silly...

Displaying a Multidimensional Array in a Bar Graph (in JavaScript)?

Is it possible for someone to give me a few pointers on how to display a multidimensional array in the form of a bar graph?
The array is multidimensional, with three elements in each part - and the elements are determined by a HTML form.
So if it is possible to display this kind of array in the form of a bar graph in Javascript on a standard HTML site, i'd appreciate some help!
Thanks
Check out Flot and MilkChart. The former extends jQuery, the latter MooTools. Both use the canvas element, which is now supported by all the major browsers (even IE with the inclusion of an extra script). Take a look at the reputation tab in your stackoverflow profile to see it in use. I've used Flot (haven't tried MilkChart) in a project before and while the manner you pass data into it can seem a bit unintuitive at first, you'll find that it is actually pretty powerful for a non-flash charting solution. Flot also defines custom events that you can use to define chart interactions. Flot supports stacked bar charts with a plugin, and I believe you can do clustered bar charts with it as well.
You could always go with some sort of declarative graphics solution using div elements as bars in a graph, but that's not as easy or consistent across browsers as drawing charts with the canvas.
If you are leery of either of those solutions you could send the data to a service to return a static image. The Google Charting API supports grouped bar charts, or you could use some service you host yourself.
My recommendation is the first solution using the HTML canvas, specifically leveraging Flot since that is the library I have the most experience with and can vouch for. Maybe someone else has some comments about MilkChart.
EDIT:
Another library I forgot to mention is PlotKit which extends MochiKit. I haven't used it but apparently it supports not only the charting using the canvas element but also supports charting using SVG. Scalable Vector Graphics offer you another declarative graphics option beyond hacking a solution using HTML, however I'm not sure how crossbrowser an SVG based solution would be (particularly in IE).
EDIT:
Here is a jQuery plugin which charts using div elements. I personally don't like this option because I think it is more complex and less easily configurable than some of the other options. I feel like using HTML elements to create complex declarative graphics (while impressive) is sort of a hacked solution and will, in my experience, cause problems at some point.
According to the documentation, both Flot and MilkChart only work in IE if the excanvas extension is installed.
For greater portability, I suggest checking out the Google Visualization API which is incredibly simple to use and has many different display possibilities. Visualizations are rendered as either flash elements (interactive) or as plain images (static).

Categories

Resources