gevgeny / angular2-highcharts

:bar_chart: :chart_with_upwards_trend: Highcharts for your Angular project
MIT License
380 stars 113 forks source link

Highstock dependency on angular2-highcharts #34

Open anup-kubade opened 8 years ago

anup-kubade commented 8 years ago

We have observed that the angular2-highcharts library uses highstock internally, as it supports Highcharts and Highstock both. But we have only license for Highcharts library. So is there any way to exclude highstock library while using angular2-highcharts?

gevgeny commented 8 years ago

Unfortunately I don't have ideas how it is possible to provide highcharts only and highstock as an optional module like the map or other highcharts modules. The root of this problem is how original highcharts CommonJS modules presented: http://www.highcharts.com/docs/getting-started/install-from-npm. So probably it makes sense to create issue here https://github.com/highcharts/highcharts/issues so they move highstock to a module.

LithMage commented 8 years ago

As long your not using highcstock charts you are in no problems (though i would advice asking Highcharts about that to be extra sure).

Also on same note, https://github.com/gevgeny/angular2-highcharts/blob/master/src/Highcharts.ts#L4 this binding to Highstocks.src.js can be exchanged to just Highcharts.src.js? That is if not using any Highstocks functionality?

gevgeny commented 8 years ago

Also on same note, https://github.com/gevgeny/angular2-highcharts/blob/master/src/Highcharts.ts#L4 this binding to Highstocks.src.js can be exchanged to just Highcharts.src.js? That is if not using any Highstocks functionality?

Yes, i think it would work, you can do it in your local repo.

LithMage commented 8 years ago

It worked but i havent used charts extensively so wasnt sure if some part is dependant onto it.

graingert commented 7 years ago

You can use webpack to override specific modules.

Really I'd rather have support for passing in a configured Highcharts instance

stridsbr commented 7 years ago

Could you give an example on how that would look in webpack config @graingert ? I'm new to webpack.

graingert commented 7 years ago

create an injectable stub service:

@Injectable()
export class AsyncHighchartsService {
  async getHighcharts(): void {} //stub
}

Then depend on it from your component.

Then export two version of the component in default modules, in index (import angular2-highcharts), export a version that provides a hard coded AsyncHighchartsService implementation that pull it out via an import statement, and another module on angular2-highcharts/custom that leaves the implementation up to the user

graingert commented 7 years ago

then a user can replace the getHighcharts async method with a static import of highstock/highcharts whatever they choose, or they can async load it via a webpack chunks, or they can async load using whatever too they want.