Skip to content

Commit fb5322e

Browse files
committed
angular-trading-widget Done for publish
1 parent 1af837b commit fb5322e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+13258
-3585
lines changed

README.md

Lines changed: 121 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,128 @@
1-
# AngularTradingviewWidget
1+
# angular-tradingview-widget
2+
React component for rendering the [TradingView Advanced Real-Time Chart Widget](https://www.tradingview.com/widget/advanced-chart/).
23

3-
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 9.0.3.
4+
## Install
5+
`npm install --save react-tradingview-widget`
46

5-
## Development server
7+
## Usage
8+
### Module
9+
```javascript
10+
import { TradingviewWidgetModule } from 'angular-tradingview-widget';
611

7-
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
12+
@NgModule({
13+
declarations: [
14+
AppComponent
15+
],
16+
imports: [
17+
BrowserModule,
18+
TradingviewWidgetModule
19+
],
20+
providers: [],
21+
bootstrap: [AppComponent]
22+
})
23+
export class AppModule { }
24+
```
25+
### component.html
26+
```javascript
27+
`<tradingview-widget [widgetConfig]="widgetConfig"></tradingview-widget>`
28+
```
29+
### component.ts
30+
```javascript
31+
widgetConfig: ITradingViewWidget = {
32+
symbol: 'NASDAQ:AAPL'
33+
}
34+
```
35+
### Constants and API differences
36+
```javascript
37+
enum BarStyles {
38+
BARS= '0',
39+
CANDLES= '1',
40+
HOLLOW_CANDLES= '9',
41+
HEIKIN_ASHI= '8',
42+
LINE= '2',
43+
AREA= '3',
44+
RENKO= '4',
45+
LINE_BREAK= '7',
46+
KAGI= '5',
47+
POINT_AND_FIGURE= '6'
48+
}
849

9-
## Code scaffolding
50+
enum IntervalTypes {
51+
D= 'D',
52+
W= 'W'
53+
};
54+
55+
enum RangeTypes {
56+
YTD= 'ytd',
57+
ALL= 'all'
58+
};
1059

11-
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
60+
enum Themes {
61+
LIGHT= 'Light',
62+
DARK= 'Dark'
63+
};
64+
interface ITradingViewWidget {
65+
allow_symbol_change?: boolean;
66+
autosize?: boolean;
67+
calendar?: boolean;
68+
details?: boolean;
69+
enable_publishing?: boolean;
70+
height?: number;
71+
hideideas?: boolean;
72+
hide_legend?: boolean;
73+
hide_side_toolbar?: boolean;
74+
hide_top_toolbar?: boolean;
75+
hotlist?: boolean;
76+
interval?:
77+
'1' |
78+
'3' |
79+
'5' |
80+
'15' |
81+
'30' |
82+
'60' |
83+
'120' |
84+
'180' |
85+
IntervalTypes.D |
86+
IntervalTypes.W;
87+
locale?: string;
88+
news?: string[];
89+
no_referral_id?: boolean;
90+
popup_height?: number | string;
91+
popup_width?: number | string;
92+
referral_id?: string;
93+
range?:
94+
'1d' |
95+
'5d' |
96+
'1m' |
97+
'3m' |
98+
'6m' |
99+
RangeTypes.YTD |
100+
'12m' |
101+
'60m' |
102+
RangeTypes.ALL;
103+
save_image?: boolean;
104+
show_popup_button?: boolean;
105+
studies?: string[];
106+
style?: BarStyles.BARS |
107+
BarStyles.CANDLES |
108+
BarStyles.HOLLOW_CANDLES |
109+
BarStyles.HEIKIN_ASHI |
110+
BarStyles.LINE |
111+
BarStyles.AREA |
112+
BarStyles.RENKO |
113+
BarStyles.LINE_BREAK |
114+
BarStyles.KAGI |
115+
BarStyles.POINT_AND_FIGURE;
116+
symbol: string;
117+
theme?: Themes.LIGHT | Themes.DARK;
118+
timezone?: string;
119+
toolbar_bg?: string;
120+
watchlist?: string[];
121+
widgetType?: string;
122+
width?: number;
123+
withdateranges?: boolean;
124+
}
125+
```
12126

13-
## Build
14127

15-
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.
16-
17-
## Running unit tests
18-
19-
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
20-
21-
## Running end-to-end tests
22-
23-
Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
24-
25-
## Further help
26-
27-
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
128+
All given props are passed on to the widget config. See [this page](https://www.tradingview.com/widget/advanced-chart/) for the TradingView Advanced Real-Time Chart API.

angular.json

Lines changed: 163 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,167 @@
22
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
33
"version": 1,
44
"newProjectRoot": "projects",
5-
"projects": {}
5+
"projects": {
6+
"angular-tradingview-widget": {
7+
"projectType": "library",
8+
"root": "projects/angular-tradingview-widget",
9+
"sourceRoot": "projects/angular-tradingview-widget/src",
10+
"prefix": "lib",
11+
"architect": {
12+
"build": {
13+
"builder": "@angular-devkit/build-ng-packagr:build",
14+
"options": {
15+
"tsConfig": "projects/angular-tradingview-widget/tsconfig.lib.json",
16+
"project": "projects/angular-tradingview-widget/ng-package.json"
17+
},
18+
"configurations": {
19+
"production": {
20+
"tsConfig": "projects/angular-tradingview-widget/tsconfig.lib.prod.json"
21+
}
22+
}
23+
},
24+
"test": {
25+
"builder": "@angular-devkit/build-angular:karma",
26+
"options": {
27+
"main": "projects/angular-tradingview-widget/src/test.ts",
28+
"tsConfig": "projects/angular-tradingview-widget/tsconfig.spec.json",
29+
"karmaConfig": "projects/angular-tradingview-widget/karma.conf.js"
30+
}
31+
},
32+
"lint": {
33+
"builder": "@angular-devkit/build-angular:tslint",
34+
"options": {
35+
"tsConfig": [
36+
"projects/angular-tradingview-widget/tsconfig.lib.json",
37+
"projects/angular-tradingview-widget/tsconfig.spec.json"
38+
],
39+
"exclude": [
40+
"**/node_modules/**"
41+
]
42+
}
43+
}
44+
}
45+
},
46+
"demo": {
47+
"projectType": "application",
48+
"schematics": {
49+
"@schematics/angular:component": {
50+
"style": "scss"
51+
}
52+
},
53+
"root": "projects/demo",
54+
"sourceRoot": "projects/demo/src",
55+
"prefix": "app",
56+
"architect": {
57+
"build": {
58+
"builder": "@angular-devkit/build-angular:browser",
59+
"options": {
60+
"outputPath": "dist/demo",
61+
"index": "projects/demo/src/index.html",
62+
"main": "projects/demo/src/main.ts",
63+
"polyfills": "projects/demo/src/polyfills.ts",
64+
"tsConfig": "projects/demo/tsconfig.app.json",
65+
"aot": true,
66+
"assets": [
67+
"projects/demo/src/favicon.ico",
68+
"projects/demo/src/assets"
69+
],
70+
"styles": [
71+
"projects/demo/src/styles.scss"
72+
],
73+
"scripts": []
74+
},
75+
"configurations": {
76+
"production": {
77+
"fileReplacements": [
78+
{
79+
"replace": "projects/demo/src/environments/environment.ts",
80+
"with": "projects/demo/src/environments/environment.prod.ts"
81+
}
82+
],
83+
"optimization": true,
84+
"outputHashing": "all",
85+
"sourceMap": false,
86+
"extractCss": true,
87+
"namedChunks": false,
88+
"extractLicenses": true,
89+
"vendorChunk": false,
90+
"buildOptimizer": true,
91+
"budgets": [
92+
{
93+
"type": "initial",
94+
"maximumWarning": "2mb",
95+
"maximumError": "5mb"
96+
},
97+
{
98+
"type": "anyComponentStyle",
99+
"maximumWarning": "6kb",
100+
"maximumError": "10kb"
101+
}
102+
]
103+
}
104+
}
105+
},
106+
"serve": {
107+
"builder": "@angular-devkit/build-angular:dev-server",
108+
"options": {
109+
"browserTarget": "demo:build"
110+
},
111+
"configurations": {
112+
"production": {
113+
"browserTarget": "demo:build:production"
114+
}
115+
}
116+
},
117+
"extract-i18n": {
118+
"builder": "@angular-devkit/build-angular:extract-i18n",
119+
"options": {
120+
"browserTarget": "demo:build"
121+
}
122+
},
123+
"test": {
124+
"builder": "@angular-devkit/build-angular:karma",
125+
"options": {
126+
"main": "projects/demo/src/test.ts",
127+
"polyfills": "projects/demo/src/polyfills.ts",
128+
"tsConfig": "projects/demo/tsconfig.spec.json",
129+
"karmaConfig": "projects/demo/karma.conf.js",
130+
"assets": [
131+
"projects/demo/src/favicon.ico",
132+
"projects/demo/src/assets"
133+
],
134+
"styles": [
135+
"projects/demo/src/styles.scss"
136+
],
137+
"scripts": []
138+
}
139+
},
140+
"lint": {
141+
"builder": "@angular-devkit/build-angular:tslint",
142+
"options": {
143+
"tsConfig": [
144+
"projects/demo/tsconfig.app.json",
145+
"projects/demo/tsconfig.spec.json",
146+
"projects/demo/e2e/tsconfig.json"
147+
],
148+
"exclude": [
149+
"**/node_modules/**"
150+
]
151+
}
152+
},
153+
"e2e": {
154+
"builder": "@angular-devkit/build-angular:protractor",
155+
"options": {
156+
"protractorConfig": "projects/demo/e2e/protractor.conf.js",
157+
"devServerTarget": "demo:serve"
158+
},
159+
"configurations": {
160+
"production": {
161+
"devServerTarget": "demo:serve:production"
162+
}
163+
}
164+
}
165+
}
166+
}},
167+
"defaultProject": "angular-tradingview-widget"
6168
}

0 commit comments

Comments
 (0)