;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ TvChartContainerComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(TvChartContainerComponent);
18 | component = fixture.componentInstance;
19 | });
20 |
21 | it('should be created', () => {
22 | expect(component).toBeTruthy();
23 | });
24 | });
25 |
--------------------------------------------------------------------------------
/react-native/android/app/src/release/java/com/chartinglibraryexample/ReactNativeFlipper.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) Meta Platforms, Inc. and affiliates.
3 | *
4 | * This source code is licensed under the MIT license found in the LICENSE file in the root
5 | * directory of this source tree.
6 | */
7 | package com.chartinglibraryexample;
8 |
9 | import android.content.Context;
10 | import com.facebook.react.ReactInstanceManager;
11 |
12 | /**
13 | * Class responsible of loading Flipper inside your React Native application. This is the release
14 | * flavor of it so it's empty as we don't want to load Flipper.
15 | */
16 | public class ReactNativeFlipper {
17 | public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) {
18 | // Do nothing as we don't want to initialize Flipper on Release.
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/android/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.kts.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/solidjs-typescript/copy_charting_library_files.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | remove_if_directory_exists() {
4 | if [ -d "$1" ]; then rm -Rf "$1"; fi
5 | }
6 |
7 | BRANCH="master";
8 |
9 | REPOSITORY='git@github.com:tradingview/charting_library.git'
10 |
11 | LATEST_HASH=$(git ls-remote $REPOSITORY $BRANCH | grep -Eo '^[[:alnum:]]+')
12 |
13 | remove_if_directory_exists "$LATEST_HASH"
14 |
15 | echo "$BRANCH" $REPOSITORY "$LATEST_HASH"
16 |
17 | git clone -q --depth 1 -b "$BRANCH" $REPOSITORY "$LATEST_HASH"
18 |
19 | remove_if_directory_exists "public/charting_library"
20 | remove_if_directory_exists "public/datafeeds"
21 | remove_if_directory_exists "src/charting_library"
22 |
23 | cp -r "$LATEST_HASH/charting_library" public
24 | cp -r "$LATEST_HASH/datafeeds" public
25 | cp -r "$LATEST_HASH/charting_library" src
26 |
27 | remove_if_directory_exists "$LATEST_HASH"
28 |
--------------------------------------------------------------------------------
/angular/src/test.ts:
--------------------------------------------------------------------------------
1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files
2 |
3 | import 'zone.js/testing';
4 | import { getTestBed } from '@angular/core/testing';
5 | import {
6 | BrowserDynamicTestingModule,
7 | platformBrowserDynamicTesting
8 | } from '@angular/platform-browser-dynamic/testing';
9 |
10 | declare const require: {
11 | context(path: string, deep?: boolean, filter?: RegExp): {
12 | (id: string): T;
13 | keys(): string[];
14 | };
15 | };
16 |
17 | // First, initialize the Angular testing environment.
18 | getTestBed().initTestEnvironment(
19 | BrowserDynamicTestingModule,
20 | platformBrowserDynamicTesting(),
21 | );
22 |
23 | // Then we find all the tests.
24 | const context = require.context('./', true, /\.spec\.ts$/);
25 | // And load the modules.
26 | context.keys().map(context);
27 |
--------------------------------------------------------------------------------
/react-typescript/browserslist:
--------------------------------------------------------------------------------
1 | # This is an rcfile for Browserslist (https://www.npmjs.com/package/browserslist)
2 |
3 | # All browsers with significant market share
4 | > 1% in US
5 | > 1% in RU
6 |
7 | # Desktop
8 | last 3 Chrome versions
9 | last 3 Edge versions
10 | last 3 Firefox versions
11 | last 3 Safari versions
12 | last 3 Opera versions
13 |
14 | # Mobile
15 | last 3 iOS versions
16 | last 3 ChromeAndroid versions
17 | last 3 Android versions
18 | last 3 FirefoxAndroid versions
19 |
20 | # Restrict min supported versions
21 | not Android < 66
22 | not Chrome < 66
23 | not ChromeAndroid < 66
24 | not Safari < 13
25 | not iOS < 13
26 |
27 | # Long dead browsers
28 | not Explorer <= 11
29 | not ExplorerMobile <= 11
30 | not OperaMini all # Opera mini has very limited JS support, no canvas and no websockets
31 | not OperaMobile <= 12.1 # Opera mobile Presto
32 |
--------------------------------------------------------------------------------
/vuejs3/src/App.vue:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
14 |
15 |
16 |
17 |
18 |
40 |
--------------------------------------------------------------------------------
/react-native/App.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import {SafeAreaView} from 'react-native';
3 | import {WebView} from 'react-native-webview';
4 |
5 | function App({uri = 'index.html'}): JSX.Element {
6 | return (
7 |
8 | true}
17 | />
18 |
19 | );
20 | }
21 |
22 | export function AndroidApp(): JSX.Element {
23 | return ;
24 | }
25 |
26 | export function IOsApp(): JSX.Element {
27 | return ;
28 | }
29 |
--------------------------------------------------------------------------------
/react-native/ios/ChartingLibraryExampleTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/nuxtjs3/nuxt.config.ts:
--------------------------------------------------------------------------------
1 | // https://nuxt.com/docs/api/configuration/nuxt-config
2 | export default defineNuxtConfig({
3 | app: {
4 | head: {
5 | title: "Charting Library Nuxtjs 3 Demo",
6 | htmlAttrs: {
7 | lang: "en",
8 | },
9 | meta: [
10 | { charset: "utf-8" },
11 | {
12 | name: "viewport",
13 | content: "width=device-width, initial-scale=1",
14 | },
15 | { hid: "description", name: "description", content: "" },
16 | ],
17 | link: [{ rel: "icon", type: "image/x-icon", href: "/favicon.ico" }],
18 | script: [{ src: "/datafeeds/udf/dist/bundle.js" }],
19 | },
20 | },
21 | plugins: [{ src: "~/plugins/TVChart.js", mode: "client" }],
22 | components: true,
23 | });
24 |
--------------------------------------------------------------------------------
/angular/.gitignore:
--------------------------------------------------------------------------------
1 | # See http://help.github.com/ignore-files/ for more about ignoring files.
2 |
3 | # compiled output
4 | /dist
5 | /tmp
6 | /out-tsc
7 | # Only exists if Bazel was run
8 | /bazel-out
9 |
10 | # dependencies
11 | /node_modules
12 | src/assets/charting_library/
13 | src/assets/datafeeds/
14 |
15 | # profiling files
16 | chrome-profiler-events*.json
17 |
18 | # IDEs and editors
19 | /.idea
20 | .project
21 | .classpath
22 | .c9/
23 | *.launch
24 | .settings/
25 | *.sublime-workspace
26 |
27 | # IDE - VSCode
28 | .vscode/*
29 | !.vscode/settings.json
30 | !.vscode/tasks.json
31 | !.vscode/launch.json
32 | !.vscode/extensions.json
33 | .history/*
34 |
35 | # misc
36 | /.angular/cache
37 | /.sass-cache
38 | /connect.lock
39 | /coverage
40 | /libpeerconnection.log
41 | npm-debug.log
42 | yarn-error.log
43 | testem.log
44 | /typings
45 |
46 | # System Files
47 | .DS_Store
48 | Thumbs.db
49 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 |
5 | ---
6 |
7 | **Checklist**
8 |
9 |
13 | - [ ] This issue is **NOT** related to the charting library itself
14 |
15 | **Describe the bug**
16 |
17 | A clear and concise description of what the bug is.
18 |
19 | **To Reproduce**
20 |
21 | Steps to reproduce the behavior:
22 | 1. Clone the repo
23 | 2. Go to '....' folder
24 | 3. Run command
25 | 4. See error
26 |
27 | **Expected behavior**
28 |
29 | A clear and concise description of what you expected to happen.
30 |
31 | **Screenshots**
32 |
33 | If applicable, add screenshots to help explain your problem.
34 |
35 | **Additional context**
36 |
37 | Add any other context about the problem here.
38 |
--------------------------------------------------------------------------------
/nextjs/copy_charting_library_files.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | remove_if_directory_exists() {
4 | if [ -d "$1" ]; then rm -Rf "$1"; fi
5 | }
6 |
7 | create_if_directory_does_not_exists() {
8 | if [ ! -d "$1" ]; then mkdir "$1"; fi
9 | }
10 |
11 | BRANCH="master";
12 |
13 | REPOSITORY='https://github.com/tradingview/charting_library/'
14 |
15 | LATEST_HASH=$(git ls-remote $REPOSITORY $BRANCH | grep -Eo '^[[:alnum:]]+')
16 |
17 | remove_if_directory_exists "$LATEST_HASH"
18 |
19 | git clone -q --depth 1 -b "$BRANCH" $REPOSITORY "$LATEST_HASH"
20 |
21 | create_if_directory_does_not_exists 'public'
22 | create_if_directory_does_not_exists 'public/static'
23 |
24 | remove_if_directory_exists "public/static/charting_library"
25 | remove_if_directory_exists "public/static/datafeeds"
26 |
27 | cp -r "$LATEST_HASH/charting_library" public/static
28 | cp -r "$LATEST_HASH/datafeeds" public/static
29 |
30 | remove_if_directory_exists "$LATEST_HASH"
31 |
--------------------------------------------------------------------------------
/solidjs-typescript/browserslist:
--------------------------------------------------------------------------------
1 | # This is an rcfile for Browserslist (https://www.npmjs.com/package/browserslist)
2 |
3 | # All browsers with significant market share
4 | > 1% in US
5 | > 1% in RU
6 |
7 | # Desktop
8 | last 3 Chrome versions
9 | last 3 Edge versions
10 | last 3 Firefox versions
11 | last 3 Safari versions
12 | last 3 Opera versions
13 |
14 | # Mobile
15 | last 3 iOS versions
16 | last 3 ChromeAndroid versions
17 | last 3 Android versions
18 | last 3 FirefoxAndroid versions
19 |
20 | # iOS app special needs
21 | iOS >= 15
22 |
23 | # Restrict min supported versions
24 | not Android < 85
25 | not Chrome < 85
26 | not ChromeAndroid < 85
27 | not Safari < 15
28 | not iOS < 15
29 | not Firefox < 79
30 | not FirefoxAndroid < 79
31 |
32 | # Long dead browsers
33 | not Explorer <= 11
34 | not ExplorerMobile <= 11
35 | not OperaMini all # Opera mini has very limited JS support, no canvas and no websockets
36 | not OperaMobile <= 12.1 # Opera mobile Presto
37 |
--------------------------------------------------------------------------------
/ruby-on-rails/app/assets/stylesheets/chart.scss:
--------------------------------------------------------------------------------
1 | // Place all the styles related to the Library controller here.
2 | // They will automatically be included in application.css.
3 | // You can use Sass (SCSS) here: http://sass-lang.com/
4 |
5 | body {
6 | margin: 0;
7 | font-family: sans-serif;
8 | }
9 |
10 | .page-logo-container {
11 | padding-bottom: 29px;
12 | text-align: center;
13 | background-color: #222;
14 | }
15 |
16 | .page-rails-logo-container {
17 | display: inline-block;
18 | }
19 |
20 | .page-rails-logo {
21 | display: block;
22 | border: 0;
23 | width: 151px;
24 | height: 151px;
25 | }
26 |
27 | .page-tv-logo-container {
28 | display: inline-block;
29 | }
30 |
31 | .page-tv-logo {
32 | display: block;
33 | border: 0;
34 | }
35 |
36 | .page-header {
37 | box-sizing: border-box;
38 | margin: 15px 0 0;
39 | text-align: center;
40 | font-size: 1.5em;
41 | color: #fff;
42 | }
43 |
44 | .page-tv-chart-container {
45 | height: calc(100vh - 227px);
46 | }
47 |
--------------------------------------------------------------------------------
/android/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx1536m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | org.gradle.parallel=true
14 |
15 | android.useAndroidX=true
16 | # Automatically convert third-party libraries to use AndroidX
17 | android.enableJetifier=true
18 | # Kotlin code style for this project: "official" or "obsolete":
19 | kotlin.code.style=official
--------------------------------------------------------------------------------
/ruby-on-rails/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files for more about ignoring files.
2 | #
3 | # If you find yourself ignoring temporary files generated by your text editor
4 | # or operating system, you probably want to add a global ignore instead:
5 | # git config --global core.excludesfile '~/.gitignore_global'
6 |
7 | # Ignore bundler config.
8 | /.bundle
9 |
10 | # Ignore the default SQLite database.
11 | /db/*.sqlite3
12 | /db/*.sqlite3-*
13 |
14 | # Ignore all logfiles and tempfiles.
15 | /log/*
16 | /tmp/*
17 | !/log/.keep
18 | !/tmp/.keep
19 |
20 | # Ignore pidfiles, but keep the directory.
21 | /tmp/pids/*
22 | !/tmp/pids/
23 | !/tmp/pids/.keep
24 |
25 | # Ignore uploaded files in development.
26 | /storage/*
27 | !/storage/.keep
28 | /tmp/storage/*
29 | !/tmp/storage/
30 | !/tmp/storage/.keep
31 |
32 | /public/assets
33 | /public/charting_library
34 | /public/datafeeds
35 | /vendor/bundle
36 |
37 | # Ignore master key for decrypting credentials and more.
38 | /config/master.key
39 |
--------------------------------------------------------------------------------
/ruby-on-rails/config/locales/en.yml:
--------------------------------------------------------------------------------
1 | # Files in the config/locales directory are used for internationalization
2 | # and are automatically loaded by Rails. If you want to use locales other
3 | # than English, add the necessary files in this directory.
4 | #
5 | # To use the locales, use `I18n.t`:
6 | #
7 | # I18n.t "hello"
8 | #
9 | # In views, this is aliased to just `t`:
10 | #
11 | # <%= t("hello") %>
12 | #
13 | # To use a different locale, set it with `I18n.locale`:
14 | #
15 | # I18n.locale = :es
16 | #
17 | # This would use the information in config/locales/es.yml.
18 | #
19 | # The following keys must be escaped otherwise they will not be retrieved by
20 | # the default I18n backend:
21 | #
22 | # true, false, on, off, yes, no
23 | #
24 | # Instead, surround them with single quotes.
25 | #
26 | # en:
27 | # "true": "foo"
28 | #
29 | # To learn more, please read the Rails Internationalization guide
30 | # available at https://guides.rubyonrails.org/i18n.html.
31 |
32 | en:
33 | hello: "Hello world"
34 |
--------------------------------------------------------------------------------
/vuejs/src/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
11 |
12 |
13 |
27 |
28 |
50 |
--------------------------------------------------------------------------------
/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
10 |
18 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/react-javascript/browserslist:
--------------------------------------------------------------------------------
1 | # This is an rcfile for Browserslist (https://www.npmjs.com/package/browserslist)
2 | # These settings are used by Autoprefixer, babel-preset-env and other modules
3 |
4 | # All browsers with significant market share
5 | > 1% in US
6 | > 1% in RU
7 |
8 | # Desktop
9 | last 3 Chrome versions
10 | last 3 Edge versions
11 | last 3 Firefox versions
12 | last 3 Safari versions
13 | last 3 Opera versions
14 |
15 | # Mobile
16 | last 3 iOS versions
17 | last 3 ChromeAndroid versions
18 | last 3 Android versions
19 | last 3 FirefoxAndroid versions
20 |
21 | # iOS app special needs
22 | iOS >= 15
23 |
24 | # Restrict min supported versions
25 | not Android < 69
26 | not Chrome < 69
27 | not ChromeAndroid < 69
28 | not Safari < 15
29 | not iOS < 15
30 | not Firefox < 69
31 | not FirefoxAndroid < 69
32 |
33 | # Long dead browsers
34 | not Explorer <= 11
35 | not ExplorerMobile <= 11
36 | not OperaMini all # Opera mini has very limited JS support, no canvas and no websockets
37 | not OperaMobile <= 12.1 # Opera mobile Presto
38 |
--------------------------------------------------------------------------------
/angular/src/app/app-header/app-header.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { AppHeaderComponent } from './app-header.component';
4 |
5 | describe('AppHeaderComponent', () => {
6 | let component: AppHeaderComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ AppHeaderComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(AppHeaderComponent);
18 | component = fixture.componentInstance;
19 | });
20 |
21 | it('should be created', () => {
22 | expect(component).toBeTruthy();
23 | });
24 |
25 | it(`should have as title 'TradingView Charting Library and Angular 5 Integration Example'`, async(() => {
26 | const app = fixture.debugElement.componentInstance;
27 | expect(app.title).toEqual('TradingView Charting Library and Angular 5 Integration Example');
28 | }));
29 | });
30 |
--------------------------------------------------------------------------------
/angular/tsconfig.json:
--------------------------------------------------------------------------------
1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */
2 | {
3 | "compileOnSave": false,
4 | "compilerOptions": {
5 | "baseUrl": "./",
6 | "outDir": "./dist/out-tsc",
7 | "forceConsistentCasingInFileNames": true,
8 | "strict": true,
9 | "noImplicitOverride": true,
10 | "noPropertyAccessFromIndexSignature": true,
11 | "noImplicitReturns": true,
12 | "noFallthroughCasesInSwitch": true,
13 | "sourceMap": true,
14 | "declaration": false,
15 | "downlevelIteration": true,
16 | "experimentalDecorators": true,
17 | "moduleResolution": "node",
18 | "importHelpers": true,
19 | "target": "es2017",
20 | "module": "es2020",
21 | "lib": [
22 | "es2020",
23 | "dom"
24 | ]
25 | },
26 | "exclude": [
27 | "src/assets/**/*"
28 | ],
29 | "angularCompilerOptions": {
30 | "enableI18nLegacyMessageIdFormat": false,
31 | "strictInjectionParameters": true,
32 | "strictInputAccessModifiers": true,
33 | "strictTemplates": true
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/react-native/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
12 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/angular/.vscode/tasks.json:
--------------------------------------------------------------------------------
1 | {
2 | // For more information, visit: https://go.microsoft.com/fwlink/?LinkId=733558
3 | "version": "2.0.0",
4 | "tasks": [
5 | {
6 | "type": "npm",
7 | "script": "start",
8 | "isBackground": true,
9 | "problemMatcher": {
10 | "owner": "typescript",
11 | "pattern": "$tsc",
12 | "background": {
13 | "activeOnStart": true,
14 | "beginsPattern": {
15 | "regexp": "(.*?)"
16 | },
17 | "endsPattern": {
18 | "regexp": "bundle generation complete"
19 | }
20 | }
21 | }
22 | },
23 | {
24 | "type": "npm",
25 | "script": "test",
26 | "isBackground": true,
27 | "problemMatcher": {
28 | "owner": "typescript",
29 | "pattern": "$tsc",
30 | "background": {
31 | "activeOnStart": true,
32 | "beginsPattern": {
33 | "regexp": "(.*?)"
34 | },
35 | "endsPattern": {
36 | "regexp": "bundle generation complete"
37 | }
38 | }
39 | }
40 | }
41 | ]
42 | }
43 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 TradingView, Inc.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/android/app/build.gradle.kts:
--------------------------------------------------------------------------------
1 | plugins {
2 | alias(libs.plugins.android)
3 | alias(libs.plugins.kotlin.android)
4 | }
5 |
6 | android {
7 | namespace = "com.tradingview.android"
8 | compileSdk = libs.versions.sdk.compile.get().toInt()
9 | defaultConfig {
10 | applicationId = "com.tradingview.android"
11 | minSdk = libs.versions.sdk.min.get().toInt()
12 | targetSdk = libs.versions.sdk.compile.get().toInt()
13 | versionCode = 1
14 | versionName = "1.0"
15 | }
16 | buildTypes {
17 | release {
18 | isMinifyEnabled = false
19 | proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "consumer-rules.pro")
20 | }
21 | }
22 | compileOptions {
23 | sourceCompatibility = JavaVersion.VERSION_17
24 | targetCompatibility = JavaVersion.VERSION_17
25 | }
26 | kotlinOptions {
27 | jvmTarget = "17"
28 | }
29 | buildFeatures {
30 | viewBinding = true
31 | }
32 | }
33 |
34 | dependencies {
35 | implementation(libs.androidx.appcompat)
36 | implementation(libs.androidx.constraintlayout)
37 | }
38 |
--------------------------------------------------------------------------------
/react-native/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "charting-library-react-native-example",
3 | "version": "1.0.0",
4 | "private": true,
5 | "scripts": {
6 | "android": "react-native run-android",
7 | "ios": "react-native run-ios",
8 | "lint": "eslint .",
9 | "start": "react-native start",
10 | "test": "jest"
11 | },
12 | "dependencies": {
13 | "react": "18.2.0",
14 | "react-native": "0.71.2",
15 | "react-native-webview": "^11.26.1"
16 | },
17 | "devDependencies": {
18 | "@babel/core": "^7.20.0",
19 | "@babel/preset-env": "^7.20.0",
20 | "@babel/runtime": "^7.20.0",
21 | "@react-native-community/eslint-config": "^3.2.0",
22 | "@tsconfig/react-native": "^2.0.2",
23 | "@types/jest": "^29.2.1",
24 | "@types/react": "^18.0.24",
25 | "@types/react-test-renderer": "^18.0.0",
26 | "babel-jest": "^29.2.1",
27 | "eslint": "^8.19.0",
28 | "jest": "^29.2.1",
29 | "metro-react-native-babel-preset": "0.73.7",
30 | "prettier": "^2.4.1",
31 | "react-test-renderer": "18.2.0",
32 | "typescript": "4.8.4"
33 | },
34 | "jest": {
35 | "preset": "react-native"
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/react-native/ios/ChartingLibraryExample/Images.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "scale" : "2x",
6 | "size" : "20x20"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "scale" : "3x",
11 | "size" : "20x20"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "scale" : "2x",
16 | "size" : "29x29"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "scale" : "3x",
21 | "size" : "29x29"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "scale" : "2x",
26 | "size" : "40x40"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "scale" : "3x",
31 | "size" : "40x40"
32 | },
33 | {
34 | "idiom" : "iphone",
35 | "scale" : "2x",
36 | "size" : "60x60"
37 | },
38 | {
39 | "idiom" : "iphone",
40 | "scale" : "3x",
41 | "size" : "60x60"
42 | },
43 | {
44 | "idiom" : "ios-marketing",
45 | "scale" : "1x",
46 | "size" : "1024x1024"
47 | }
48 | ],
49 | "info" : {
50 | "author" : "xcode",
51 | "version" : 1
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/ruby-on-rails/bin/setup:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | require "fileutils"
3 |
4 | # path to your application root.
5 | APP_ROOT = File.expand_path("..", __dir__)
6 |
7 | def system!(*args)
8 | system(*args) || abort("\n== Command #{args} failed ==")
9 | end
10 |
11 | FileUtils.chdir APP_ROOT do
12 | # This script is a way to set up or update your development environment automatically.
13 | # This script is idempotent, so that you can run it at any time and get an expectable outcome.
14 | # Add necessary setup steps to this file.
15 |
16 | puts "== Installing dependencies =="
17 | system! "gem install bundler --conservative"
18 | system("bundle check") || system!("bundle install")
19 |
20 | # puts "\n== Copying sample files =="
21 | # unless File.exist?("config/database.yml")
22 | # FileUtils.cp "config/database.yml.sample", "config/database.yml"
23 | # end
24 |
25 | puts "\n== Preparing database =="
26 | system! "bin/rails db:prepare"
27 |
28 | puts "\n== Removing old logs and tempfiles =="
29 | system! "bin/rails log:clear tmp:clear"
30 |
31 | puts "\n== Restarting application server =="
32 | system! "bin/rails restart"
33 | end
34 |
--------------------------------------------------------------------------------
/angular/.browserslistrc:
--------------------------------------------------------------------------------
1 | # This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
2 | # For additional information regarding the format and rule options, please see:
3 | # https://github.com/browserslist/browserslist#queries
4 |
5 | # For the full list of supported browsers by the Angular framework, please see:
6 | # https://angular.io/guide/browser-support
7 |
8 | # You can see what browsers were selected by your queries by running:
9 | # npx browserslist
10 |
11 | # All browsers with significant market share
12 | > 1% in US
13 | > 1% in RU
14 |
15 | # Desktop
16 | last 3 Chrome versions
17 | last 3 Edge versions
18 | last 3 Firefox versions
19 | last 3 Safari versions
20 | last 3 Opera versions
21 |
22 | # Mobile
23 | last 3 iOS versions
24 | last 3 ChromeAndroid versions
25 | last 3 Android versions
26 | last 3 FirefoxAndroid versions
27 |
28 | # Restrict min supported versions
29 | not Android < 66
30 | not Chrome < 66
31 | not ChromeAndroid < 66
32 | not Safari < 13
33 | not iOS < 13
34 |
35 | # Long dead browsers
36 | not Explorer <= 11
37 | not ExplorerMobile <= 11
38 | not OperaMini all # Opera mini has very limited JS support, no canvas and no websockets
39 | not OperaMobile <= 12.1 # Opera mobile Presto
40 |
41 |
--------------------------------------------------------------------------------
/nuxtjs/nuxt.config.js:
--------------------------------------------------------------------------------
1 | export default {
2 | // Global page headers: https://go.nuxtjs.dev/config-head
3 | head: {
4 | title: 'Charting Library nuxtjs Demo',
5 | htmlAttrs: {
6 | lang: 'en'
7 | },
8 | meta: [
9 | { charset: 'utf-8' },
10 | { name: 'viewport', content: 'width=device-width, initial-scale=1' },
11 | { hid: 'description', name: 'description', content: '' }
12 | ],
13 | link: [
14 | { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
15 | ],
16 | script: [
17 | { src: '/datafeeds/udf/dist/bundle.js' }
18 | ]
19 | },
20 |
21 | // Global CSS: https://go.nuxtjs.dev/config-css
22 | css: [
23 | ],
24 |
25 | // Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
26 | plugins: [
27 | { src: '~/plugins/TVChart.js', mode: 'client' }
28 | ],
29 |
30 | // Auto import components: https://go.nuxtjs.dev/config-components
31 | components: true,
32 |
33 | // Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
34 | buildModules: [
35 | ],
36 |
37 | // Modules: https://go.nuxtjs.dev/config-modules
38 | modules: [
39 | ],
40 |
41 | // Build Configuration: https://go.nuxtjs.dev/config-build
42 | build: {
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/nuxtjs/layouts/default.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
63 |
--------------------------------------------------------------------------------
/ruby-on-rails/config/initializers/content_security_policy.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Define an application-wide content security policy
4 | # For further information see the following documentation
5 | # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
6 |
7 | # Rails.application.configure do
8 | # config.content_security_policy do |policy|
9 | # policy.default_src :self, :https
10 | # policy.font_src :self, :https, :data
11 | # policy.img_src :self, :https, :data
12 | # policy.object_src :none
13 | # policy.script_src :self, :https
14 | # policy.style_src :self, :https
15 | # # Specify URI for violation reports
16 | # # policy.report_uri "/csp-violation-report-endpoint"
17 | # end
18 | #
19 | # # Generate session nonces for permitted importmap and inline scripts
20 | # config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
21 | # config.content_security_policy_nonce_directives = %w(script-src)
22 | #
23 | # # Report CSP violations to a specified URI. See:
24 | # # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
25 | # # config.content_security_policy_report_only = true
26 | # end
27 |
--------------------------------------------------------------------------------
/ruby-on-rails/config/storage.yml:
--------------------------------------------------------------------------------
1 | test:
2 | service: Disk
3 | root: <%= Rails.root.join("tmp/storage") %>
4 |
5 | local:
6 | service: Disk
7 | root: <%= Rails.root.join("storage") %>
8 |
9 | # Use bin/rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
10 | # amazon:
11 | # service: S3
12 | # access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
13 | # secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
14 | # region: us-east-1
15 | # bucket: your_own_bucket-<%= Rails.env %>
16 |
17 | # Remember not to checkin your GCS keyfile to a repository
18 | # google:
19 | # service: GCS
20 | # project: your_project
21 | # credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
22 | # bucket: your_own_bucket-<%= Rails.env %>
23 |
24 | # Use bin/rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
25 | # microsoft:
26 | # service: AzureStorage
27 | # storage_account_name: your_account_name
28 | # storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
29 | # container: your_container_name-<%= Rails.env %>
30 |
31 | # mirror:
32 | # service: Mirror
33 | # primary: local
34 | # mirrors: [ amazon, google, microsoft ]
35 |
--------------------------------------------------------------------------------
/react-native/ios/ChartingLibraryExample/AppDelegate.mm:
--------------------------------------------------------------------------------
1 | #import "AppDelegate.h"
2 |
3 | #import
4 |
5 | @implementation AppDelegate
6 |
7 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
8 | {
9 | self.moduleName = @"ChartingLibraryExample";
10 | // You can add your custom initial props in the dictionary below.
11 | // They will be passed down to the ViewController used by React Native.
12 | self.initialProps = @{};
13 |
14 | return [super application:application didFinishLaunchingWithOptions:launchOptions];
15 | }
16 |
17 | - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
18 | {
19 | #if DEBUG
20 | return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
21 | #else
22 | return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
23 | #endif
24 | }
25 |
26 | /// This method controls whether the `concurrentRoot`feature of React18 is turned on or off.
27 | ///
28 | /// @see: https://reactjs.org/blog/2022/03/29/react-v18.html
29 | /// @note: This requires to be rendering on Fabric (i.e. on the New Architecture).
30 | /// @return: `true` if the `concurrentRoot` feature is enabled. Otherwise, it returns `false`.
31 | - (BOOL)concurrentRootEnabled
32 | {
33 | return true;
34 | }
35 |
36 | @end
37 |
--------------------------------------------------------------------------------
/angular/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "angular",
3 | "version": "0.0.0",
4 | "engines": {
5 | "npm": "^10.2.3",
6 | "pnpm": "^9.3.0",
7 | "node": "^18.20.3"
8 | },
9 | "scripts": {
10 | "ng": "ng",
11 | "start": "ng serve",
12 | "build": "ng build",
13 | "watch": "ng build --watch --configuration development",
14 | "test": "ng test"
15 | },
16 | "private": true,
17 | "dependencies": {
18 | "@angular/animations": "~18.1.2",
19 | "@angular/common": "~18.1.2",
20 | "@angular/compiler": "~18.1.2",
21 | "@angular/core": "~18.1.2",
22 | "@angular/forms": "~18.1.2",
23 | "@angular/platform-browser": "~18.1.2",
24 | "@angular/platform-browser-dynamic": "~18.1.2",
25 | "@angular/router": "~18.1.2",
26 | "rxjs": "~7.8.1",
27 | "tslib": "^2.6.3",
28 | "zone.js": "~0.14.8"
29 | },
30 | "devDependencies": {
31 | "@angular-devkit/build-angular": "~18.1.2",
32 | "@angular/cli": "~18.1.2",
33 | "@angular/compiler-cli": "~18.1.2",
34 | "@types/jasmine": "~5.1.4",
35 | "@types/node": "^22.0.0",
36 | "jasmine-core": "~5.2.0",
37 | "karma": "~6.4.4",
38 | "karma-chrome-launcher": "~3.2.0",
39 | "karma-coverage": "~2.2.1",
40 | "karma-jasmine": "~5.1.0",
41 | "karma-jasmine-html-reporter": "~2.1.0",
42 | "typescript": "~5.5.4"
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/nextjs/pages/index.tsx:
--------------------------------------------------------------------------------
1 | import Head from "next/head";
2 | import dynamic from "next/dynamic";
3 | import { useState } from "react";
4 | import Script from "next/script";
5 |
6 | import {
7 | ChartingLibraryWidgetOptions,
8 | ResolutionString,
9 | } from "@/public/static/charting_library/charting_library";
10 |
11 | const defaultWidgetProps: Partial = {
12 | symbol: "AAPL",
13 | interval: "1D" as ResolutionString,
14 | library_path: "/static/charting_library/",
15 | locale: "en",
16 | charts_storage_url: "https://saveload.tradingview.com",
17 | charts_storage_api_version: "1.1",
18 | client_id: "tradingview.com",
19 | user_id: "public_user_id",
20 | fullscreen: false,
21 | autosize: true,
22 | };
23 |
24 | const TVChartContainer = dynamic(
25 | () =>
26 | import("@/components/TVChartContainer").then((mod) => mod.TVChartContainer),
27 | { ssr: false }
28 | );
29 |
30 | export default function Home() {
31 | const [isScriptReady, setIsScriptReady] = useState(false);
32 | return (
33 | <>
34 |
35 | TradingView Charting Library and Next.js
36 |
37 |
45 |
46 |
47 |
48 |
53 |
--------------------------------------------------------------------------------
/react-javascript/README.md:
--------------------------------------------------------------------------------
1 | # TradingView Charting Library and React Integration Example (JavaScript)
2 |
3 | The latest supported version of the charting library for these examples is `v28.0.0`.
4 |
5 | ## How to start
6 |
7 | 1. Check that you can view https://github.com/tradingview/charting_library/. If you do not have access then you can [request access to this repository here](https://www.tradingview.com/HTML5-stock-forex-bitcoin-charting-library/).
8 | 1. Install dependencies `npm install`.
9 | 1. Copy the charting library files
10 | 1. If you are able to run bash scripts then the `copy_charting_library_files.sh` script can be used to copy the current stable version's files.
11 | 1. If you are not able to run bash scripts then do the following:
12 | 1. Copy `charting_library` from https://github.com/tradingview/charting_library/ to `/public` and `/src`.
13 | 1. Copy `datafeeds` from https://github.com/tradingview/charting_library/ to `/public`.
14 | 1. Run `npm start`. It will build the project and open a default browser with the Charting Library.
15 |
16 | ## What is Charting Library
17 |
18 | Charting Library is a standalone solution for displaying charts. This free, downloadable library is hosted on your servers and is connected to your data feed to be used in your website or app. [Learn more and download](https://www.tradingview.com/HTML5-stock-forex-bitcoin-charting-library/).
19 |
20 | ## What is React
21 |
22 | React is a JavaScript library for building user interfaces. It is maintained by Facebook, Instagram and a community of individual developers and corporations.
23 |
24 | ## About This Project
25 |
26 | This project was bootstrapped with [Create React App](https://github.com/facebookincubator/create-react-app).
27 |
--------------------------------------------------------------------------------
/ios-swift/App/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/react-native/.gitignore:
--------------------------------------------------------------------------------
1 | # OSX
2 | #
3 | .DS_Store
4 |
5 | # Xcode
6 | #
7 | build/
8 | *.pbxuser
9 | !default.pbxuser
10 | *.mode1v3
11 | !default.mode1v3
12 | *.mode2v3
13 | !default.mode2v3
14 | *.perspectivev3
15 | !default.perspectivev3
16 | xcuserdata
17 | *.xccheckout
18 | *.moved-aside
19 | DerivedData
20 | *.hmap
21 | *.ipa
22 | *.xcuserstate
23 | ios/.xcode.env.local
24 |
25 | # Android/IntelliJ
26 | #
27 | build/
28 | .idea
29 | .gradle
30 | local.properties
31 | *.iml
32 | *.hprof
33 | .cxx/
34 | *.keystore
35 | !debug.keystore
36 |
37 | # node.js
38 | #
39 | node_modules/
40 | npm-debug.log
41 | yarn-error.log
42 |
43 | # fastlane
44 | #
45 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
46 | # screenshots whenever they are needed.
47 | # For more information about the recommended setup visit:
48 | # https://docs.fastlane.tools/best-practices/source-control/
49 |
50 | **/fastlane/report.xml
51 | **/fastlane/Preview.html
52 | **/fastlane/screenshots
53 | **/fastlane/test_output
54 |
55 | # Bundle artifact
56 | *.jsbundle
57 |
58 | # Ruby / CocoaPods
59 | /ios/Pods/
60 | /vendor/bundle/
61 |
62 | # Temporary files created by Metro to check the health of the file watcher
63 | .metro-health-check*
64 |
65 | ## Charting Library
66 | /android/app/src/main/assets/charting_library
67 | /android/app/src/main/assets/datafeeds
68 | /android/app/src/main/assets/*.html
69 | !/android/app/src/main/assets/index.html
70 | !/android/app/src/main/assets/place-charting-library-here
71 | /ios/charting_library/charting_library
72 | /ios/charting_library/datafeeds
73 | /ios/charting_library/*.html
74 | !/ios/charting_library/index.html
75 | !/ios/charting_library/place-charting-library-here
76 | /yarn.lock
77 | /package-lock.json
78 |
--------------------------------------------------------------------------------
/ios-swift/README.md:
--------------------------------------------------------------------------------
1 | # TradingView Charting Library iOS (Swift version) Integration Example
2 |
3 | Latest tested version of the library with this example is `v29.2.0` with Xcode `16.3` and iOS `18.2`.
4 |
5 | ## How to start
6 |
7 | 1. Check that you can view https://github.com/tradingview/charting_library/. If you do not have access then you can [request access to this repository here](https://www.tradingview.com/HTML5-stock-forex-bitcoin-charting-library/).
8 | 1. Open Example.xcodeproj in Xcode.
9 | 1. Click on `Example` folder at the very top of the `Project Navigator`.
10 | 1. In the inner menu on the left, select `Example` under `TARGETS`.
11 | 1. Select the `Build Phases` tab at the top of the window.
12 | 1. Under `Copy Bundle Resources` select the `+` icon.
13 | 1. Click on `"Add Other..."` button.
14 | 1. Browse and identify all the files downloaded from `https://github.com/tradingview/charting_library/`. **Note**: Unlike some of the other examples you should copy all files from the repository not just the `datafeeds` and `charting_library` directories.
15 | 1. Select `"Create folder references"`. **Note**: This is important because the library contains files with the same name, but in different folders, so the "Create folder references" option adds files to your application bundle with the same folder structure as in the library.
16 | 1. Select all files added to project and move them to the `ChartingLibrary` folder.
17 | 1. Lastly, build the application.
18 |
19 | ## What is Charting Library
20 |
21 | Charting Library is a standalone solution for displaying charts. This free, downloadable library is hosted on your servers and is connected to your data feed to be used in your website or app. [Learn more and download](https://www.tradingview.com/HTML5-stock-forex-bitcoin-charting-library/).
22 |
23 |
--------------------------------------------------------------------------------
/angular/README.md:
--------------------------------------------------------------------------------
1 | # TradingView Charting Library and Angular Integration Example
2 |
3 | The earliest supported version of the charting library for these examples is `v28.0.0`.
4 |
5 | ## How to start
6 |
7 | 1. Check that you can view https://github.com/tradingview/charting_library/. If you do not have access then you can [request access to this repository here](https://www.tradingview.com/HTML5-stock-forex-bitcoin-charting-library/).
8 | 1. Install dependencies with `npm install`.
9 | 1. Copy the charting library files
10 | 1. If you are able to run bash scripts then the `copy_charting_library_files.sh` script can be used to copy the current stable version's files.
11 | 1. If you are not able to run bash scripts then do the following:
12 | 1. Copy `charting_library` folder from https://github.com/tradingview/charting_library/ to `/src/assets`.
13 | 1. Copy `datafeeds` folder from https://github.com/tradingview/charting_library/ to `/src/assets`.
14 | 1. Run `./node_modules/.bin/ng serve` (use `"./node_modules/.bin/ng" serve` in Windows) for a dev server and navigate to `http://localhost:4200/`.
15 |
16 | ## What is Charting Library
17 |
18 | Charting Library is a standalone solution for displaying charts. This free, downloadable library is hosted on your servers and is connected to your data feed to be used in your website or app. [Learn more and download](https://www.tradingview.com/HTML5-stock-forex-bitcoin-charting-library/).
19 |
20 | ## What is Angular
21 |
22 | Angular is a platform that makes it easy to build applications with the web. Angular combines declarative templates, dependency injection, end to end tooling, and integrated best practices to solve development challenges. Angular empowers developers to build applications that live on the web, mobile, or the desktop. [Learn more](https://angular.io/docs).
23 |
--------------------------------------------------------------------------------
/react-native/ios/ChartingLibraryExample/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | ChartingLibraryExample
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | $(MARKETING_VERSION)
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | $(CURRENT_PROJECT_VERSION)
25 | LSRequiresIPhoneOS
26 |
27 | NSAppTransportSecurity
28 |
29 | NSExceptionDomains
30 |
31 | localhost
32 |
33 | NSExceptionAllowsInsecureHTTPLoads
34 |
35 |
36 |
37 |
38 | NSLocationWhenInUseUsageDescription
39 |
40 | UILaunchStoryboardName
41 | LaunchScreen
42 | UIRequiredDeviceCapabilities
43 |
44 | armv7
45 |
46 | UISupportedInterfaceOrientations
47 |
48 | UIInterfaceOrientationPortrait
49 | UIInterfaceOrientationLandscapeLeft
50 | UIInterfaceOrientationLandscapeRight
51 |
52 | UIViewControllerBasedStatusBarAppearance
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/ruby-on-rails/app/assets/javascripts/tv-chart-widget-init.js:
--------------------------------------------------------------------------------
1 | function getLanguageFromURL() {
2 | const regex = new RegExp('[\\?&]lang=([^]*)');
3 | const results = regex.exec(location.search);
4 |
5 | return results === null ? null : decodeURIComponent(results[1].replace(/\+/g, ' '));
6 | }
7 |
8 | document.getElementById('header-text').textContent += TradingView.version();
9 |
10 | function initOnReady() {
11 | var widget = window.tvWidget = new TradingView.widget({
12 | symbol: 'AAPL',
13 | // BEWARE: no trailing slash is expected in feed URL
14 | // tslint:disable-next-line:no-any
15 | datafeed: new window.Datafeeds.UDFCompatibleDatafeed('https://demo_feed.tradingview.com'),
16 | interval: 'D',
17 | container: document.getElementById('tv_chart_container'),
18 | library_path: '/charting_library/',
19 |
20 | locale: getLanguageFromURL() || 'en',
21 | disabled_features: ['use_localstorage_for_settings'],
22 | enabled_features: ['study_templates'],
23 | charts_storage_url: 'https://saveload.tradingview.com',
24 | charts_storage_api_version: '1.1',
25 | client_id: 'tradingview.com',
26 | user_id: 'public_user_id',
27 | fullscreen: false,
28 | autosize: true,
29 | studies_overrides: {},
30 | });
31 |
32 | widget.onChartReady(() => {
33 | widget.headerReady().then(() => {
34 | const button = widget.createButton();
35 |
36 | button.setAttribute('title', 'Click to show a notification popup');
37 | button.classList.add('apply-common-tooltip');
38 |
39 | button.addEventListener('click', () => widget.showNoticeDialog({
40 | title: 'Notification',
41 | body: 'TradingView Charting Library API works correctly',
42 | callback: () => {
43 | console.log('Noticed!');
44 | },
45 | }));
46 |
47 | button.innerHTML = 'Check API';
48 | });
49 | });
50 | };
51 |
52 | window.addEventListener('DOMContentLoaded', initOnReady, false);
53 |
--------------------------------------------------------------------------------
/sveltekit/README.md:
--------------------------------------------------------------------------------
1 | # TradingView Charting Library and Sveltekit(Svelte) Integration Example
2 |
3 | The earliest supported version of the charting library for these examples is `v28.0.0`.
4 |
5 | ## How to start
6 |
7 | 1. Check that you can view
8 | [https://github.com/tradingview/charting_library/](https://github.com/tradingview/charting_library/).
9 | If you do not have access then you can
10 | [request access to this repository here](https://www.tradingview.com/HTML5-stock-forex-bitcoin-charting-library/).
11 | 1. Install dependencies `npm install`.
12 | 1. Copy the charting library files
13 | 1. If you are able to run bash scripts then the
14 | `copy_charting_library_files.sh` script can be used to copy the current
15 | stable version's files.
16 | 1. If you are not able to run bash scripts then do the following:
17 | 1. Copy the `charting_library` folder from
18 | [https://github.com/tradingview/charting_library/](https://github.com/tradingview/charting_library/)
19 | to `/static` and `/src/lib` folder.
20 | 1. Copy the `datafeeds` folder from
21 | [https://github.com/tradingview/charting_library/](https://github.com/tradingview/charting_library/)
22 | to `/src/lib`.
23 | 1. Run `npm run dev` to run the app in development mode
24 | with the Charting Library.
25 | 1. Run `npm run build` To create a production version of your app.
26 | > You can preview the production build with `npm run preview`.
27 |
28 | ## What is Charting Library
29 |
30 | Charting Library is a standalone solution for displaying charts. This free,
31 | downloadable library is hosted on your servers and is connected to your data
32 | feed to be used in your website or app.
33 | [Learn more and download](https://www.tradingview.com/HTML5-stock-forex-bitcoin-charting-library/).
34 |
35 | ## Credit
36 |
37 | Example kindly provided by [Razz19](https://github.com/Razz19)
38 |
--------------------------------------------------------------------------------
/ruby-on-rails/public/500.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | We're sorry, but something went wrong (500)
5 |
6 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
We're sorry, but something went wrong.
62 |
63 |
If you are the application owner check the logs for more information.
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/nextjs-javascript/README.md:
--------------------------------------------------------------------------------
1 | # TradingView Charting Library and Nextjs Integration Example (JavaScript)
2 |
3 | The earliest supported version of the charting library for these examples is `v28.0.0`.
4 |
5 | ## How to start
6 |
7 | 1. Check that you can view https://github.com/tradingview/charting_library/. If you do not have access then you can [request access to this repository here](https://www.tradingview.com/HTML5-stock-forex-bitcoin-charting-library/).
8 | 1. Install dependencies `npm install`.
9 | 1. Copy the charting library files
10 | 1. If you are able to run bash scripts then the `copy_charting_library_files.sh` script can be used to copy the current stable version's files.
11 | 1. If you are not able to run bash scripts then do the following:
12 | 1. Copy `charting_library` folder from https://github.com/tradingview/charting_library/ to `/public/static` folders.
13 | 1. Copy `datafeeds` folder from https://github.com/tradingview/charting_library/ to `/public/static`.
14 | 1. Run `npm run build` and `npm run start`. It will build the project and open a default browser with the Charting Library.
15 | 1. Run `npm run dev` when you start to develop with this project.
16 |
17 | ## What is Charting Library
18 |
19 | Charting Library is a standalone solution for displaying charts. This free, downloadable library is hosted on your servers and is connected to your data feed to be used in your website or app. [Learn more and download](https://www.tradingview.com/HTML5-stock-forex-bitcoin-charting-library/).
20 |
21 | ## What is React
22 |
23 | React is a JavaScript library for building user interfaces. It is maintained by Facebook, Instagram and a community of individual developers and corporations.
24 |
25 | ## What is Nextjs
26 |
27 | Nextjs is React Sever Side Rendering Framework for React with zero-configuration.
28 |
29 | ## About This Project
30 |
31 | This project was bootstrapped with [NextJs](https://github.com/zeit/next.js).
32 |
--------------------------------------------------------------------------------
/ruby-on-rails/config/puma.rb:
--------------------------------------------------------------------------------
1 | # Puma can serve each request in a thread from an internal thread pool.
2 | # The `threads` method setting takes two numbers: a minimum and maximum.
3 | # Any libraries that use thread pools should be configured to match
4 | # the maximum value specified for Puma. Default is set to 5 threads for minimum
5 | # and maximum; this matches the default thread size of Active Record.
6 | #
7 | max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
8 | min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count }
9 | threads min_threads_count, max_threads_count
10 |
11 | # Specifies the `worker_timeout` threshold that Puma will use to wait before
12 | # terminating a worker in development environments.
13 | #
14 | worker_timeout 3600 if ENV.fetch("RAILS_ENV", "development") == "development"
15 |
16 | # Specifies the `port` that Puma will listen on to receive requests; default is 3000.
17 | #
18 | port ENV.fetch("PORT") { 3000 }
19 |
20 | # Specifies the `environment` that Puma will run in.
21 | #
22 | environment ENV.fetch("RAILS_ENV") { "development" }
23 |
24 | # Specifies the `pidfile` that Puma will use.
25 | pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }
26 |
27 | # Specifies the number of `workers` to boot in clustered mode.
28 | # Workers are forked web server processes. If using threads and workers together
29 | # the concurrency of the application would be max `threads` * `workers`.
30 | # Workers do not work on JRuby or Windows (both of which do not support
31 | # processes).
32 | #
33 | # workers ENV.fetch("WEB_CONCURRENCY") { 2 }
34 |
35 | # Use the `preload_app!` method when specifying a `workers` number.
36 | # This directive tells Puma to first boot the application and load code
37 | # before forking the application. This takes advantage of Copy On Write
38 | # process behavior so workers use less memory.
39 | #
40 | # preload_app!
41 |
42 | # Allow puma to be restarted by `bin/rails restart` command.
43 | plugin :tmp_restart
44 |
--------------------------------------------------------------------------------
/ruby-on-rails/public/422.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | The change you wanted was rejected (422)
5 |
6 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
The change you wanted was rejected.
62 |
Maybe you tried to change something you didn't have access to.
63 |
64 |
If you are the application owner check the logs for more information.
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/nextjs/README.md:
--------------------------------------------------------------------------------
1 | # TradingView Charting Library and Nextjs Integration Example (JavaScript)
2 |
3 | The earliest supported version of the Charting Library for these examples is `v28.0.0`.
4 |
5 | **This example is intended to cover Nextjs from v13 onwards.**
6 |
7 | ## How to start
8 |
9 | 1. Check that you can view . If you do not have access then you can [request access to this repository here](https://www.tradingview.com/HTML5-stock-forex-bitcoin-charting-library/).
10 | 1. Install dependencies `npm install`.
11 | 1. Copy the charting library files
12 | 1. If you are able to run bash scripts then the `copy_charting_library_files.sh` script can be used to copy the current stable version's files.
13 | 1. If you are not able to run bash scripts then do the following:
14 | 1. Copy `charting_library` folder from to `/public/static` folders.
15 | 1. Copy `datafeeds` folder from to `/public/static`.
16 | 1. Run `npm run build` and `npm run start`. It will build the project and open a default browser with the Charting Library.
17 | 1. Run `npm run dev` when you start to develop with this project.
18 |
19 | ## What is Charting Library
20 |
21 | Charting Library is a standalone solution for displaying charts. This free, downloadable library is hosted on your servers and is connected to your data feed to be used in your website or app. [Learn more and download](https://www.tradingview.com/HTML5-stock-forex-bitcoin-charting-library/).
22 |
23 | ## What is React
24 |
25 | React is a JavaScript library for building user interfaces. It is maintained by Facebook, Instagram and a community of individual developers and corporations.
26 |
27 | ## What is Nextjs
28 |
29 | Nextjs is React Sever Side Rendering Framework for React with zero-configuration.
30 |
31 | ## About This Project
32 |
33 | This project was bootstrapped with [NextJs](https://github.com/zeit/next.js).
34 |
--------------------------------------------------------------------------------
/ruby-on-rails/public/404.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | The page you were looking for doesn't exist (404)
5 |
6 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
The page you were looking for doesn't exist.
62 |
You may have mistyped the address or the page may have moved.
63 |
64 |
If you are the application owner check the logs for more information.
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/ios-swift/App/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "20x20",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "20x20",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "29x29",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "29x29",
21 | "scale" : "3x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "40x40",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "40x40",
31 | "scale" : "3x"
32 | },
33 | {
34 | "idiom" : "iphone",
35 | "size" : "60x60",
36 | "scale" : "2x"
37 | },
38 | {
39 | "idiom" : "iphone",
40 | "size" : "60x60",
41 | "scale" : "3x"
42 | },
43 | {
44 | "idiom" : "ipad",
45 | "size" : "20x20",
46 | "scale" : "1x"
47 | },
48 | {
49 | "idiom" : "ipad",
50 | "size" : "20x20",
51 | "scale" : "2x"
52 | },
53 | {
54 | "idiom" : "ipad",
55 | "size" : "29x29",
56 | "scale" : "1x"
57 | },
58 | {
59 | "idiom" : "ipad",
60 | "size" : "29x29",
61 | "scale" : "2x"
62 | },
63 | {
64 | "idiom" : "ipad",
65 | "size" : "40x40",
66 | "scale" : "1x"
67 | },
68 | {
69 | "idiom" : "ipad",
70 | "size" : "40x40",
71 | "scale" : "2x"
72 | },
73 | {
74 | "idiom" : "ipad",
75 | "size" : "76x76",
76 | "scale" : "1x"
77 | },
78 | {
79 | "idiom" : "ipad",
80 | "size" : "76x76",
81 | "scale" : "2x"
82 | },
83 | {
84 | "idiom" : "ipad",
85 | "size" : "83.5x83.5",
86 | "scale" : "2x"
87 | },
88 | {
89 | "idiom" : "ios-marketing",
90 | "size" : "1024x1024",
91 | "scale" : "1x"
92 | }
93 | ],
94 | "info" : {
95 | "version" : 1,
96 | "author" : "xcode"
97 | }
98 | }
--------------------------------------------------------------------------------
/react-native/android/app/src/main/assets/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | TradingView Charting Library demo
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/react-native/android/app/src/main/res/drawable/rn_edit_text_material.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
21 |
22 |
23 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/react-native/android/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx512m -XX:MaxMetaspaceSize=256m
13 | org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
19 |
20 | # AndroidX package structure to make it clearer which packages are bundled with the
21 | # Android operating system, and which are packaged with your app's APK
22 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
23 | android.useAndroidX=true
24 | # Automatically convert third-party libraries to use AndroidX
25 | android.enableJetifier=true
26 |
27 | # Version of flipper SDK to use with React Native
28 | FLIPPER_VERSION=0.125.0
29 |
30 | # Use this property to specify which architecture you want to build.
31 | # You can also override it from the CLI using
32 | # ./gradlew -PreactNativeArchitectures=x86_64
33 | reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64
34 |
35 | # Use this property to enable support to the new architecture.
36 | # This will allow you to use TurboModules and the Fabric render in
37 | # your application. You should enable this flag either if you want
38 | # to write custom TurboModules/Fabric components OR use libraries that
39 | # are providing them.
40 | newArchEnabled=false
41 |
42 | # Use this property to enable or disable the Hermes JS engine.
43 | # If set to false, you will be using JSC instead.
44 | hermesEnabled=true
45 |
--------------------------------------------------------------------------------
/vuejs/README.md:
--------------------------------------------------------------------------------
1 | # TradingView Charting Library and Vue.js 2 Integration Example
2 |
3 | ⚠️ Note: This example is for Vue 2.
4 |
5 | The latest supported version of the charting library for these examples is `v28.0.0`.
6 |
7 | ## How to start
8 |
9 | 1. Check that you can view
10 | [https://github.com/tradingview/charting_library/](https://github.com/tradingview/charting_library/).
11 | If you do not have access then you can
12 | [request access to this repository here](https://www.tradingview.com/HTML5-stock-forex-bitcoin-charting-library/).
13 | 1. Install dependencies `npm install`.
14 | 1. Copy the charting library files
15 | 1. If you are able to run bash scripts then the
16 | `copy_charting_library_files.sh` script can be used to copy the current
17 | stable version's files.
18 | 1. If you are not able to run bash scripts then do the following:
19 | 1. Copy the `charting_library` folder from
20 | [https://github.com/tradingview/charting_library/](https://github.com/tradingview/charting_library/)
21 | to `/public` folder.
22 | 1. Copy the `datafeeds` folder from
23 | [https://github.com/tradingview/charting_library/](https://github.com/tradingview/charting_library/)
24 | to `/public`.
25 | 1. Run `npm run dev`. It will build the project and open a default browser
26 | with the Charting Library.
27 | 1. Run `npm run build` when you are ready to build the Vue application for deployment.
28 |
29 | ## What is Charting Library
30 |
31 | Charting Library is a standalone solution for displaying charts. This free,
32 | downloadable library is hosted on your servers and is connected to your data
33 | feed to be used in your website or app.
34 | [Learn more and download](https://www.tradingview.com/HTML5-stock-forex-bitcoin-charting-library/).
35 |
36 | ## What is Vue.js
37 |
38 | Vue is a progressive framework for building user interfaces. Unlike other
39 | monolithic frameworks, Vue is designed from the ground up to be incrementally
40 | adoptable. The core library is focused on the view layer only, and is easy to
41 | pick up and integrate with other libraries or existing projects.
42 |
--------------------------------------------------------------------------------
/vuejs3/README.md:
--------------------------------------------------------------------------------
1 | # TradingView Charting Library and Vue.js 3 Integration Example
2 |
3 | ⚠️ Note: This example is for Vue 3.
4 |
5 | The latest supported version of the charting library for these examples is `v28.0.0`.
6 |
7 | ## How to start
8 |
9 | 1. Check that you can view
10 | [https://github.com/tradingview/charting_library/](https://github.com/tradingview/charting_library/).
11 | If you do not have access then you can
12 | [request access to this repository here](https://www.tradingview.com/HTML5-stock-forex-bitcoin-charting-library/).
13 | 1. Install dependencies `npm install`.
14 | 1. Copy the charting library files
15 | 1. If you are able to run bash scripts then the
16 | `copy_charting_library_files.sh` script can be used to copy the current
17 | stable version's files.
18 | 1. If you are not able to run bash scripts then do the following:
19 | 1. Copy the `charting_library` folder from
20 | [https://github.com/tradingview/charting_library/](https://github.com/tradingview/charting_library/)
21 | to `/public` folder.
22 | 1. Copy the `datafeeds` folder from
23 | [https://github.com/tradingview/charting_library/](https://github.com/tradingview/charting_library/)
24 | to `/public`.
25 | 1. Run `npm run dev`. It will build the project and open a default browser
26 | with the Charting Library.
27 | 1. Run `npm run build` when you are ready to build the Vue application for deployment.
28 |
29 | ## What is Charting Library
30 |
31 | Charting Library is a standalone solution for displaying charts. This free,
32 | downloadable library is hosted on your servers and is connected to your data
33 | feed to be used in your website or app.
34 | [Learn more and download](https://www.tradingview.com/HTML5-stock-forex-bitcoin-charting-library/).
35 |
36 | ## What is Vue.js
37 |
38 | Vue is a progressive framework for building user interfaces. Unlike other
39 | monolithic frameworks, Vue is designed from the ground up to be incrementally
40 | adoptable. The core library is focused on the view layer only, and is easy to
41 | pick up and integrate with other libraries or existing projects.
42 |
--------------------------------------------------------------------------------
/react-native/android/app/src/main/java/com/chartinglibraryexample/MainApplication.java:
--------------------------------------------------------------------------------
1 | package com.chartinglibraryexample;
2 |
3 | import android.app.Application;
4 | import com.facebook.react.PackageList;
5 | import com.facebook.react.ReactApplication;
6 | import com.facebook.react.ReactNativeHost;
7 | import com.facebook.react.ReactPackage;
8 | import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint;
9 | import com.facebook.react.defaults.DefaultReactNativeHost;
10 | import com.facebook.soloader.SoLoader;
11 | import java.util.List;
12 |
13 | public class MainApplication extends Application implements ReactApplication {
14 |
15 | private final ReactNativeHost mReactNativeHost =
16 | new DefaultReactNativeHost(this) {
17 | @Override
18 | public boolean getUseDeveloperSupport() {
19 | return BuildConfig.DEBUG;
20 | }
21 |
22 | @Override
23 | protected List getPackages() {
24 | @SuppressWarnings("UnnecessaryLocalVariable")
25 | List packages = new PackageList(this).getPackages();
26 | // Packages that cannot be autolinked yet can be added manually here, for example:
27 | // packages.add(new MyReactNativePackage());
28 | return packages;
29 | }
30 |
31 | @Override
32 | protected String getJSMainModuleName() {
33 | return "index";
34 | }
35 |
36 | @Override
37 | protected boolean isNewArchEnabled() {
38 | return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
39 | }
40 |
41 | @Override
42 | protected Boolean isHermesEnabled() {
43 | return BuildConfig.IS_HERMES_ENABLED;
44 | }
45 | };
46 |
47 | @Override
48 | public ReactNativeHost getReactNativeHost() {
49 | return mReactNativeHost;
50 | }
51 |
52 | @Override
53 | public void onCreate() {
54 | super.onCreate();
55 | SoLoader.init(this, /* native exopackage */ false);
56 | if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
57 | // If you opted-in for the New Architecture, we load the native entry point for this app.
58 | DefaultNewArchitectureEntryPoint.load();
59 | }
60 | ReactNativeFlipper.initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/react-native/ios/ChartingLibraryExampleTests/ChartingLibraryExampleTests.m:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 |
4 | #import
5 | #import
6 |
7 | #define TIMEOUT_SECONDS 600
8 | #define TEXT_TO_LOOK_FOR @"Welcome to React"
9 |
10 | @interface ChartingLibraryExampleTests : XCTestCase
11 |
12 | @end
13 |
14 | @implementation ChartingLibraryExampleTests
15 |
16 | - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL (^)(UIView *view))test
17 | {
18 | if (test(view)) {
19 | return YES;
20 | }
21 | for (UIView *subview in [view subviews]) {
22 | if ([self findSubviewInView:subview matching:test]) {
23 | return YES;
24 | }
25 | }
26 | return NO;
27 | }
28 |
29 | - (void)testRendersWelcomeScreen
30 | {
31 | UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController];
32 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS];
33 | BOOL foundElement = NO;
34 |
35 | __block NSString *redboxError = nil;
36 | #ifdef DEBUG
37 | RCTSetLogFunction(
38 | ^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) {
39 | if (level >= RCTLogLevelError) {
40 | redboxError = message;
41 | }
42 | });
43 | #endif
44 |
45 | while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) {
46 | [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
47 | [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]];
48 |
49 | foundElement = [self findSubviewInView:vc.view
50 | matching:^BOOL(UIView *view) {
51 | if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) {
52 | return YES;
53 | }
54 | return NO;
55 | }];
56 | }
57 |
58 | #ifdef DEBUG
59 | RCTSetLogFunction(RCTDefaultLogFunction);
60 | #endif
61 |
62 | XCTAssertNil(redboxError, @"RedBox error: %@", redboxError);
63 | XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS);
64 | }
65 |
66 | @end
67 |
--------------------------------------------------------------------------------
/ios-swift/App/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.swift
3 | // iOS
4 | //
5 | // Created by TradingView on 04.10.2018.
6 | // Copyright © 2018 Example Inc. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | @UIApplicationMain
12 | class AppDelegate: UIResponder, UIApplicationDelegate {
13 |
14 | var window: UIWindow?
15 |
16 |
17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
18 | // Override point for customization after application launch.
19 | return true
20 | }
21 |
22 | func applicationWillResignActive(_ application: UIApplication) {
23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
24 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
25 | }
26 |
27 | func applicationDidEnterBackground(_ application: UIApplication) {
28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
30 | }
31 |
32 | func applicationWillEnterForeground(_ application: UIApplication) {
33 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
34 | }
35 |
36 | func applicationDidBecomeActive(_ application: UIApplication) {
37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
38 | }
39 |
40 | func applicationWillTerminate(_ application: UIApplication) {
41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
42 | }
43 |
44 |
45 | }
46 |
47 |
--------------------------------------------------------------------------------
/react-native/ios/Podfile:
--------------------------------------------------------------------------------
1 | require_relative '../node_modules/react-native/scripts/react_native_pods'
2 | require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
3 |
4 | platform :ios, min_ios_version_supported
5 | prepare_react_native_project!
6 |
7 | # If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set.
8 | # because `react-native-flipper` depends on (FlipperKit,...) that will be excluded
9 | #
10 | # To fix this you can also exclude `react-native-flipper` using a `react-native.config.js`
11 | # ```js
12 | # module.exports = {
13 | # dependencies: {
14 | # ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}),
15 | # ```
16 | flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled
17 |
18 | linkage = ENV['USE_FRAMEWORKS']
19 | if linkage != nil
20 | Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
21 | use_frameworks! :linkage => linkage.to_sym
22 | end
23 |
24 | target 'ChartingLibraryExample' do
25 | config = use_native_modules!
26 |
27 | # Flags change depending on the env values.
28 | flags = get_default_flags()
29 |
30 | use_react_native!(
31 | :path => config[:reactNativePath],
32 | # Hermes is now enabled by default. Disable by setting this flag to false.
33 | # Upcoming versions of React Native may rely on get_default_flags(), but
34 | # we make it explicit here to aid in the React Native upgrade process.
35 | :hermes_enabled => flags[:hermes_enabled],
36 | :fabric_enabled => flags[:fabric_enabled],
37 | # Enables Flipper.
38 | #
39 | # Note that if you have use_frameworks! enabled, Flipper will not work and
40 | # you should disable the next line.
41 | :flipper_configuration => flipper_config,
42 | # An absolute path to your application root.
43 | :app_path => "#{Pod::Config.instance.installation_root}/.."
44 | )
45 |
46 | target 'ChartingLibraryExampleTests' do
47 | inherit! :complete
48 | # Pods for testing
49 | end
50 |
51 | post_install do |installer|
52 | react_native_post_install(
53 | installer,
54 | # Set `mac_catalyst_enabled` to `true` in order to apply patches
55 | # necessary for Mac Catalyst builds
56 | :mac_catalyst_enabled => false
57 | )
58 | __apply_Xcode_12_5_M1_post_install_workaround(installer)
59 | end
60 | end
61 |
--------------------------------------------------------------------------------
/nextjs/components/TVChartContainer/index.tsx:
--------------------------------------------------------------------------------
1 | import styles from "./index.module.css";
2 | import { useEffect, useRef } from "react";
3 | import { ChartingLibraryWidgetOptions, LanguageCode, ResolutionString, widget } from "@/public/static/charting_library";
4 |
5 | export const TVChartContainer = (props: Partial) => {
6 | const chartContainerRef =
7 | useRef() as React.MutableRefObject;
8 |
9 | useEffect(() => {
10 | const widgetOptions: ChartingLibraryWidgetOptions = {
11 | symbol: props.symbol,
12 | // BEWARE: no trailing slash is expected in feed URL
13 | datafeed: new (window as any).Datafeeds.UDFCompatibleDatafeed(
14 | "https://demo_feed.tradingview.com",
15 | undefined,
16 | {
17 | maxResponseLength: 1000,
18 | expectedOrder: "latestFirst",
19 | }
20 | ),
21 | interval: props.interval as ResolutionString,
22 | container: chartContainerRef.current,
23 | library_path: props.library_path,
24 | locale: props.locale as LanguageCode,
25 | disabled_features: ["use_localstorage_for_settings"],
26 | enabled_features: ["study_templates"],
27 | charts_storage_url: props.charts_storage_url,
28 | charts_storage_api_version: props.charts_storage_api_version,
29 | client_id: props.client_id,
30 | user_id: props.user_id,
31 | fullscreen: props.fullscreen,
32 | autosize: props.autosize
33 | };
34 |
35 | const tvWidget = new widget(widgetOptions);
36 |
37 | tvWidget.onChartReady(() => {
38 | tvWidget.headerReady().then(() => {
39 | const button = tvWidget.createButton();
40 | button.setAttribute("title", "Click to show a notification popup");
41 | button.classList.add("apply-common-tooltip");
42 | button.addEventListener("click", () =>
43 | tvWidget.showNoticeDialog({
44 | title: "Notification",
45 | body: "TradingView Charting Library API works correctly",
46 | callback: () => {
47 | console.log("Noticed!");
48 | },
49 | })
50 | );
51 |
52 | button.innerHTML = "Check API";
53 | });
54 | });
55 |
56 | return () => {
57 | tvWidget.remove();
58 | };
59 | }, [props]);
60 |
61 | return (
62 | <>
63 |
64 |
65 | TradingView Charting Library and Next.js Integration Example
66 |
67 |
68 |
69 | >
70 | );
71 | };
72 |
--------------------------------------------------------------------------------