diff --git a/react-javascript/public/index.html b/react-javascript/public/index.html index 912b1ee..568a64f 100644 --- a/react-javascript/public/index.html +++ b/react-javascript/public/index.html @@ -2,7 +2,6 @@ - Charting Library React Demo diff --git a/react-javascript/src/components/TVChartContainer/index.jsx b/react-javascript/src/components/TVChartContainer/index.jsx index d0478c5..a72221c 100644 --- a/react-javascript/src/components/TVChartContainer/index.jsx +++ b/react-javascript/src/components/TVChartContainer/index.jsx @@ -1,5 +1,6 @@ import * as React from 'react'; import './index.css'; +import { widget } from '../../charting_library/charting_library.min'; function getLanguageFromURL() { const regex = new RegExp('[\\?&]lang=([^&#]*)'); @@ -44,13 +45,13 @@ export class TVChartContainer extends React.PureComponent { studies_overrides: this.props.studiesOverrides, }; - const widget = new window.TradingView.widget(widgetOptions); + const tvWidget = new widget(widgetOptions); - widget.onChartReady(() => { - const button = widget.createButton() + tvWidget.onChartReady(() => { + const button = tvWidget.createButton() .attr('title', 'Click to show a notification popup') .addClass('apply-common-tooltip') - .on('click', () => widget.showNoticeDialog({ + .on('click', () => tvWidget.showNoticeDialog({ title: 'Notification', body: 'TradingView Charting Library API works correctly', callback: () => {