Skip to content

Missing Text Elements (e.g. Title, and Legends) when exporting as HTML #680

@sssilvar

Description

@sssilvar

Describe the bug

Title, text, and label elements are not visible when exporting to HTML, either from the server or using pyvista.Plotter.export_html. The same issue occurs with vtksz, from which as far as I understood the HTML is generated.

To Reproduce

Steps to reproduce the behavior:

  1. Run the provided script.
  2. Open Served app (text elements will be present).
  3. Export as HTML.
  4. Observe that the title, text, and legend labels are missing.

⚠️ Can also be reproduces with pyvista.Plotter.export_html.

Code

"""Script to report bug - text elements not showing on HTML exports."""

import pyvista as pv
from pyvista import examples
from pyvista.trame.ui import plotter_ui
from trame.app import get_server
from trame.ui.vuetify3 import SinglePageLayout

pv.OFF_SCREEN = True


server = get_server()
state, ctrl = server.state, server.controller
mesh = examples.load_random_hills()

pl = pv.Plotter()
pl.add_mesh(mesh, label="mesh")
pl.add_text("My Sphere Plot", position="upper_edge", font_size=24, color="black")
pl.add_legend()

with SinglePageLayout(server) as layout:
    with layout.content:
        view = plotter_ui(pl)

if __name__ == "__main__":
    server.start()

Expected behavior

The exported HTML should include all text elements, including the title, text annotations, and legend labels.

Screenshots

Served app (or pyvista.Plotter.show():

Image

Exported HTML:

Image

** Environment **


--------------------------------------------------------------------------------
  Date: Fri Feb 07 11:42:30 2025 CET

                  OS : Darwin (macOS 15.2)
              CPU(s) : 8
             Machine : arm64
        Architecture : 64bit
                 RAM : 16.0 GiB
         Environment : Python
         File system : apfs

  Python 3.10.15 (main, Dec  5 2024, 12:36:43) [Clang 16.0.0
  (clang-1600.0.26.4)]

             pyvista : 0.44.2
                 vtk : 9.3.1
               numpy : 1.24.4
          matplotlib : 3.9.3
              scooby : 0.10.0
               pooch : 1.8.2
              pillow : 11.0.0
             IPython : 8.30.0
               scipy : 1.14.1
                tqdm : 4.67.1
               trame : 3.8.0
        trame_client : 3.5.2
        trame_server : 3.3.0
           trame_vtk : 2.8.14
       trame_vuetify : 2.8.1
        nest_asyncio : 1.6.0
--------------------------------------------------------------------------------

Platform:

Device:

  • Desktop
  • Mobile

OS:

  • Windows
  • MacOS
  • Linux
  • Android
  • iOS

Browsers Affected:

  • Chrome
  • Firefox
  • Microsoft Edge
  • Safari
  • Opera
  • Brave
  • IE 11

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions