3

So, I have this school project I'm doing and I needed a visualization tool for the results of some of the processing being done by the software I'm developing.

Since I'm using Qt for the software, I thought of using D3.js on top of a QtWebView widget. I'm currently testing with the Qt "Fancy browser" example a simple example of D3.js. I know that when I add Javascript in the index.html file, it works on the Fancy browser. For some reason, the Javascript used in the D3 script doesn't.

The thing is, I'm fairly new to both Qt and D3.js, and as such I don't know if I'm missing something regarding the setup to make it possible, or if it's just incorrect code.

Some doubts I had regarding this situation: - does QtWebView even support SVG elements in the HTML file? - I noticed that jQuery.js had to be added to the Fancy browser projects' resources in order for it to be evaluated by the application. As far as I could tell, this was done to enable the manipulation of the page's content using jQuery. Could it be that I have to do something similar with D3? If so, how? - It's very likely that nothing shows up because the instructions I'm giving to D3 aren't actually producing anything in the HTML file, how can I address that?

I tried searching for information online about what I'm trying to achieve, but there aren't that many sources around. I found some stuff online regarding QtWebkit and Javascript, but unfortunately it's not helping me that much.

One final note: in the machine I'm working on I can't access the web because it does not have outside access for everything. Furthermore, I can't even install a Webkit browser (like Chrome or something) for DOM inspection purposes, so it's not getting any simpler. :S

Any help would be much appreciated, thank you all!

1
  • Well, I don't really know why, and I think this is really weird, but in the source code for the HTML document, I changed from using D3.js to D3.min.js and suddenly it started working. Weird, I know.
    – Joum
    Apr 18, 2013 at 10:04

1 Answer 1

6

So, by investigating about this question I got the following conclusions:

  • QtWebView DOES support SVG elements in the HTML. I figure that this is true at least since Qt V4.7, since it is the one I'm presently using;
  • Still don't know why d3.min.js works and the "regular" d3.js doesn't;
  • D3.js doesn't have to be added to Qt's resources, calling it in the HTML file is enough.

Hope this helps anyone finding the topic.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.