Qt World Summit: Register Today!

Qt WebEngine: External canvas JS library

  • I'm developing a Qt C++ GUI application and I would like to create a graph/plot using Qt WebEngine together with a external Javascript canvas library called plotly.js (website here)

    I tested this HTML + JS example source-code in my local browser. It works and display a simple 2D line chart.

            <!-- Plotly.js -->
            <script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
          <!-- Plots go in blank <div> elements. 
              You can size them in the plot layout,
              or give the div a size as shown here.
          <div id="tester" style="width:90%;height:250px;"></div>
          TESTER = document.getElementById('tester');
          Plotly.plot( TESTER, [{
              x: [1, 2, 3, 4, 5],
              y: [1, 2, 4, 8, 16] }], { 
              margin: { t: 0 } }, {showSendToCloud:true} 

    Is possible to show this canvas inside my Qt application?

    Obs.: I know that Qt have some built-in charts and I'm already using it. But now I really need to use the charts from plotly.js for another reasons.

Log in to reply