zauberzeug / nicegui-highcharts

MIT License
16 stars 5 forks source link

highcharts errors missingModuleFor ema #7

Open gnemoug opened 1 month ago

gnemoug commented 1 month ago

Description

When trying to display candlestick and ema indicator with highcharts, I get an error:

Error: Highcharts error #17: www.highcharts.com/errors/17/?missingModuleFor=ema

  • missingModuleFor: ema at Object. (highcharts.js:8:138) at M (highcharts.js:8:2591) at o (highcharts.js:8:61) at k.initSeries (highcharts.js:8:197051) at highcharts.js:8:212230 at Proxy.forEach () at k.firstRender (highcharts.js:8:212208) at k. (highcharts.js:8:196969) at M (highcharts.js:8:2591) at k.init (highcharts.js:8:196387)

It seems that “https://code.highcharts.com/stock/indicators/ema.js” is not loading.

my configuration:

chart = ui.highchart(
    {
        'title': {'text': 'demo'},
        'chart': {'type': 'stockChart'},
        'yAxis': [
            {
                'lineWidth': 1,
                'opposite': False,
                'title': {'text': 'bais_percent'},
                'labels': {'align': 'right', 'x': -8},
            },
            {
                'lineWidth': 1,
                'opposite': True,
                'title': {'text': 'price'},
                'labels': {'align': 'left', 'x': 8},
            },
        ],
        'series': [
            {
                'type': 'area',
                'data': data['percent'],
                'name': 'bais_percent',
                'yAxis': 0,
                'visible': True,
            },
            {
                'type': 'candlestick',
                'data': data['index'],
                'name': 'price',
                'yAxis': 1,
                'id': 'candlestick-series',
            },
            {
                'type': 'ema',
                'linkedTo': 'candlestick-series',
                'params': {'period': 3},
            },
        ],
    },
    type='stockChart',
    extras=['stock'],
).classes('w-full h-full')
falkoschindler commented 1 month ago

Thanks for reporting this issue @gnemoug!

According to the documentation https://api.highcharts.com/highstock/series.ema this series type requires https://code.highcharts.com/stock/indicators/indicators.js. But I can't find it in https://registry.npmjs.org/highcharts/-/highcharts-11.4.8.tgz, which NiceGUI is based on. Here we define what is added to the Python package: https://github.com/zauberzeug/nicegui-highcharts/blob/main/npm.json.

Does anyone have an idea how to resolve this dependency?