Búsqueda de sitios web

angular - cómo importar highcharts offline-exporting en typescript


Probé las siguientes configuraciones, pero no parecen funcionar.

import * as Highcharts from 'highcharts/highstock';
/*import * as HighchartsExporting from 'highcharts/modules/exporting';
HighchartsExporting(Highcharts);*/
require('highcharts/modules/offline-exporting')(Highcharts);

obtener el siguiente error: No se puede invocar una expresión cuyo tipo carece de una firma de llamada. El tipo '{}' no tiene firmas de llamada compatibles.

alguien sabe cómo hacer que esto funcione.

Respuesta #1

exportación fuera de línea de highcharts:

import * as Highcharts from 'highcharts';
import exporting from 'highcharts/modules/exporting';
import offline from 'highcharts/modules/offline-exporting';
exporting(Highcharts);
offline(Highcharts);

Respuesta #2

aquí hay una solución

import * as Highcharts from 'highcharts/highstock';
import * as HighchartsExporting from 'highcharts/modules/exporting';
HighchartsExporting(Highcharts);

Esto es suficientemente bueno para funcionar, no se requiere un comando require separado.

Artículos relacionados