Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt6 QWebEngine Plotly js: Uncaught Error: Something went wrong with axis scaling
QtWS25 Last Chance

Qt6 QWebEngine Plotly js: Uncaught Error: Something went wrong with axis scaling

Scheduled Pinned Locked Moved Unsolved General and Desktop
qwebengineview
4 Posts 3 Posters 429 Views
  • 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.
  • J Offline
    J Offline
    Johnsonq
    wrote on last edited by
    #1

    I.m using Qt 6.6.3, VS 2022, python 311 to plot something like 3D image. When I create QWebEngineView object like

    ui.setupUi(this);
    
    webEnginePlot = new QWebEngineView(tabPlot);
    webEnginePlot->setObjectName("webEnginePlot");
    webEnginePlot->setUrl(QUrl(QString::fromUtf8("about:blank")));
    

    MainWindow include

    [ MenuBar ]
    [QDockWidget QStackedWidget]

    QDockWidget on the left, QStackedWidget on the right. QDockWidget include QTreeView, QStackedWidget include QWebEngine

    Question 1: Why the whole surface flashing(or hide, or white screen) 1 or 2 seconds? I found out it is loading QtWebEngineProcessd.exe

    When I try to new QWebEngineView() before QTreeView init, nothing wrong. And when I init QTreeView first, then new QWebEngineView(), and the whole soft began to flashing(or hide, or white screen) to loading the QtWebEngineProcessd;

    Question 2: I use C++ PythonAPI to draw a plot using plotly, and come out a file like a.html, and then I load the html file with QWebEngineView, and it showed up "js: Uncaught Error: Something went wrong with axis scaling"

    QUrl localUrl = QUrl::fromLocalFile(htmlFile);
    ui.webEnginePlot->setUrl(localUrl);
    ui.webEnginePlot->show();
    

    But when I enter the QWidget and click my button to draw it again, and it works. Why when initializing, it will report an error?

    How to solve the problem. Help me please!

    T A 2 Replies Last reply
    0
    • J Johnsonq

      I.m using Qt 6.6.3, VS 2022, python 311 to plot something like 3D image. When I create QWebEngineView object like

      ui.setupUi(this);
      
      webEnginePlot = new QWebEngineView(tabPlot);
      webEnginePlot->setObjectName("webEnginePlot");
      webEnginePlot->setUrl(QUrl(QString::fromUtf8("about:blank")));
      

      MainWindow include

      [ MenuBar ]
      [QDockWidget QStackedWidget]

      QDockWidget on the left, QStackedWidget on the right. QDockWidget include QTreeView, QStackedWidget include QWebEngine

      Question 1: Why the whole surface flashing(or hide, or white screen) 1 or 2 seconds? I found out it is loading QtWebEngineProcessd.exe

      When I try to new QWebEngineView() before QTreeView init, nothing wrong. And when I init QTreeView first, then new QWebEngineView(), and the whole soft began to flashing(or hide, or white screen) to loading the QtWebEngineProcessd;

      Question 2: I use C++ PythonAPI to draw a plot using plotly, and come out a file like a.html, and then I load the html file with QWebEngineView, and it showed up "js: Uncaught Error: Something went wrong with axis scaling"

      QUrl localUrl = QUrl::fromLocalFile(htmlFile);
      ui.webEnginePlot->setUrl(localUrl);
      ui.webEnginePlot->show();
      

      But when I enter the QWidget and click my button to draw it again, and it works. Why when initializing, it will report an error?

      How to solve the problem. Help me please!

      T Offline
      T Offline
      TravisBrowne
      wrote on last edited by TravisBrowne
      #2

      @Johnsonq said in [Qt6 QWebEngine Plotly js: Uncaught Error: Something went wrong with axis scaling compass mobile](/post/806578):

      I.m using Qt 6.6.3, VS 2022, python 311 to plot something like 3D image. When I create QWebEngineView object like

      ui.setupUi(this);
      
      webEnginePlot = new QWebEngineView(tabPlot);
      webEnginePlot->setObjectName("webEnginePlot");
      webEnginePlot->setUrl(QUrl(QString::fromUtf8("about:blank")));
      

      MainWindow include

      [ MenuBar ]
      [QDockWidget QStackedWidget]

      QDockWidget on the left, QStackedWidget on the right. QDockWidget include QTreeView, QStackedWidget include QWebEngine

      Question 1: Why the whole surface flashing(or hide, or white screen) 1 or 2 seconds? I found out it is loading QtWebEngineProcessd.exe

      When I try to new QWebEngineView() before QTreeView init, nothing wrong. And when I init QTreeView first, then new QWebEngineView(), and the whole soft began to flashing(or hide, or white screen) to loading the QtWebEngineProcessd;

      Question 2: I use C++ PythonAPI to draw a plot using plotly, and come out a file like a.html, and then I load the html file with QWebEngineView, and it showed up "js: Uncaught Error: Something went wrong with axis scaling"

      QUrl localUrl = QUrl::fromLocalFile(htmlFile);
      ui.webEnginePlot->setUrl(localUrl);
      ui.webEnginePlot->show();
      

      But when I enter the QWidget and click my button to draw it again, and it works. Why when initializing, it will report an error?

      How to solve the problem. Help me please!

      Hi Johnsonq,

      The flashing or white screen issue is likely due to QWebEngineView initializing. Try creating it as early as possible to reduce conflicts with other components.

      The axis scaling error might be a timing issue. Ensure your JavaScript code executes after the DOM is fully loaded. Adding proper event listeners and verifying resource availability could solve the problem.

      J 1 Reply Last reply
      0
      • T TravisBrowne

        @Johnsonq said in [Qt6 QWebEngine Plotly js: Uncaught Error: Something went wrong with axis scaling compass mobile](/post/806578):

        I.m using Qt 6.6.3, VS 2022, python 311 to plot something like 3D image. When I create QWebEngineView object like

        ui.setupUi(this);
        
        webEnginePlot = new QWebEngineView(tabPlot);
        webEnginePlot->setObjectName("webEnginePlot");
        webEnginePlot->setUrl(QUrl(QString::fromUtf8("about:blank")));
        

        MainWindow include

        [ MenuBar ]
        [QDockWidget QStackedWidget]

        QDockWidget on the left, QStackedWidget on the right. QDockWidget include QTreeView, QStackedWidget include QWebEngine

        Question 1: Why the whole surface flashing(or hide, or white screen) 1 or 2 seconds? I found out it is loading QtWebEngineProcessd.exe

        When I try to new QWebEngineView() before QTreeView init, nothing wrong. And when I init QTreeView first, then new QWebEngineView(), and the whole soft began to flashing(or hide, or white screen) to loading the QtWebEngineProcessd;

        Question 2: I use C++ PythonAPI to draw a plot using plotly, and come out a file like a.html, and then I load the html file with QWebEngineView, and it showed up "js: Uncaught Error: Something went wrong with axis scaling"

        QUrl localUrl = QUrl::fromLocalFile(htmlFile);
        ui.webEnginePlot->setUrl(localUrl);
        ui.webEnginePlot->show();
        

        But when I enter the QWidget and click my button to draw it again, and it works. Why when initializing, it will report an error?

        How to solve the problem. Help me please!

        Hi Johnsonq,

        The flashing or white screen issue is likely due to QWebEngineView initializing. Try creating it as early as possible to reduce conflicts with other components.

        The axis scaling error might be a timing issue. Ensure your JavaScript code executes after the DOM is fully loaded. Adding proper event listeners and verifying resource availability could solve the problem.

        J Offline
        J Offline
        Johnsonq
        wrote on last edited by
        #3

        @TravisBrowne
        Thanks for your answer!
        I can not understand the answer that you said of the Question 2.
        I use the PythonAPI to call a python-script,then it would create a html file like "plot.html", the plot contains 3D axis draw by python-script.
        It is a Three-dimensional surface diagram, created by python like the code below

        import plotly.graph_objs as go
        import numpy as np
        x = np.linspace(-5, 5, 100)
        y = np.linspace(-5, 5, 100)
        x, y = np.meshgrid(x, y)
        z = np.sin(np.sqrt(x**2 + y**2))
        surface = go.Surface(
            x=x,  
            y=y,
            z=z,  
            opacity=0.7,  
            showscale=False  
        )
        fig = go.Figure(data=[surface], layout=go.Layout(scene=go.Scene(xaxis_title='X', yaxis_title='Y', zaxis_title='Z')))
        fig.show()
        

        I only use the code below to load the plot in my QWebEngineView.

        QUrl localUrl = QUrl::fromLocalFile(htmlFile);
        ui.webEnginePlot->setUrl(localUrl);
        ui.webEnginePlot->show();
        

        All settings is default.
        TravisBrowne::"The axis scaling error might be a timing issue. Ensure your JavaScript code executes after the DOM is fully loaded. Adding proper event listeners and verifying resource availability could solve the problem"
        What should I do according to your anwser ? How should I ensure your JavaScript code executes after the DOM is fully loaded or something ?
        Please help me.

        1 Reply Last reply
        0
        • J Johnsonq

          I.m using Qt 6.6.3, VS 2022, python 311 to plot something like 3D image. When I create QWebEngineView object like

          ui.setupUi(this);
          
          webEnginePlot = new QWebEngineView(tabPlot);
          webEnginePlot->setObjectName("webEnginePlot");
          webEnginePlot->setUrl(QUrl(QString::fromUtf8("about:blank")));
          

          MainWindow include

          [ MenuBar ]
          [QDockWidget QStackedWidget]

          QDockWidget on the left, QStackedWidget on the right. QDockWidget include QTreeView, QStackedWidget include QWebEngine

          Question 1: Why the whole surface flashing(or hide, or white screen) 1 or 2 seconds? I found out it is loading QtWebEngineProcessd.exe

          When I try to new QWebEngineView() before QTreeView init, nothing wrong. And when I init QTreeView first, then new QWebEngineView(), and the whole soft began to flashing(or hide, or white screen) to loading the QtWebEngineProcessd;

          Question 2: I use C++ PythonAPI to draw a plot using plotly, and come out a file like a.html, and then I load the html file with QWebEngineView, and it showed up "js: Uncaught Error: Something went wrong with axis scaling"

          QUrl localUrl = QUrl::fromLocalFile(htmlFile);
          ui.webEnginePlot->setUrl(localUrl);
          ui.webEnginePlot->show();
          

          But when I enter the QWidget and click my button to draw it again, and it works. Why when initializing, it will report an error?

          How to solve the problem. Help me please!

          A Offline
          A Offline
          alenmack
          wrote on last edited by alenmack
          #4

          @Johnsonq said in Qt6 QWebEngine Plotly js: Uncaught Error : Something went wrong with axis scaling:

          I.m using Qt 6.6.3, VS 2022, python 311 to plot something like 3D image. When I create QWebEngineView object like

          ui.setupUi(this);
          
          webEnginePlot = new QWebEngineView(tabPlot);
          webEnginePlot->setObjectName("webEnginePlot");
          webEnginePlot->setUrl(QUrl(QString::fromUtf8("about:blank")));
          

          MainWindow include

          [ MenuBar ]
          [QDockWidget QStackedWidget]

          QDockWidget on the left, QStackedWidget on the right. QDockWidget include QTreeView, QStackedWidget include QWebEngine

          Question 1: Why the whole surface flashing(or hide, or white screen) 1 or 2 seconds? I found out it is loading QtWebEngineProcessd.exe

          When I try to new QWebEngineView() before QTreeView init, nothing wrong. And when I init QTreeView first, then new QWebEngineView(), and the whole soft began to flashing(or hide, or white screen) to loading the QtWebEngineProcessd;

          Question 2: I use C++ PythonAPI to draw a plot using plotly, and come out a file like a.html, and then I load the html file with QWebEngineView, and it showed up "js: Uncaught Error: Something went wrong with axis scaling"

          QUrl localUrl = QUrl::fromLocalFile(htmlFile);
          ui.webEnginePlot->setUrl(localUrl);
          ui.webEnginePlot->show();
          

          But when I enter the QWidget and click my button to draw it again, and it works. Why when initializing, it will report an error?

          How to solve the problem. Help me please!

          The flashing or white screen issue when initializing QWebEngineView is likely due to the time it takes to load the QtWebEngineProcessd.exe. To avoid this, try initializing QWebEngineView before the QTreeView, as you’ve noticed it prevents the flashing. For the axis scaling error when loading the plotly HTML file, this might be due to the JavaScript not fully executing during the initial load. To resolve this, ensure that the HTML and its resources are fully loaded before rendering. You can also try reloading the page after a short delay or implement a callback function to reattempt drawing after the first load.

          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