Advertisement
Guest User

Untitled

a guest
Jun 25th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.09 KB | None | 0 0
  1. import { DashboardComponent } from './Dashboard/dashboard.component';
  2. import { BrowserModule } from '@angular/platform-browser';
  3. import { NgModule } from '@angular/core';
  4. import { ChartModule, HIGHCHARTS_MODULES } from 'angular-highcharts';
  5.  
  6. import { AppComponent } from './app.component';
  7.  
  8. import stock from 'highcharts/modules/stock.src';
  9. import more from 'highcharts/highcharts-more.src';
  10.  
  11.  
  12. export function highchartsModules() {
  13. // apply Highcharts Modules to this array
  14. return [stock, more];
  15. }
  16.  
  17. @NgModule({
  18. declarations: [
  19. AppComponent,
  20. DashboardComponent,
  21. ],
  22. imports: [
  23. BrowserModule,
  24. ChartModule
  25. ],
  26.  
  27. providers: [
  28. {
  29. provide: HIGHCHARTS_MODULES,
  30. useFactory: highchartsModules
  31. }
  32. ],
  33. bootstrap: [AppComponent]
  34. })
  35. export class AppModule {
  36.  
  37.  
  38. }
  39.  
  40. import { Component, OnInit } from '@angular/core';
  41. import { Chart, StockChart } from 'angular-highcharts';
  42.  
  43. @Component({
  44. selector: 'app-dashboard',
  45. templateUrl: './dashboard.component.html',
  46. styleUrls: ['./dashboard.component.css']
  47. })
  48. export class DashboardComponent {
  49.  
  50. stock: StockChart;
  51.  
  52. constructor() { }
  53.  
  54.  
  55. ngAfterViewInit() {
  56. this.stock = new StockChart({
  57. rangeSelector: {
  58. selected: 1
  59. },
  60. title: {
  61. text: 'AAPL Stock Price'
  62. },
  63. series: [{
  64. // tooltip: {
  65. // valueDecimals: 2
  66. // },
  67. name: 'AAPL',
  68. data: [
  69. [1293580800000, 46.47],
  70. [1293667200000, 46.24],
  71. [1293753600000, 46.08],
  72. /* Jan 2011 */
  73. [1294012800000, 47.08],
  74. [1294099200000, 47.33],
  75. [1294185600000, 47.71],
  76. [1294272000000, 47.68],
  77. [1294358400000, 48.02],
  78. [1294617600000, 48.92],
  79. [1294704000000, 48.81],
  80. [1294790400000, 49.20],
  81. [1294876800000, 49.38],
  82. [1294963200000, 49.78],
  83. [1295308800000, 48.66],
  84. [1295395200000, 48.41],
  85. [1295481600000, 47.53],
  86. [1295568000000, 46.67],
  87. [1295827200000, 48.21],
  88. [1295913600000, 48.77],
  89. [1296000000000, 49.12],
  90. [1296086400000, 49.03],
  91. [1296172800000, 48.01],
  92. [1296432000000, 48.47]
  93.  
  94. ]
  95. }]
  96. });
  97. }
  98. }
  99.  
  100. <div [chart]="stock"></div>
  101.  
  102. {
  103. "name": "angular-io-example",
  104. "version": "1.0.0",
  105. "private": true,
  106. "description": "Example project from an angular.io guide.",
  107. "scripts": {
  108. "ng": "ng",
  109. "build": "ng build --prod",
  110. "start": "ng serve",
  111. "test": "ng test",
  112. "lint": "tslint ./src/**/*.ts -t verbose",
  113. "e2e": "ng e2e"
  114. },
  115. "keywords": [],
  116. "author": "",
  117. "license": "MIT",
  118. "dependencies": {
  119. "@angular/animations": "~5.0.0",
  120. "@angular/common": "~5.0.0",
  121. "@angular/compiler": "~5.0.0",
  122. "@angular/compiler-cli": "~5.0.0",
  123. "@angular/core": "~5.0.0",
  124. "@angular/forms": "~5.0.0",
  125. "@angular/http": "~5.0.0",
  126. "@angular/platform-browser": "~5.0.0",
  127. "@angular/platform-browser-dynamic": "~5.0.0",
  128. "@angular/platform-server": "~5.0.0",
  129. "@angular/router": "~5.0.0",
  130. "@angular/upgrade": "~5.0.0",
  131. "@types/jquery": "^3.3.4",
  132. "angular-highcharts": "^6.1.3",
  133. "angular-in-memory-web-api": "~0.5.0",
  134. "angular2-highcharts": "^0.5.5",
  135. "bootstrap": "^4.1.1",
  136. "core-js": "^2.4.1",
  137. "highcharts": "^6.1.0",
  138. "jquery": "^3.3.1",
  139. "rxjs": "^5.5.0",
  140. "zone.js": "^0.8.4"
  141. },
  142. "devDependencies": {
  143. "@angular/cli": "1.6.5",
  144. "@types/highcharts": "^5.0.22",
  145. "@types/jasmine": "~2.8.0",
  146. "@types/jasminewd2": "^2.0.3",
  147. "@types/node": "^6.0.45",
  148. "jasmine-core": "~2.8.0",
  149. "jasmine-spec-reporter": "^4.2.1",
  150. "karma": "^1.3.0",
  151. "karma-chrome-launcher": "^2.0.0",
  152. "karma-cli": "^1.0.1",
  153. "karma-coverage-istanbul-reporter": "^1.3.3",
  154. "karma-jasmine": "^1.0.2",
  155. "karma-jasmine-html-reporter": "^0.2.2",
  156. "karma-phantomjs-launcher": "^1.0.2",
  157. "lodash": "^4.16.2",
  158. "phantomjs-prebuilt": "^2.1.7",
  159. "protractor": "~5.1.0",
  160. "ts-node": "^3.3.0",
  161. "tslint": "^3.15.1",
  162. "typescript": "2.4.2"
  163. },
  164. "repository": {}
  165. }
  166.  
  167. <!doctype html>
  168. <html lang="en">
  169.  
  170. <head>
  171. <meta charset="utf-8">
  172. <title>MyApp</title>
  173. <base href="/">
  174.  
  175. <meta name="viewport" content="width=device-width, initial-scale=1">
  176. <link rel="icon" type="image/x-icon" href="favicon.ico">
  177. <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
  178.  
  179.  
  180. <!-- Bootstrap CSS -->
  181. <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" integrity="sha384-9gVQ4dYFwwWSjIDZnLEWnxCjeSWFphJiwGPXr1jddIhOegiu1FwO5qRGvFXOdJZ4"
  182. crossorigin="anonymous">
  183.  
  184. <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.13/css/all.css" integrity="sha384-DNOHZ68U8hZfKXOrtjWvjxusGo9WQnrNx2sqG0tfsghAvtVlRW3tvkXWZh58N9jp"
  185. crossorigin="anonymous">
  186.  
  187. <!--Implementing High Stock Charts -->
  188. <!--<script src="https://code.highcharts.com/stock/highstock.js"></script>
  189. <script src="https://code.highcharts.com/stock/modules/exporting.js"></script>-->
  190.  
  191. </head>
  192.  
  193. <body>
  194. <app-root></app-root>
  195.  
  196. <!-- Optional JavaScript -->
  197. <!-- jQuery first, then Popper.js, then Bootstrap JS -->
  198. <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
  199. crossorigin="anonymous"></script>
  200. <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js" integrity="sha384-cs/chFZiN24E4KMATLdqdvsezGxaGsi4hLGOzlXwp5UZB1LY//20VyM2taTB4QvJ"
  201. crossorigin="anonymous"></script>
  202. <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js" integrity="sha384-uefMccjFJAIv6A+rW+L4AHf99KvxDjWSu1z9VI8SKNVmz4sk7buKt/6v9KI65qnm"
  203. crossorigin="anonymous"></script>
  204. </body>
  205.  
  206. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement