Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt WebKit
  4. QtWebView + Javascript Visualization Library
Forum Updated to NodeBB v4.3 + New Features

QtWebView + Javascript Visualization Library

Scheduled Pinned Locked Moved Qt WebKit
4 Posts 3 Posters 4.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q Offline
    Q Offline
    quantumavatar
    wrote on 10 Feb 2013, 00:23 last edited by
    #1

    Hi all, had this posted in the wrong forum folder so sorry for the duplicate ...

    So "D3":https://github.com/mbostock/d3/wiki/Gallery is a visualization library written in javascript for data visualizations on the web.

    The goal is to try and expand qml's repertoire by allowing access to D3 via WebKit.

    I can display a D3 graph (local html file) in a QtWebView via qml very simply.

    @
    WebView
    {
    url: "../../d3/scatter/index.html"
    preferredWidth: window.height
    preferredHeight: window.width
    smooth: true
    }
    @

    On the D3 side we have a few files:
    @
    index.html // Basically just calls the d3 javascript
    d3code.js // Javascript code
    d3.v3.js // The D3 library
    @

    The question is how do i send plot data to d3code.js from qml/qt or is it not possible because it will be in its own thread running in the webview. I came across the "QtWebKit-Bridge":http://doc.qt.digia.com/4.7/qtwebkit-bridge.html but I havent figured out yet if it will work for this setup. Any advice? Pointers? So i know im going in the right direction.

    Thanks guys and Long live Qt!

    1 Reply Last reply
    0
    • E Offline
      E Offline
      eclarkso
      wrote on 26 Oct 2013, 03:45 last edited by
      #2

      Months later... did this work out for you? I'm investigating doing something similar (no QML, just a QtWebView widget).

      1 Reply Last reply
      0
      • D Offline
        D Offline
        dvolosnykh
        wrote on 6 Oct 2014, 17:24 last edited by
        #3

        Hi, guys! Any success with integration of D3.js so far?

        1 Reply Last reply
        0
        • E Offline
          E Offline
          eclarkso
          wrote on 6 Oct 2014, 18:00 last edited by
          #4

          We coincidentally just started down this path again after my response on a different project (which at yet doesn't need dynamic data, and we aren't using QML).

          So we haven't yet gotten to the original question--sending new data to D3 dynamically--but the basic proof-of-concept embedding of D3.js in a Qt web object (either QWebView or QGraphicsWebView) is very simple: just call XXXWebView::setURL() with the path (either local file or web URL) to your HTML source that uses D3.

          The bad news is that dynamically-updating D3 stuff (such as force-directed layouts, but to a lesser extent hover events, etc.) does not seem to perform well in the Qt Webkit view, even on 5.3. The frame rate looks to be several multiples slower than a Webkit browser (this is using the QGraphicsWebView, but I haven't found anything to suspect QWebView would be different).

          As for using the WebKit Bridge, we don't know yet. Our use case is simple enough that we could just write new data to a file, and template/rewrite our JS in that event, and reload the HTML from Qt, so that might be an option if your use case is simple or not mission-critical.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved