lightweight-charts-python icon indicating copy to clipboard operation
lightweight-charts-python copied to clipboard

[BUG][webview.errors.JavascriptException] mouse moving over charts leads to JS error "Value is null" if subchart sync=True

Open nickjustincase opened this issue 5 months ago • 3 comments

Expected Behavior

moving mouse over charts during chart update is ok :)

Current Behaviour

    charts = [
        main_chart,
        main_chart.create_subchart(toolbox=True, position='top', width=0.5, height=0.5, sync=True, sync_crosshairs_only=True),
        main_chart.create_subchart(toolbox=True, position='left', width=0.5, height=0.5, sync=True, sync_crosshairs_only=True),
        main_chart.create_subchart(toolbox=True, position='right', width=0.5, height=0.5, sync=True, sync_crosshairs_only=True),
    ]

2025-07-18 01:19:01,837 - ERROR - 

🟥 JS Script Error:
Script: window.ewsjnldp.series.update({
  "time": 1673506800.0,
  "open": 17943.26,
  "high": 19117.04,
  "low": 17892.05,
  "close": 18835.48,
  "volume": 487250.4610799999
})
Error: Error [?:?]
Message: Value is null
Traceback (most recent call last):
  File "C:\Test\.venv\Lib\site-packages\lightweight_charts\chart.py", line 90, in loop
    window.evaluate_js(arg)
  File "C:\Test\.venv\Lib\site-packages\webview\window.py", line 50, in wrapper
    return function(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Test\.venv\Lib\site-packages\webview\window.py", line 487, in evaluate_js
    raise JavascriptException(result)
webview.errors.JavascriptException: {'name': 'Error', 'stack': 'Error: Value is null\n    at f (http://127.0.0.1:18665/lightweight-charts.js:7:2213)\n    at An.td (http://127.0.0.1:18665/lightweight-charts.js:7:86360)\n    at Pe.setCrosshairPosition (http://127.0.0.1:18665/lightweight-charts.js:7:159252)\n    at s (http://127.0.0.1:18665/bundle.js:1:42077)\n    at Object.d [as o] (http://127.0.0.1:18665/bundle.js:1:42410)\n    at http://127.0.0.1:18665/lightweight-charts.js:7:6631\n    at Array.forEach (<anonymous>)\n    at k.m (http://127.0.0.1:18665/lightweight-charts.js:7:6617)\n    at Object.o (http://127.0.0.1:18665/lightweight-charts.js:7:157503)\n    at http://127.0.0.1:18665/lightweight-charts.js:7:6631', 'message': 'Value is null'}
2025-07-18 01:19:01,842 - ERROR - 

🟥 JS Script Error:
Script: window.ewsjnldp.volumeSeries.update({
  "time": 1673506800.0,
  "value": 487250.4610799999,
  "color": "rgba(83,141,131,0.8)"
})
Error: Error [?:?]
Message: Value is null
Traceback (most recent call last):
  File "C:\Test\.venv\Lib\site-packages\lightweight_charts\chart.py", line 90, in loop
    window.evaluate_js(arg)
  File "C:\Test\.venv\Lib\site-packages\webview\window.py", line 50, in wrapper
    return function(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Test\.venv\Lib\site-packages\webview\window.py", line 487, in evaluate_js
    raise JavascriptException(result)
webview.errors.JavascriptException: {'name': 'Error', 'stack': 'Error: Value is null\n    at f (http://127.0.0.1:18665/lightweight-charts.js:7:2213)\n    at An.td (http://127.0.0.1:18665/lightweight-charts.js:7:86360)\n    at Pe.setCrosshairPosition (http://127.0.0.1:18665/lightweight-charts.js:7:159252)\n    at s (http://127.0.0.1:18665/bundle.js:1:42077)\n    at Object.d [as o] (http://127.0.0.1:18665/bundle.js:1:42410)\n    at http://127.0.0.1:18665/lightweight-charts.js:7:6631\n    at Array.forEach (<anonymous>)\n    at k.m (http://127.0.0.1:18665/lightweight-charts.js:7:6617)\n    at Object.o (http://127.0.0.1:18665/lightweight-charts.js:7:157503)\n    at http://127.0.0.1:18665/lightweight-charts.js:7:6631', 'message': 'Value is null'}
Image

Reproducible Example

4 Charts (1M, 1D, 1H, 5m). If sync=True in create_subchart then moving mouse over charts during chart update causes java exception. If sync=False, all good.

Environment

- OS: win11
- Library: 2.1

nickjustincase avatar Jul 17 '25 20:07 nickjustincase

4 charts as 2 line table: 0 - 1 2 - 3

nickjustincase avatar Jul 17 '25 20:07 nickjustincase

same bug,have you solved the problem?

Lsgo avatar Aug 16 '25 15:08 Lsgo

same bug,have you solved the problem?

yes. "If sync=False, all good."

nickjustincase avatar Aug 17 '25 02:08 nickjustincase