question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Highstock on angular cli

See original GitHub issue

I try to implement highstock in angular cli but it seems it doesn’t work. The simple charts works fine but with highstock I get the error- “StockChart is unknown chart type”

app.commponent.ts `import { Component } from ‘@angular/core’; import {Jsonp} from ‘@angular/http’;

@Component({ selector: ‘app-root’, styles: [ chart { display: block; } ], template: <chart type="StockChart" [options]="options"></chart> }) export class AppComponent { constructor(jsonp : Jsonp) { jsonp.request(‘https://www.highcharts.com/samples/data/jsonp.php?filename=aapl-c.json&callback=JSONP_CALLBACK’).subscribe(res => { this.options = { title : { text : ‘AAPL Stock Price’ }, series : [{ name : ‘AAPL’, data : res.json(), tooltip: { valueDecimals: 2 } }] }; }); } options: Object; }`

app.module.ts `import { BrowserModule } from ‘@angular/platform-browser’; import { NgModule } from ‘@angular/core’; import { FormsModule } from ‘@angular/forms’; import { HttpModule,Jsonp,JsonpModule } from ‘@angular/http’; import { ChartModule } from ‘angular2-highcharts’; import { AppComponent } from ‘./app.component’;

@NgModule({ declarations: [ AppComponent ], imports: [ BrowserModule, FormsModule, ChartModule, JsonpModule, HttpModule ], providers: [], bootstrap: [AppComponent] }) export class AppModule { }`

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:40 (10 by maintainers)

github_iconTop GitHub Comments

11reactions
ftavillacommented, Jan 7, 2017

Hi,

I found that you can alias highstock.js in tsconfig.ts file as following:

  "compilerOptions": {  
      ...,  
      "paths": {  
          "highcharts": ["../node_modules/highcharts/highstock.js"]   
       }  
   }```

That will do the same thing as mention in the README for those using angular cli.

Hope it helps.
4reactions
arjenbrandenburghcommented, Nov 21, 2016

Not sure why this issue is closed. It still persist on the latest angular-cli (1.0.0-beta.20-4). Currently still on angular2-highcharts 0.3.4 since the 0.4.1 breaks the charts with the following error:

inline template:121:7 caused by: StockChart is unknown chart type

The examples provided don’t work on angular-cli. Don’t really see how the solution of @zawars solves anything. Think he just removed the “type” from the chart-tag and the angular2-highcharts is falling back to a regular chart which happens to work with his config.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Highcharts with Angular V14
Learn how to create an interactive chart with Highcharts and Angular 14 via node.
Read more >
highcharts-angular - npm
This is a Highcharts instance optionally with initialized modules, plugins, maps, wrappers and set global options using setOptions . The core is ...
Read more >
Angular Highcharts - Quick Guide - Tutorialspoint
HighChart Angular Wrapper is a open source angular based component to provides an elegant and feature rich Highcharts visualizations within an Angular ......
Read more >
Highstock Angular Cli (forked) - StackBlitz
Highstock using Angular cli.
Read more >
highcharts-angular examples - CodeSandbox
Learn how to use highcharts-angular by viewing and forking highcharts-angular example apps on CodeSandbox.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found