tradingview / charting-library-examples

Examples of Charting Library integrations with other libraries, frameworks and data transports
MIT License
1.33k stars 744 forks source link

How do I hide tradingview chart library errors in production build? #159

Open 2295ad opened 4 years ago

2295ad commented 4 years ago

Do I need to set any property while initializing widget in nextjs? const widgetOptions = {

        height: 3500,
        datafeed: Datafeed,
        interval: '5',//'60',
        container_id: 'tv_chart_container',
        library_path: "/static/charting_library/",
        hideVolume: false,
        style: 1,
        locale: getLanguageFromURL('lang') || 'en',
        disabled_features: ['use_localstorage_for_settings', "timeframes_toolbar", 
                    "volume_force_overlay", "left_toolbar", "show_logo_on_all_charts", 
                     "caption_buttons_text_if_possible", "header_settings", "header_chart_type", 
                   "header_indicators", "header_compare", "compare_symbol", "header_screenshot", 
                   "header_widget_dom_node", "header_saveload", "header_undo_redo", 
                    "header_interval_dialog_button", "show_interval_dialog_on_key_press", 
                     "header_symbol_search", "header_resolutions", "header_widget"],
        charts_storage_url: "https://saveload.tradingview.com",
        charts_storage_api_version: '1.1',
        client_id: 'tradingview.com',
        user_id: 'public_user_id',
        theme: location.includes("/advanced") ? "dark" : "light",
        loading_screen:  { backgroundColor: "#1a1a1a" } 
        autosize: true,
        toolbar_bg:  '#1a1a1a' ;
        overrides:
            {
                "paneProperties.background": "#1a1a1a",
                "paneProperties.vertGridProperties.color": "#1a1a1a",
                "paneProperties.horzGridProperties.color": "#1a1a1a",
                "symbolWatermarkProperties.transparency": 90,
                "scalesProperties.textColor": "#AAA",
                "scalesProperties.bgColor": "#AAA",
                "scalesProperties.fontSize": 11,
                "paneProperties.topMargin": 15,
            } ;
    }

TIA

timocov commented 4 years ago

What errors?

2295ad commented 4 years ago

Hi @timocov , Thanks for the quick response. My chart is getting rendered, but it shows these errors

Uncaught (in promise) TypeError: Cannot read property 'childNodes' of null at e.t.widgetsCount (floating-toolbars.a37519a9a72c97ec0ff1.js:3) at e.t.addWidget (floating-toolbars.a37519a9a72c97ec0ff1.js:3) at n. (floating-toolbars.a37519a9a72c97ec0ff1.js:11) at Array.forEach () at n._init (floating-toolbars.a37519a9a72c97ec0ff1.js:11) at new n (floating-toolbars.a37519a9a72c97ec0ff1.js:11) at library.b2ee7224c8cc9f809bca.js:274

TypeError: Cannot read property 'querySelector' of null at t._init (chart-widget-gui.f7226f20f800bbc6bec0.js:9) at new t (chart-widget-gui.f7226f20f800bbc6bec0.js:9) at n. (library.b2ee7224c8cc9f809bca.js:311)

timocov commented 4 years ago

What's steps to reproduce?