Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Datetime fields not plotted #368

Open
miili opened this issue Jan 13, 2025 · 0 comments
Open

Datetime fields not plotted #368

miili opened this issue Jan 13, 2025 · 0 comments
Labels

Comments

@miili
Copy link

miili commented Jan 13, 2025

Describe the bug

Plotly 4.2.0 does not plot QDateTime anymore.

Traceback (most recent call last):
  File "/home/.../.local/share/QGIS/QGIS3/profiles/default/python/plugins/DataPlotly/gui/plot_settings_widget.py", line 1480, in UpdatePlot
    self.create_plot()
  File "/home/.../.local/share/QGIS/QGIS3/profiles/default/python/plugins/DataPlotly/gui/plot_settings_widget.py", line 1428, in create_plot
    self.plot_path = plot_factory.build_figure()
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/.../.local/share/QGIS/QGIS3/profiles/default/python/plugins/DataPlotly/core/plot_factory.py", line 701, in build_figure
    f.write(self.build_html(config))
            ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/.../.local/share/QGIS/QGIS3/profiles/default/python/plugins/DataPlotly/core/plot_factory.py", line 660, in build_html
    raw_plot += plotly.offline.plot(fig, output_type='div', include_plotlyjs=False, show_link=False,
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/plotly/offline/offline.py", line 600, in plot
    return pio.to_html(
           ^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/plotly/io/_html.py", line 142, in to_html
    jdata = to_json_plotly(fig_dict.get("data", []))
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/plotly/io/_json.py", line 171, in to_json_plotly
    return _safe(orjson.dumps(cleaned, option=opts).decode("utf8"), _swap_orjson)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Type is not JSON serializable: QDateTime

To Reproduce
Use a QDateTime field in the plot.

Desktop (please complete the following information):

  • OS: Linux
  • QGIS release 3.34.13-Prizen
  • DataPlotly release 4.2.0
@miili miili added the bug label Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant