gevgeny / angular2-highcharts

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

issue on treemap #232

Closed mFouadShaheen closed 6 years ago

mFouadShaheen commented 6 years ago

Hello,

i tried to use treemap but unfortunately it gives me error#17 each time I included highcharts, highcharts-more and highstock in my app module like this:

export function highchartsFactory() { var hc = require('highcharts'); var hs = require('highcharts/highstock'); var hcm = require('highcharts/highcharts-more'); var ex = require('highcharts/modules/exporting'); var hm = require('highcharts/modules/heatmap'); var sg = require('highcharts/modules/solid-gauge'); hs(hc); hcm(hc); ex(hc); hm(hc); sg(hc); return hc; } providers: [{ provide: HighchartsStatic, useFactory: highchartsFactory } and then used the example lie this:

` this.treeMapOptions = { colorAxis: { minColor: '#FFFFFF', maxColor: '#999' }, series: [{ type: 'treemap', layoutAlgorithm: 'squarified', data: [{ name: 'A', value: 6, colorValue: 'red' }, { name: 'B', value: 6, color: 'yellow' }, { name: 'C', value: 4, color: 'green' }, { name: 'D', value: 3, color: 'blue' }, { name: 'E', value: 2, colorValue: 5 }, { name: 'F', value: 2, colorValue: 6 }, { name: 'G', value: 1, colorValue: 7 }] }], title: { text: 'Highcharts Treemap' } };

<chart [options]="treeMapOptions"> ` but it keeps gives me the #17 error in the console

17

is there any solution for this!?

thanks

Janatbek commented 6 years ago

did you get it working?

mFouadShaheen commented 6 years ago

yes, I just registered it like this in the my module:

`import { ChartModule } from 'angular2-highcharts'; import { HighchartsStatic } from 'angular2-highcharts/dist/HighchartsService';

export function highchartsFactory() { var hc = require('highcharts'); var hcm = require('highcharts/highcharts-more'); var hr = require('highcharts/modules/treemap');

 hcm(hc);
 hr(hc);
 return hc;

}

@NgModule({ providers: [{ provide: HighchartsStatic, useFactory: highchartsFactory }] }) `

and it's now working fine

Janatbek commented 6 years ago

Thanks, is there any open public repository that I can see the code?

mFouadShaheen commented 6 years ago

unfortunately no, but I can help you if there's a problem

Janatbek commented 6 years ago

Thanks for offering me your help, I actually need your help on bringing highcharts in a non-angular-cli project via node-modules with import module. I cannot achieve it. Can you help me with that? link to the project: angular-highcharts-treemap

bhushankummar commented 6 years ago

This issue should be reopened. Because it does not support pure angular2/4 support. We have to add JS files to index.html to get it working, looks like a temporary fix. https://github.com/Janatbek/angular-highcharts-treemap/blob/master/src/index.html

Can anyone get the pure angular2/4 support for Tree map?