Skip to content

Commit

Permalink
[react-javascript] Import charting_library.min instead of using from …
Browse files Browse the repository at this point in the history
…global
  • Loading branch information
timocov committed Aug 7, 2018
1 parent e692c7c commit a5a5e3f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
1 change: 0 additions & 1 deletion react-javascript/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<html lang="en">
<head>
<meta charset="utf-8">
<script src="%PUBLIC_URL%/charting_library/charting_library.min.js"></script>
<script src="%PUBLIC_URL%/datafeeds/udf/dist/polyfills.js"></script>
<script src="%PUBLIC_URL%/datafeeds/udf/dist/bundle.js"></script>
<title>Charting Library React Demo</title>
Expand Down
9 changes: 5 additions & 4 deletions react-javascript/src/components/TVChartContainer/index.jsx
Original file line number Diff line number Diff line change
@@ -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=([^&#]*)');
Expand Down Expand Up @@ -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: () => {
Expand Down

0 comments on commit a5a5e3f

Please sign in to comment.