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

Plotly visualisation not displayed -Mime type application/vnd.plotly.v1+json #541

Closed
eliselavy opened this issue Apr 24, 2023 · 4 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@eliselavy
Copy link
Collaborator

Plotly visualisation is supported since here: #481

No problem with this example: https://github.com/C2DH/jdh-notebook/blob/master/examples/plotly.ipynb
https://journalofdigitalhistory.org/en/notebook-viewer/JTJGcHJveHktZ2l0aHVidXNlcmNvbnRlbnQlMkZDMkRIJTJGamRoLW5vdGVib29rJTJGbWFzdGVyJTJGZXhhbXBsZXMlMkZwbG90bHkuaXB5bmI=

But in theses articles : visualisation not displayed

http://10.240.4.179/en/article/aADj3Ljjqti2?idx=41&layer=narrative&lh=643&pidx=41&pl=hermeneutics&y=70#anchor-figure-3
Github repo: https://github.com/jdh-observer/aADj3Ljjqti2/blob/main/articleMaine.ipynb

/en/article/plotly.js:1 
Uncaught SyntaxError: Unexpected token '<'

VM123:2 
Uncaught TypeError: Cannot read properties of undefined (reading 'newPlot')
    at <anonymous>:2:248
    at Object.execCb (require.min.js:29:311)
    at $.check (require.min.js:18:423)
    at $.<anonymous> (require.min.js:23:9)
    at require.min.js:8:102
    at require.min.js:23:369
    at v (require.min.js:7:173)
    at $.emit (require.min.js:23:340)
    at $.check (require.min.js:19:403)
    at $.enable (require.min.js:23:238)




@eliselavy
Copy link
Collaborator Author

eliselavy commented Apr 26, 2023

Before:

  "outputs": [
    {
     "data": {
      "text/html": [
       "        <script type=\"text/javascript\">\n",
       "        window.PlotlyConfig = {MathJaxConfig: 'local'};\n",
       "        if (window.MathJax) {MathJax.Hub.Config({SVG: {font: \"STIX-Web\"}});}\n",
       "        if (typeof require !== 'undefined') {\n",
       "        require.undef(\"plotly\");\n",
       "        define('plotly', function(require, exports, module) {\n",
       "            /**\n",
       "* plotly.js v1.58.4\n",
       "* Copyright 2012-2020, Plotly, Inc.\n",
       "* All rights reserved.\n",
       "* Licensed under the MIT license\n",
       "*/\n",

Now:
plotly==5.9.0

Custom mimetypes used for display:
application/vnd.plotly.v1+json - Plotly JSON Schema
https://plotly.com/chart-studio-help/json-chart-schema/

 "outputs": [
    {
     "data": {
      "application/vnd.plotly.v1+json": {
       "config": {
        "plotlyServerURL": "https://plot.ly"
       },

@eliselavy eliselavy changed the title Plotly visualisation not displayed Plotly visualisation not displayed -Mime type application/vnd.plotly.v1+json Apr 26, 2023
@eliselavy
Copy link
Collaborator Author

@eliselavy investigate JupyterLab / Jupyter notebook

@eliselavy eliselavy self-assigned this May 26, 2023
eliselavy added a commit to jdh-observer/aADj3Ljjqti2 that referenced this issue May 26, 2023
@eliselavy
Copy link
Collaborator Author

No difference of output between Lab and notebook.
The notebook committed didn't contained:
" require.undef("plotly");\n",
" define('plotly', function(require, exports, module) {\n",
" /**\n",
"* plotly.js v2.18.0\n",

Committed not trusted?
Need to check if related to nbconvert

@eliselavy
Copy link
Collaborator Author

Add in the technical review check for the external library: C2DH/journal-of-digital-history-backend#172 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants