Skip to content
This repository has been archived by the owner on Jul 22, 2021. It is now read-only.

TypeError: window.TradingView.onready is not a function #16

Open
ExchangeAssetsGraphs opened this issue Nov 23, 2019 · 2 comments
Open

Comments

@ExchangeAssetsGraphs
Copy link

I did it according to the instructions (https://medium.com/@jonchurch/tradingview-charting-library-js-api-setup-for-crypto-part-1-57e37f5b3d5a), but I get an error: TypeError: window.TradingView.onready is not a function

http://joxi.ru/BA0GE1VSMLgkQ2

@norasteria
Copy link

I did it according to the instructions (https://medium.com/@jonchurch/tradingview-charting-library-js-api-setup-for-crypto-part-1-57e37f5b3d5a), but I get an error: TypeError: window.TradingView.onready is not a function

http://joxi.ru/BA0GE1VSMLgkQ2

got same issue

@norasteria
Copy link

norasteria commented Dec 3, 2019

I did it according to the instructions (https://medium.com/@jonchurch/tradingview-charting-library-js-api-setup-for-crypto-part-1-57e37f5b3d5a), but I get an error: TypeError: window.TradingView.onready is not a function

http://joxi.ru/BA0GE1VSMLgkQ2

Hi !

I got the same problem, I'm using tradingview v1.14 and I solved that by putting tvWidget configuration outside of window.TradingView.widget.onready() function . I assumed this is because of there's no function called onready(). I found this after I print console.log of window.Tradingview.widget, therefore I putted the configuration outside of that function. Here my code at componentDidMount() method:

  componentDidMount() {
    const widgetOptions = {
      debug: false,
      symbol: this.props.symbol,
      datafeed: Datafeed,
      interval: this.props.interval,
      container_id: this.props.containerId,
      library_path: this.props.libraryPath,
      locale: getLanguageFromURL() || "en",
      disabled_features: ["use_localstorage_for_settings"],
      enabled_features: ["study_templates"],
      charts_storage_url: this.props.chartsStorageUrl,
      charts_storage_api_version: this.props.chartsStorageApiVersion,
      client_id: this.props.clientId,
      user_id: this.props.userId,
      fullscreen: this.props.fullscreen,
      autosize: this.props.autosize,
      studies_overrides: this.props.studiesOverrides,
      overrides: {
        // "mainSeriesProperties.showCountdown": true,
        "paneProperties.background": "#131722",
        "paneProperties.vertGridProperties.color": "#363c4e",
        "paneProperties.horzGridProperties.color": "#363c4e",
        "symbolWatermarkProperties.transparency": 90,
        "scalesProperties.textColor": "#AAA",
        "mainSeriesProperties.candleStyle.wickUpColor": "#336854",
        "mainSeriesProperties.candleStyle.wickDownColor": "#7f323f"
      }
    };

    const widget = (window.tvWidget = new window.TradingView.widget(
      widgetOptions
    ));

    widget.onChartReady(() => {
      console.log("Chart has loaded!");
    });
  }

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants