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

[bug] plotly doesn't work w/ python #20

Closed
Almenon opened this issue Feb 24, 2020 · 3 comments
Closed

[bug] plotly doesn't work w/ python #20

Almenon opened this issue Feb 24, 2020 · 3 comments

Comments

@Almenon
Copy link
Contributor

Almenon commented Feb 24, 2020

I get an error when trying to generate a plotly graph w/ python:

from json import dumps
import random

while(True):
    data = []
    value = 0
    for i in range(10000):
        delta = 1 if random.random() > .5 else -1
        data.append(value)
        value += delta

    json_data = dumps({
	    "kind": { "plotly": True },
	    "data": data
    })
    print('done')

I evaluated json_data in the debug visualizer console and there was just a blank screen. I opened up the webview console logs and I found this:

bootstrap:105 Uncaught (in promise) ChunkLoadError: Loading chunk 2 failed.
(error: )
    at Function.i.e (http://localhost:52480/main.js:1:724)
    at Object.loader (http://localhost:52480/main.js:35:1189248)
    at e.load (http://localhost:52480/main.js:6:12838)
    at http://localhost:52480/main.js:6:13195
    at http://localhost:52480/main.js:236:538979
    at e.fire (http://localhost:52480/main.js:1:63465)
    at e._getOrCreateMode (http://localhost:52480/main.js:236:451829)
    at e._createModeAndGetLanguageIdentifier (http://localhost:52480/main.js:236:451509)
    at t._selector (http://localhost:52480/main.js:236:451123)
    at new t (http://localhost:52480/main.js:236:449819)
bootstrap:105 Uncaught (in promise) ChunkLoadError: Loading chunk 64 failed.
(error: )
    at Function.i.e (http://localhost:52480/main.js:1:724)
    at p (http://localhost:52480/main.js:35:2001026)
    at http://localhost:52480/main.js:35:2001448
    at http://localhost:52480/main.js:236:538979
    at e.fire (http://localhost:52480/main.js:1:63465)
    at e._getOrCreateMode (http://localhost:52480/main.js:236:451829)
    at e._createModeAndGetLanguageIdentifier (http://localhost:52480/main.js:236:451509)
    at t._selector (http://localhost:52480/main.js:236:451123)
    at new t (http://localhost:52480/main.js:236:449819)
    at e.create (http://localhost:52480/main.js:236:451045)
ExpressionInput.tsx:105 json_data
factory.js:104 Error while plotting: TypeError: Cannot use 'in' operator to search for 'bardir' in 0
    at Object.n.cleanData (plotly.js:110967)
    at Object.n.plot (plotly.js:111744)
    at Object.n.newPlot (plotly.js:112273)
    at Object.n.react (plotly.js:114298)
    at factory.js:89
(anonymous) @ factory.js:104
Promise.catch (async)
value @ factory.js:99
value @ factory.js:115
yl @ react-dom.production.min.js:251
t.unstable_runWithPriority @ scheduler.production.min.js:18
Gi @ react-dom.production.min.js:120
bl @ react-dom.production.min.js:244
ol @ react-dom.production.min.js:223
(anonymous) @ react-dom.production.min.js:121
t.unstable_runWithPriority @ scheduler.production.min.js:18
Gi @ react-dom.production.min.js:120
Qi @ react-dom.production.min.js:121
Yi @ react-dom.production.min.js:120
al @ react-dom.production.min.js:224
Je @ mobx.module.js:1905
Xe @ mobx.module.js:1881
Ge @ mobx.module.js:1581
e.reportChanged @ mobx.module.js:258
t.setNewValue @ mobx.module.js:1066
e.write @ mobx.module.js:4032
set @ mobx.module.js:4239
updateState @ Model.ts:186
(anonymous) @ TypedChannelContracts.js:127
handleNotification @ TypedChannel.js:210
handleNotification @ TypedChannel.js:53
processRequestOrNotification @ StreamBasedChannel.js:54
(anonymous) @ StreamBasedChannel.js:16
onMessage @ MessageStream.js:17
e.onmessage @ index.js:34
@hediet
Copy link
Owner

hediet commented Feb 24, 2020

Your data field of the json object does not match the plotly data type.
This json does:

{ kind: { plotly: true }, data: [
          {
            "x": [1, 2, 3],
            "y": [2, 6, 3],
            "type": "scatter",
            "mode": "lines+markers",
            "marker": { "color": "red" },
          }
] }

@Almenon
Copy link
Contributor Author

Almenon commented Feb 25, 2020

Ah, that makes sense. I thought it would work because the script was a direct conversion of https://github.com/hediet/vscode-debug-visualizer/blob/master/demo/js/src/demo_random-walks.ts to python. But like you said in the other issue python doesn't have the extractors necessary to automatically make sure the schema matches. Or at least not yet.

@hediet
Copy link
Owner

hediet commented Feb 26, 2020

Yes. Closing this as it works as intended. Data Extractors for Python can be tracked in a separate issue.

@hediet hediet closed this as completed Feb 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants