1 | "use strict";
|
2 | var deepAssign_1 = require("./deepAssign");
|
3 | function initChart(highchartsService, userOpts, baseOpts, type) {
|
4 | var Highcharts = highchartsService.getHighchartsStatic();
|
5 | if (!Highcharts) {
|
6 | throw new Error('Base Highcharts module should be set via ChartModule.init');
|
7 | }
|
8 | if (!Highcharts[type]) {
|
9 | throw new Error(type + " is unknown chart type.");
|
10 | }
|
11 | if (Array.isArray(userOpts.xAxis)) {
|
12 | baseOpts.xAxis = [baseOpts.xAxis];
|
13 | }
|
14 | if (Array.isArray(userOpts.yAxis)) {
|
15 | baseOpts.yAxis = [baseOpts.yAxis];
|
16 | }
|
17 | var opts = deepAssign_1.deepAssign({}, baseOpts, userOpts);
|
18 | return new Highcharts[type](opts);
|
19 | }
|
20 | exports.initChart = initChart;
|
21 |
|
\ | No newline at end of file |